From 65f7c0493626558c0866b09a916f1bce7d110bcd Mon Sep 17 00:00:00 2001 From: Vxrtrauter Date: Sat, 15 Nov 2025 00:16:47 +0100 Subject: [PATCH] refactor: clean up unused imports and improve code organization --- core/interface/gui.py | 23 ++++++++++++----------- core/utils/data/state.py | 2 +- core/utils/network/update_checker.py | 2 ++ 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/core/interface/gui.py b/core/interface/gui.py index 43a4974..7a572c9 100644 --- a/core/interface/gui.py +++ b/core/interface/gui.py @@ -76,19 +76,20 @@ class MainWindow(QtWidgets.QMainWindow, QWidget): if state.ignore_updates is False: if platform.system() == "Windows": result = check_for_updates() - assets, latest_version = result + if result != (None, None): + assets, latest_version = result - if assets: - msg = QMessageBox() - msg.setIcon(QMessageBox.Information) - msg.setWindowTitle("Update Available") - msg.setText("A new version is available.") - msg.setInformativeText("Press Ok to download the update.") - msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore) + if assets: + msg = QMessageBox() + msg.setIcon(QMessageBox.Information) + msg.setWindowTitle("Update Available") + msg.setText("A new version is available.") + msg.setInformativeText("Press Ok to download the update.") + msg.setStandardButtons(QMessageBox.Ok | QMessageBox.Ignore) - response = msg.exec_() - if response == QMessageBox.Ok: - download_update(latest_version) + response = msg.exec_() + if response == QMessageBox.Ok: + download_update(latest_version) self.setWindowTitle("Software Manager") self.setGeometry(100, 100, 800, 600) diff --git a/core/utils/data/state.py b/core/utils/data/state.py index 5cd3dab..a614727 100644 --- a/core/utils/data/state.py +++ b/core/utils/data/state.py @@ -12,7 +12,7 @@ class AppState(QObject): self.post_urls: List[str] = [] self.post_author: List[str] = [] self.downloads: List[str] = [] - self.version: str + self.version: str = "dev" self._image_path: str = "" self.ignore_updates: bool = False self.debug: bool = False diff --git a/core/utils/network/update_checker.py b/core/utils/network/update_checker.py index 24ac0b2..20dbdac 100644 --- a/core/utils/network/update_checker.py +++ b/core/utils/network/update_checker.py @@ -30,6 +30,8 @@ def check_for_updates(): for asset in assets: print(f" - {asset['name']}: {asset['browser_download_url']}") return assets, latest_version + else: + return None, None else: if state.debug: print("Already up-to-date.")