mirror of
https://github.com/KeksPirates/SoftwareManager.git
synced 2026-08-03 17:39:42 +02:00
feat: QoL features to Updater, workflow trigger.
This commit is contained in:
@@ -205,11 +205,9 @@ def _download_update(assets):
|
|||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
|
||||||
def windowCloseHelper():
|
def windowCloseHelper():
|
||||||
QGuiApplication.quit()
|
QGuiApplication.quit()
|
||||||
|
|
||||||
|
|
||||||
class ElidedItemDelegate(QStyledItemDelegate):
|
class ElidedItemDelegate(QStyledItemDelegate):
|
||||||
def __init__(self, get_hovered_row, parent=None):
|
def __init__(self, get_hovered_row, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@@ -274,13 +272,13 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
|
|||||||
state.version = build_info.get("version")
|
state.version = build_info.get("version")
|
||||||
|
|
||||||
if state.ignore_updates is False and platform.system() == "Windows":
|
if state.ignore_updates is False and platform.system() == "Windows":
|
||||||
assets = get_updates()
|
assets, latest = get_updates()
|
||||||
if assets != None:
|
if assets != None:
|
||||||
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(f"A new version is available\n({latest})")
|
||||||
msg.setInformativeText("Press Ok to download the update.")
|
msg.setInformativeText("Press Ok to download.")
|
||||||
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:
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ from core.utils.logging.logs import consoleLog
|
|||||||
|
|
||||||
def get_updates():
|
def get_updates():
|
||||||
url = f"https://api.github.com/repos/KeksPirates/SoftwareManager/releases/latest"
|
url = f"https://api.github.com/repos/KeksPirates/SoftwareManager/releases/latest"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
response = requests.get(url, timeout=15)
|
response = requests.get(url, timeout=15)
|
||||||
except requests.RequestException as e:
|
except requests.RequestException as e:
|
||||||
@@ -33,9 +32,9 @@ def get_updates():
|
|||||||
url=asset['browser_download_url'],
|
url=asset['browser_download_url'],
|
||||||
hash=asset.get('digest')
|
hash=asset.get('digest')
|
||||||
))
|
))
|
||||||
return release_assets
|
return release_assets, latest_version
|
||||||
else:
|
else:
|
||||||
return None
|
return None, None
|
||||||
else:
|
else:
|
||||||
consoleLog("Already up-to-date.")
|
consoleLog("Already up-to-date.")
|
||||||
return None
|
return None, None
|
||||||
|
|||||||
Reference in New Issue
Block a user