diff options
| author | Robert Honz <exislow+github@gmail.com> | 2025-01-03 14:37:42 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2025-01-03 14:37:42 +0100 |
| commit | 75ade1b78dd5f2508539c2657773de529a4b0018 (patch) | |
| tree | bd49061297a95629f80b516a799c96b54fba8766 /tidal_dl_ng/gui.py | |
| parent | 6cf084215730bf06a918c911299e9b03b569868b (diff) | |
| download | tidal-dl-ng-75ade1b78dd5f2508539c2657773de529a4b0018.tar.gz | |
🛠️ Clean app shutdown.
Diffstat (limited to 'tidal_dl_ng/gui.py')
| -rw-r--r-- | tidal_dl_ng/gui.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/tidal_dl_ng/gui.py b/tidal_dl_ng/gui.py index fffb7d1..b9c5ddd 100644 --- a/tidal_dl_ng/gui.py +++ b/tidal_dl_ng/gui.py @@ -66,6 +66,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): tray: QtWidgets.QSystemTrayIcon spinner: QtWaitingSpinner cover_url_current: str = "" + shutdown: bool = False model_tr_results: QtGui.QStandardItemModel = QtGui.QStandardItemModel() proxy_tr_results: HumanProxyModel s_spinner_start: QtCore.Signal = QtCore.Signal(QtWidgets.QWidget) @@ -913,7 +914,7 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.tr_queue_download.addTopLevelItem(child) def watcher_queue_download(self) -> None: - while True: + while not self.shutdown: items: [QtWidgets.QTreeWidgetItem | None] = self.tr_queue_download.findItems( QueueDownloadStatus.Waiting, QtCore.Qt.MatchFlag.MatchExactly, column=0 ) @@ -1065,6 +1066,11 @@ class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): self.pb_reload_user_lists.setEnabled(status) self.pb_reload_user_lists.setText(button_text) + def closeEvent(self, event): + self.shutdown = True + + event.accept() + # TODO: Comment with Google Docstrings. def gui_activate(tidal: Tidal | None = None): |
