fix update dialog

- fix initializer
- fix exec call
- fix opening link
This commit is contained in:
leminlimez
2024-12-04 15:35:59 -05:00
parent 560a9b9ec7
commit 563c426e6e
3 changed files with 6 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ from requests import get, RequestException
from json import JSONDecodeError from json import JSONDecodeError
from devicemanagement.constants import Version from devicemanagement.constants import Version
Nugget_Repo_URL = "https://api.github.com/repos/leminlimez/Nugget/releases/latest" Nugget_Repo = "leminlimez/Nugget/releases/latest"
last_fetched_version: str = None last_fetched_version: str = None
@@ -23,7 +23,7 @@ def get_latest_version() -> str:
return last_fetched_version return last_fetched_version
# fetch with web requests # fetch with web requests
try: try:
response = get(Nugget_Repo_URL) response = get(f"https://api.github.com/repos/{Nugget_Repo}")
response.raise_for_status() # To raise an exception for 4xx/5xx responses response.raise_for_status() # To raise an exception for 4xx/5xx responses
data = response.json() # Parse the JSON response data = response.json() # Parse the JSON response

View File

@@ -3,7 +3,7 @@ from PySide6.QtGui import QFont
from webbrowser import open_new_tab from webbrowser import open_new_tab
from controllers.web_request_handler import Nugget_Repo_URL, get_latest_version from controllers.web_request_handler import Nugget_Repo, get_latest_version
class GestaltDialog(QDialog): class GestaltDialog(QDialog):
def __init__(self, device_manager, gestalt_label, selected_file, parent=None): def __init__(self, device_manager, gestalt_label, selected_file, parent=None):
@@ -34,7 +34,7 @@ class GestaltDialog(QDialog):
class UpdateAppDialog(QDialog): class UpdateAppDialog(QDialog):
def __init__(self, parent=None): def __init__(self, parent=None):
super.__init__(parent) super().__init__(parent)
QBtn = ( QBtn = (
QDialogButtonBox.Ok | QDialogButtonBox.Cancel QDialogButtonBox.Ok | QDialogButtonBox.Cancel
@@ -64,5 +64,5 @@ class UpdateAppDialog(QDialog):
def accept(self): def accept(self):
# open up the repo page # open up the repo page
open_new_tab(Nugget_Repo_URL) open_new_tab(f"https://github.com/{Nugget_Repo}")
super().accept() super().accept()

View File

@@ -44,7 +44,7 @@ class MainWindow(QtWidgets.QMainWindow):
# Check for an update # Check for an update
if is_update_available(App_Version, App_Build): if is_update_available(App_Version, App_Build):
# notify with prompt to download the new version from github # notify with prompt to download the new version from github
UpdateAppDialog() UpdateAppDialog().exec()
# Update the app version/build number label # Update the app version/build number label
self.updateAppVersionLabel() self.updateAppVersionLabel()