From 0082f76b5612c0098caef59d28534dff831b4ea0 Mon Sep 17 00:00:00 2001 From: Keith Edmunds Date: Fri, 8 Dec 2023 20:54:37 +0000 Subject: [PATCH] Rescan after Audacity --- app/helpers.py | 12 ++++++++---- app/playlists.py | 7 ++++++- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/app/helpers.py b/app/helpers.py index 540a157..038343a 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -53,8 +53,10 @@ class AudacityManager: return sa_response = self._do_command("SelectAll:") - if sa_response == '\nBatchCommand finished: OK\n': - exp_response = self._do_command(f'Export2: Filename="{self.path}" NumChannels=2') + if sa_response == "\nBatchCommand finished: OK\n": + exp_response = self._do_command( + f'Export2: Filename="{self.path}" NumChannels=2' + ) return exp_response else: print("SelectAll response: " + sa_response) @@ -88,10 +90,12 @@ class AudacityManager: return response -def ask_yes_no(title: str, question: str, default_yes: bool = False) -> bool: +def ask_yes_no( + title: str, question: str, default_yes: bool = False, parent: QMainWindow = None +) -> bool: """Ask question; return True for yes, False for no""" - dlg = QMessageBox() + dlg = QMessageBox(parent) dlg.setWindowTitle(title) dlg.setText(question) dlg.setStandardButtons( diff --git a/app/playlists.py b/app/playlists.py index 18c62d7..9ac565b 100644 --- a/app/playlists.py +++ b/app/playlists.py @@ -571,8 +571,13 @@ class PlaylistTab(QTableView): audacity = AudacityManager() audacity.open_file(path) - if ask_yes_no("Export file", "Click yes to export file, no to ignore"): + if ask_yes_no( + "Export file", + "Click yes to export file, no to ignore", + parent=self.musicmuster, + ): audacity.export_file() + self._rescan(row_number) def _rescan(self, row_number: int) -> None: """Rescan track"""