mirror of
https://github.com/blw1138/Zordon.git
synced 2026-02-05 05:36:09 +00:00
Correctly refresh Engines list after downloading new engine
This commit is contained in:
@@ -6,7 +6,7 @@ import socket
|
||||
|
||||
from datetime import datetime
|
||||
from PyQt6 import QtCore
|
||||
from PyQt6.QtCore import Qt, QSettings, pyqtSignal as Signal, QThread, pyqtSignal
|
||||
from PyQt6.QtCore import Qt, QSettings, pyqtSignal as Signal, QThread, pyqtSignal, QTimer
|
||||
from PyQt6.QtGui import QIcon
|
||||
from PyQt6.QtWidgets import QApplication, QMainWindow, QListWidget, QListWidgetItem, QStackedWidget, QVBoxLayout, \
|
||||
QWidget, QLabel, QCheckBox, QLineEdit, \
|
||||
@@ -105,6 +105,10 @@ class SettingsWindow(QMainWindow):
|
||||
|
||||
self.setMinimumSize(700, 400)
|
||||
|
||||
# timers for background download UI updates
|
||||
self.timer = QTimer(self)
|
||||
self.timer.timeout.connect(self.update_engine_download_status)
|
||||
|
||||
def add_sidebar_item(self, name, icon_path):
|
||||
"""Add an item with an icon to the sidebar."""
|
||||
item = QListWidgetItem(QIcon(icon_path), name)
|
||||
@@ -388,7 +392,7 @@ class SettingsWindow(QMainWindow):
|
||||
if msg_result == QMessageBox.StandardButton.Yes:
|
||||
EngineManager.download_engine(engine=engine.name(), version=result['version'], background=True,
|
||||
ignore_system=ignore_system)
|
||||
self.update_engine_download_status()
|
||||
self.timer.start(1000)
|
||||
|
||||
if not messagebox_shown:
|
||||
msg_box = QMessageBox()
|
||||
@@ -404,6 +408,8 @@ class SettingsWindow(QMainWindow):
|
||||
def update_engine_download_status(self):
|
||||
running_tasks = [x for x in EngineManager.download_tasks if x.is_alive()]
|
||||
if not running_tasks:
|
||||
self.timer.stop()
|
||||
self.installed_engines_table.update_engines_table(use_cached=False)
|
||||
self.update_last_checked_label()
|
||||
return
|
||||
|
||||
|
||||
Reference in New Issue
Block a user