1
0
Fork 0
mirror of synced 2024-06-02 10:44:40 +12:00

MainWindow: Add worker queue to the statusbar

This commit is contained in:
loathingKernel 2023-02-03 10:56:24 +02:00
parent 6b3a841378
commit b2b3598a0b

View file

@ -10,7 +10,7 @@ from PyQt5.QtWidgets import (
QScrollArea,
QScroller,
QComboBox,
QMessageBox,
QMessageBox, QLabel,
)
from rare.components.tabs import TabWidget
@ -31,6 +31,7 @@ class MainWindow(QMainWindow):
self._window_launched = False
super(MainWindow, self).__init__(parent=parent)
self.setAttribute(Qt.WA_DeleteOnClose, True)
self.rcore = RareCore.instance()
self.core = RareCore.instance().core()
self.signals = RareCore.instance().signals()
self.args = RareCore.instance().args()
@ -44,6 +45,14 @@ class MainWindow(QMainWindow):
self.status_bar = QStatusBar()
self.setStatusBar(self.status_bar)
self.signals.application.update_statusbar.connect(self.update_statusbar)
self.signals.application.update_statusbar.connect(self.update_statusbar)
# self.status_timer = QTimer(self)
# self.status_timer.timeout.connect(self.update_statusbar)
# self.status_timer.setInterval(5000)
# self.status_timer.start()
width, height = 1280, 720
if self.settings.value("save_size", False, bool):
width, height = self.settings.value("window_size", (width, height), tuple)
@ -113,6 +122,23 @@ class MainWindow(QMainWindow):
else:
self.hide()
@pyqtSlot()
def update_statusbar(self):
for label in self.status_bar.findChildren(QLabel, options=Qt.FindDirectChildrenOnly):
self.status_bar.layout().removeWidget(label)
label.deleteLater()
for info in self.rcore.queue_info():
label = QLabel(f"{info.worker_type}: {info.app_title}")
label.setStyleSheet(
"""
QLabel {
border-width: 1px;
background-color: gray;
}
"""
)
self.status_bar.addWidget(label)
def timer_finished(self):
file_path = lock_file()
if os.path.exists(file_path):