1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00

Code cleanup

CloudSaves: don't save `save_path` in case it hasn't changed
IconGameWidget/ListGameWidget: Remove dead code
RareCore: add string translations
utils/paths: Use `AppDataLocation` instead of deprecated `DataLocation`
This commit is contained in:
loathingKernel 2023-03-16 12:38:33 +02:00
parent 837b391350
commit 44590bb92b
No known key found for this signature in database
GPG key ID: CE0C72D0B53821FD
5 changed files with 9 additions and 38 deletions

View file

@ -89,7 +89,8 @@ class CloudSaves(QWidget, SideTabContents):
return True, text, IndicatorReasonsCommon.VALID
def save_save_path(self, text: str):
self.rgame.save_path = text
if text != self.rgame.save_path:
self.rgame.save_path = text
def upload(self):
self.sync_ui.upload_button.setDisabled(True)

View file

@ -43,20 +43,3 @@ class IconGameWidget(GameWidget):
if a0 is not None:
a0.accept()
self.ui.leaveAnimation(self)
# def sync_finished(self, app_name):
# if not app_name == self.rgame.app_name:
# return
# super().sync_finished(app_name)
# self.leaveEvent(None)
# def game_finished(self, app_name, error):
# if app_name != self.rgame.app_name:
# return
# self.game_running = False
# self.leaveEvent(None)
#
# def game_started(self, app_name):
# if app_name == self.rgame.app_name:
# self.game_running = True
# self.leaveEvent(None)

View file

@ -62,19 +62,6 @@ class ListGameWidget(GameWidget):
a0.accept()
self.ui.tooltip_label.setVisible(False)
# def game_started(self, app_name):
# if app_name == self.rgame.app_name:
# self.game_running = True
# # self.update_text()
# self.ui.launch_btn.setDisabled(True)
# def game_finished(self, app_name, error):
# if app_name != self.rgame.app_name:
# return
# super().game_finished(app_name, error)
# # self.update_text(None)
# self.ui.launch_btn.setDisabled(False)
"""
Painting and progress overrides.
Let them live here until a better alternative is divised.

View file

@ -266,7 +266,7 @@ class RareCore(QObject):
rgame.owned_dlcs.append(rdlc)
self.__add_game(rdlc)
self.__add_game(rgame)
self.progress.emit(int(idx/length * 80) + 20, f"Loaded <b>{rgame.app_title}</b>")
self.progress.emit(int(idx/length * 80) + 20, self.tr("Loaded <b>{}</b>").format(rgame.app_title))
@pyqtSlot(object, int)
def handle_result(self, result: object, res_type: int):
@ -277,13 +277,13 @@ class RareCore(QObject):
self.__fetched_dlcs.update(dlc_dict)
self.fetch_non_asset()
self.__games_fetched = True
status = "Prepared games"
status = self.tr("Prepared games")
if res_type == FetchWorker.Result.NON_ASSET:
games, dlc_dict = result
self.__fetched_games+= games
self.__fetched_dlcs.update(dlc_dict)
self.__non_asset_fetched = True
status = "Prepared games without assets"
status = self.tr("Prepared games without assets")
logger.info(f"Got API results for {FetchWorker.Result(res_type).name}")
fetched = [
@ -382,7 +382,7 @@ class RareCore(QObject):
# self.__image_manager.download_image(rgame.game, rgame.set_pixmap, 0, False)
rgame.load_pixmap()
# lk: activity perception delay
time.sleep(0.0003)
time.sleep(0.0005)
pixmap_worker = QRunnable.create(__load_pixmaps)
QThreadPool.globalInstance().start(pixmap_worker)

View file

@ -20,9 +20,9 @@ resources_path = Path(__file__).absolute().parent.parent.joinpath("resources")
# lk: delete old Rare directories
for old_dir in [
Path(QStandardPaths.writableLocation(QStandardPaths.CacheLocation), "rare").joinpath("tmp"),
Path(QStandardPaths.writableLocation(QStandardPaths.DataLocation), "rare").joinpath("images"),
Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation), "rare").joinpath("images"),
Path(QStandardPaths.writableLocation(QStandardPaths.CacheLocation), "rare"),
Path(QStandardPaths.writableLocation(QStandardPaths.DataLocation), "rare"),
Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation), "rare"),
]:
if old_dir.exists():
# lk: case-sensitive matching on Winblows
@ -37,7 +37,7 @@ def lock_file() -> Path:
def data_dir() -> Path:
return Path(QStandardPaths.writableLocation(QStandardPaths.DataLocation))
return Path(QStandardPaths.writableLocation(QStandardPaths.AppDataLocation))
def cache_dir() -> Path: