mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
fix update dialog
- fix initializer - fix exec call - fix opening link
This commit is contained in:
@@ -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
|
||||||
|
|||||||
@@ -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()
|
||||||
@@ -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()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user