mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 21:56:10 +00:00
More WIP on Settings
This commit is contained in:
@@ -10,12 +10,13 @@ from PyQt6.QtCore import Qt, QSettings
|
||||
from PyQt6.QtGui import QIcon
|
||||
from PyQt6.QtWidgets import QApplication, QMainWindow, QListWidget, QListWidgetItem, QStackedWidget, QVBoxLayout, \
|
||||
QWidget, QLabel, QCheckBox, QLineEdit, \
|
||||
QComboBox, QPushButton, QHBoxLayout, QGroupBox, QTableWidget, QAbstractItemView, QTableWidgetItem, QHeaderView
|
||||
QComboBox, QPushButton, QHBoxLayout, QGroupBox, QTableWidget, QAbstractItemView, QTableWidgetItem, QHeaderView, \
|
||||
QMessageBox
|
||||
|
||||
from api.server_proxy import RenderServerProxy
|
||||
from engines.engine_manager import EngineManager
|
||||
from utilities.config import Config
|
||||
from utilities.misc_helper import launch_url
|
||||
from utilities.misc_helper import launch_url, system_safe_path
|
||||
from version import APP_AUTHOR, APP_NAME
|
||||
|
||||
settings = QSettings(APP_AUTHOR, APP_NAME)
|
||||
@@ -268,6 +269,35 @@ class SettingsWindow(QMainWindow):
|
||||
launch_url(engine_info['path'])
|
||||
|
||||
def check_for_new_engines(self):
|
||||
|
||||
if not EngineManager.engines_path: # fix issue where sometimes path was not set
|
||||
EngineManager.engines_path = system_safe_path(
|
||||
os.path.join(os.path.join(os.path.expanduser(Config.upload_folder),
|
||||
'engines')))
|
||||
|
||||
results = []
|
||||
for engine in EngineManager.downloadable_engines():
|
||||
if settings.value(f'engine_download-{engine.name()}', False):
|
||||
update_result = EngineManager.update_engine(engine)
|
||||
if update_result:
|
||||
results.append(update_result)
|
||||
|
||||
if results:
|
||||
for result in results:
|
||||
msg_box = QMessageBox()
|
||||
msg_box.setWindowTitle(f"{result['name']} {result['version']} Available")
|
||||
msg_box.setText(f"A new version of {result['name']} is available ({result['version']}). It will begin downloading now.")
|
||||
msg_box.setIcon(QMessageBox.Icon.Information)
|
||||
msg_box.setStandardButtons(QMessageBox.StandardButton.Ok)
|
||||
msg_box.exec()
|
||||
else:
|
||||
msg_box = QMessageBox()
|
||||
msg_box.setWindowTitle("No Updates Available")
|
||||
msg_box.setText("All your render engines are up-to-date.")
|
||||
msg_box.setIcon(QMessageBox.Icon.Information)
|
||||
msg_box.setStandardButtons(QMessageBox.StandardButton.Ok)
|
||||
msg_box.exec()
|
||||
|
||||
settings.setValue("engines_last_update_time", datetime.now().isoformat())
|
||||
self.update_last_checked_label()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user