fix no item in downloads text

This commit is contained in:
Vxrtrauter
2026-01-20 11:26:49 +01:00
parent 83ff2720c8
commit d82008c9fe
+17 -2
View File
@@ -147,6 +147,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.downloadList = QTableView() self.downloadList = QTableView()
self.emptyLibrary = QLabel("No items in library.") self.emptyLibrary = QLabel("No items in library.")
self.emptyDownload = QLabel("No items in downloads.") self.emptyDownload = QLabel("No items in downloads.")
self.emptyDownload.setAlignment(Qt.AlignCenter)
self.consoleLog = QTextEdit() self.consoleLog = QTextEdit()
self.progressbar = QProgressBar() self.progressbar = QProgressBar()
@@ -183,7 +184,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
def rowCount(self, parent=QModelIndex()): def rowCount(self, parent=QModelIndex()):
return len(state.downloads) return len(state.downloads)
def columnCount(self, parent=QModelIndex()): def columnCount(self, parent=QModelIndex()):
return len(self.headers) return len(self.headers)
@@ -345,6 +346,10 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.download_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.download_list_update))) self.download_timer.timeout.connect(lambda: run_thread(threading.Thread(target=self.download_list_update)))
self.download_timer.start(500) self.download_timer.start(500)
self.active_timer = QTimer()
self.active_timer.timeout.connect(self.show_empty_downloads)
self.active_timer.start(500)
@staticmethod @staticmethod
def add_log(text): def add_log(text):
if MainWindow._instance: if MainWindow._instance:
@@ -367,6 +372,7 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
if self.download_model: if self.download_model:
self.download_model.layoutAboutToBeChanged.emit() self.download_model.layoutAboutToBeChanged.emit()
self.download_model.layoutChanged.emit() self.download_model.layoutChanged.emit()
def closeEvent(self, event: QCloseEvent): def closeEvent(self, event: QCloseEvent):
closehelper() closehelper()
@@ -384,8 +390,17 @@ class MainWindow(QtWidgets.QMainWindow, QWidget):
self.qtablewidget.hide() self.qtablewidget.hide()
self.emptyResults.show() self.emptyResults.show()
else: else:
self.emptyResults.hide()
self.qtablewidget.show() self.qtablewidget.show()
self.emptyResults.hide()
def show_empty_downloads(self):
if len(state.downloads) > 0:
self.emptyDownload.hide()
self.downloadList.show()
else:
self.emptyDownload.show()
self.downloadList.hide()
# thank you claude # thank you claude