Compare commits

...

6 Commits

Author SHA1 Message Date
Vxrtrauter 1a59c45ba4 fix qtablewidget section width 2025-12-16 11:25:40 +01:00
Vxrtrauter 293c1c3ad1 fix settings icon again? probably os issue 2025-12-16 11:00:11 +01:00
KeksNino f30cc5da5e fix typo 2025-11-15 00:20:41 +01:00
KeksNino 004c7ad416 add build_info.json
to fix updater when running from source
2025-11-15 00:19:50 +01:00
Vxrtrauter 65f7c04936 refactor: clean up unused imports and improve code organization 2025-11-15 00:16:47 +01:00
KeksNino 9d0d5332bf fixed updater 2025-10-31 13:45:30 +01:00
4 changed files with 42 additions and 17 deletions
+3
View File
@@ -0,0 +1,3 @@
{
"Version": "dev"
}
+36 -16
View File
@@ -40,13 +40,10 @@ from core.network.aria2_integration import dlprogress
def download_update(latest_version):
old_filename = f"SoftwareManager-dev-{state.version.replace('-dev', '')}-windows.exe"
new_filename = f"SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
url = f"https://github.com/KeksPirates/SoftwareManager/releases/latest/download/SoftwareManager-dev-{latest_version.replace('-dev', '')}-windows.exe"
print("Downloading update...")
if os.path.exists(old_filename):
os.remove(old_filename)
response = r.get(url, allow_redirects=True)
with open(new_filename, "wb") as f:
f.write(response.content)
@@ -54,6 +51,14 @@ def download_update(latest_version):
raise FileNotFoundError("Executable not found")
subprocess.Popen([new_filename], shell=True)
time.sleep(0.5)
msg = QMessageBox()
msg.setIcon(QMessageBox.Information)
msg.setWindowTitle("New Version")
msg.setText("New version installed.")
msg.setInformativeText("Please remove the old exe.")
msg.setStandardButtons(QMessageBox.Ok)
sys.exit(0)
@@ -71,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("Please visit the GitHub releases page to download the latest version.")
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)
@@ -110,13 +116,20 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.emptyLibrary = QLabel("No items in library.")
self.emptyDownload = QLabel("No items in downloads.")
self.progressbar = QProgressBar()
# Table Widget for Item List
self.qtablewidget = QTableWidget()
self.qtablewidget.setColumnCount(2)
self.qtablewidget.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers)
self.qtablewidget.verticalHeader().setVisible(False)
self.qtablewidget.setHorizontalHeaderLabels(["Post Title", "Author"])
self.qtablewidget.horizontalHeader().setSectionResizeMode(0, QHeaderView.Stretch)
header = self.qtablewidget.horizontalHeader()
header.setSectionResizeMode(0, QHeaderView.Stretch)
header.setSectionResizeMode(1, QHeaderView.Fixed)
header.setStretchLastSection(False)
self.qtablewidget.setAttribute(Qt.WA_TranslucentBackground)
self.qtablewidget.viewport().setAttribute(Qt.WA_TranslucentBackground)
@@ -217,8 +230,8 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.tracker_list.activated.connect(self.set_tracker)
if darkdetect.isDark():
settings_action = QAction(QIcon("core/interface/assets/settings_white.png"), "Settings", self)
settings_action = QAction(QIcon("core/interface/assets/settings_black.png"), "Settings", self)
settings_action = QAction(QIcon("core/interface/assets/settings_white.png"), "Settings", self)
settings_action.triggered.connect(lambda: settings_dialog(self))
toolbar.addAction(settings_action)
@@ -267,3 +280,10 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
else:
self.emptyResults.hide()
self.qtablewidget.show()
# thank you claude
def resizeEvent(self, event):
super().resizeEvent(event)
table_width = self.qtablewidget.viewport().width()
self.qtablewidget.setColumnWidth(1, int(table_width * 0.3))
+1 -1
View File
@@ -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
+2
View File
@@ -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.")