1
0
Fork 0
mirror of synced 2024-06-28 19:21:05 +12:00

RareCore: Return a list instead of an iterator to freely use remove()

This commit is contained in:
loathingKernel 2023-02-16 16:42:32 +02:00
parent d8c31a05c2
commit b405ff615e
2 changed files with 7 additions and 5 deletions

View file

@ -241,7 +241,8 @@ class MainWindow(QMainWindow):
self,
self.tr("Quit {}?").format(QApplication.applicationName()),
self.tr(
"There are active operations. The application cannot exit until they are completed.\n"
"There are currently running operations. "
"Rare cannot exit until they are completed.\n\n"
"Do you want to clear the queue?"
),
buttons=(QMessageBox.Yes | QMessageBox.No),
@ -251,7 +252,7 @@ class MainWindow(QMainWindow):
self.rcore.queue_threadpool.clear()
for qw in self.rcore.queued_workers():
self.rcore.queue_workers.remove(qw)
self.update_statusbar()
self.update_statusbar()
e.ignore()
return
elif self.tab_widget.downloads_tab.is_download_active:
@ -259,7 +260,8 @@ class MainWindow(QMainWindow):
self,
self.tr("Quit {}?").format(QApplication.applicationName()),
self.tr(
"There is an active download. Quitting will stop the download.\n"
"There is an active download. "
"Quitting Rare now will stop the download.\n\n"
"Are you sure you want to quit?"
),
buttons=(QMessageBox.Yes | QMessageBox.No),

View file

@ -63,10 +63,10 @@ class RareCore(QObject):
self.__signals.application.update_statusbar.emit()
def active_workers(self) -> Iterator[QueueWorker]:
return filter(lambda w: w.state == QueueWorkerState.ACTIVE, self.queue_workers)
return list(filter(lambda w: w.state == QueueWorkerState.ACTIVE, self.queue_workers))
def queued_workers(self) -> Iterator[QueueWorker]:
return filter(lambda w: w.state == QueueWorkerState.QUEUED, self.queue_workers)
return list(filter(lambda w: w.state == QueueWorkerState.QUEUED, self.queue_workers))
def queue_info(self) -> List[QueueWorkerInfo]:
return [w.worker_info() for w in self.queue_workers]