From 97a24d8d52c8a241943770134503c55d013a932e Mon Sep 17 00:00:00 2001 From: Timmy Welch Date: Sun, 8 Oct 2023 11:59:57 -0700 Subject: [PATCH] Change dialog modality and only center dialog when it is created --- comictaggerlib/fileselectionlist.py | 3 +-- comictaggerlib/renamewindow.py | 1 - comictaggerlib/taggerwindow.py | 11 ++++------- 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/comictaggerlib/fileselectionlist.py b/comictaggerlib/fileselectionlist.py index 7c7ecb5..2d8a0b2 100644 --- a/comictaggerlib/fileselectionlist.py +++ b/comictaggerlib/fileselectionlist.py @@ -186,7 +186,7 @@ class FileSelectionList(QtWidgets.QWidget): # Prog dialog on Linux flakes out for small range, so scale up progdialog = QtWidgets.QProgressDialog("", "Cancel", 0, len(filelist), parent=self) progdialog.setWindowTitle("Adding Files") - progdialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) + progdialog.setWindowModality(QtCore.Qt.WindowModality.WindowModal) progdialog.setMinimumDuration(300) center_window_on_parent(progdialog) @@ -200,7 +200,6 @@ class FileSelectionList(QtWidgets.QWidget): break progdialog.setValue(idx + 1) progdialog.setLabelText(f) - center_window_on_parent(progdialog) QtCore.QCoreApplication.processEvents() row = self.add_path_item(f) if row is not None: diff --git a/comictaggerlib/renamewindow.py b/comictaggerlib/renamewindow.py index 608c9f9..aa4b408 100644 --- a/comictaggerlib/renamewindow.py +++ b/comictaggerlib/renamewindow.py @@ -185,7 +185,6 @@ class RenameWindow(QtWidgets.QDialog): prog_dialog.setValue(idx) prog_dialog.setLabelText(comic[1]) - center_window_on_parent(prog_dialog) QtCore.QCoreApplication.processEvents() folder = get_rename_dir( diff --git a/comictaggerlib/taggerwindow.py b/comictaggerlib/taggerwindow.py index 61a17d2..c44787c 100644 --- a/comictaggerlib/taggerwindow.py +++ b/comictaggerlib/taggerwindow.py @@ -507,7 +507,7 @@ class TaggerWindow(QtWidgets.QMainWindow): prog_dialog = QtWidgets.QProgressDialog("", "Cancel", 0, non_zip_count, self) prog_dialog.setWindowTitle("Exporting as ZIP") - prog_dialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) + prog_dialog.setWindowModality(QtCore.Qt.WindowModality.WindowModal) prog_dialog.setMinimumDuration(300) center_window_on_parent(prog_dialog) QtCore.QCoreApplication.processEvents() @@ -524,7 +524,6 @@ class TaggerWindow(QtWidgets.QMainWindow): break prog_dialog.setValue(prog_idx) prog_dialog.setLabelText(str(ca.path)) - center_window_on_parent(prog_dialog) QtCore.QCoreApplication.processEvents() export_name = ca.path.with_suffix(".cbz") @@ -1550,7 +1549,7 @@ class TaggerWindow(QtWidgets.QMainWindow): if reply == QtWidgets.QMessageBox.StandardButton.Yes: progdialog = QtWidgets.QProgressDialog("", "Cancel", 0, has_md_count, self) progdialog.setWindowTitle("Removing Tags") - progdialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) + progdialog.setWindowModality(QtCore.Qt.WindowModality.WindowModal) progdialog.setMinimumDuration(300) center_window_on_parent(progdialog) QtCore.QCoreApplication.processEvents() @@ -1563,7 +1562,6 @@ class TaggerWindow(QtWidgets.QMainWindow): break progdialog.setValue(prog_idx) progdialog.setLabelText(str(ca.path)) - center_window_on_parent(progdialog) QtCore.QCoreApplication.processEvents() if ca.has_metadata(style): if ca.is_writable(): @@ -1629,7 +1627,7 @@ class TaggerWindow(QtWidgets.QMainWindow): if reply == QtWidgets.QMessageBox.StandardButton.Yes: prog_dialog = QtWidgets.QProgressDialog("", "Cancel", 0, has_src_count, self) prog_dialog.setWindowTitle("Copying Tags") - prog_dialog.setWindowModality(QtCore.Qt.WindowModality.ApplicationModal) + prog_dialog.setWindowModality(QtCore.Qt.WindowModality.WindowModal) prog_dialog.setMinimumDuration(300) center_window_on_parent(prog_dialog) QtCore.QCoreApplication.processEvents() @@ -1643,7 +1641,6 @@ class TaggerWindow(QtWidgets.QMainWindow): prog_dialog.setValue(prog_idx) prog_dialog.setLabelText(str(ca.path)) - center_window_on_parent(prog_dialog) QtCore.QCoreApplication.processEvents() if ca.has_metadata(src_style) and ca.is_writable(): @@ -1855,6 +1852,7 @@ class TaggerWindow(QtWidgets.QMainWindow): self.atprogdialog.show() self.atprogdialog.progressBar.setMaximum(len(ca_list)) self.atprogdialog.setWindowTitle("Auto-Tagging") + center_window_on_parent(self.atprogdialog) self.auto_tag_log("==========================================================================\n") self.auto_tag_log(f"Auto-Tagging Started for {len(ca_list)} items\n") @@ -1880,7 +1878,6 @@ class TaggerWindow(QtWidgets.QMainWindow): self.atprogdialog.progressBar.setValue(prog_idx) self.atprogdialog.label.setText(str(ca.path)) - center_window_on_parent(self.atprogdialog) QtCore.QCoreApplication.processEvents() if ca.is_writable():