mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
refactor: streamline update check logic and enhance log handling
This commit is contained in:
+20
-19
@@ -29,6 +29,7 @@ import libtorrent as lt
|
|||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import json
|
import json
|
||||||
|
import asyncio
|
||||||
from core.utils.general.logs import consoleLog, remove_download_log, flush_log_buffer
|
from core.utils.general.logs import consoleLog, remove_download_log, flush_log_buffer
|
||||||
from core.utils.general.wrappers import run_thread
|
from core.utils.general.wrappers import run_thread
|
||||||
from core.utils.data.state import state
|
from core.utils.data.state import state
|
||||||
@@ -103,23 +104,22 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
state.version = build_info.get("version")
|
state.version = build_info.get("version")
|
||||||
|
|
||||||
# Check for updates on Windows
|
# Check for updates on Windows
|
||||||
if state.ignore_updates is False:
|
if state.ignore_updates is False and platform.system() == "Windows":
|
||||||
if platform.system() == "Windows":
|
result = check_for_updates()
|
||||||
result = check_for_updates()
|
if result != (None, None):
|
||||||
if result != (None, None):
|
assets, latest_version = result
|
||||||
assets, latest_version = result
|
|
||||||
|
|
||||||
if assets:
|
if assets:
|
||||||
msg = QMessageBox()
|
msg = QMessageBox()
|
||||||
msg.setIcon(QMessageBox.Icon.Information)
|
msg.setIcon(QMessageBox.Icon.Information)
|
||||||
msg.setWindowTitle("Update Available")
|
msg.setWindowTitle("Update Available")
|
||||||
msg.setText("A new version is available.")
|
msg.setText("A new version is available.")
|
||||||
msg.setInformativeText("Press Ok to download the update.")
|
msg.setInformativeText("Press Ok to download the update.")
|
||||||
msg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ignore)
|
msg.setStandardButtons(QMessageBox.StandardButton.Ok | QMessageBox.StandardButton.Ignore)
|
||||||
|
|
||||||
response = msg.exec_()
|
response = msg.exec_()
|
||||||
if response == QMessageBox.StandardButton.Ok:
|
if response == QMessageBox.StandardButton.Ok:
|
||||||
download_update(latest_version)
|
download_update(latest_version)
|
||||||
|
|
||||||
self.setWindowTitle("Software Manager")
|
self.setWindowTitle("Software Manager")
|
||||||
self.setGeometry(100, 100, 800, 600)
|
self.setGeometry(100, 100, 800, 600)
|
||||||
@@ -476,10 +476,11 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
MainWindow._instance.log_signal.emit(text)
|
MainWindow._instance.log_signal.emit(text)
|
||||||
|
|
||||||
def _on_log_signal(self, text):
|
def _on_log_signal(self, text):
|
||||||
self.consoleLog.append(text)
|
if hasattr(self, 'consoleLog'):
|
||||||
self.consoleLog.verticalScrollBar().setValue(
|
self.consoleLog.append(text)
|
||||||
self.consoleLog.verticalScrollBar().maximum()
|
self.consoleLog.verticalScrollBar().setValue(
|
||||||
)
|
self.consoleLog.verticalScrollBar().maximum()
|
||||||
|
)
|
||||||
|
|
||||||
def update_image_overlay(self, new_image_path):
|
def update_image_overlay(self, new_image_path):
|
||||||
self.image = QImage(new_image_path)
|
self.image = QImage(new_image_path)
|
||||||
|
|||||||
Reference in New Issue
Block a user