Skip to content

Commit

Permalink
Use exec instead of exec_ for Qt dialogs
Browse files Browse the repository at this point in the history
`exec_` is being deprecated in favor of `exec`.

Also use `launch()` helper method for `Dialog` subclasses.

Fixes #595
  • Loading branch information
naglis committed May 1, 2024
1 parent 8cdb2d5 commit 828c04d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion dangerzone/gui/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def clicked_cancel(self) -> None:
self.done(int(QtWidgets.QDialog.Rejected))

def launch(self) -> int:
return self.exec_()
return self.exec()


class Alert(Dialog):
Expand Down
12 changes: 6 additions & 6 deletions dangerzone/gui/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def show_update_success(self) -> None:
ok_text="Ok",
has_cancel=False,
)
update_widget.exec_()
update_widget.launch()

def show_update_error(self) -> None:
"""Inform the user about an error during update checks"""
Expand All @@ -226,7 +226,7 @@ def show_update_error(self) -> None:
ok_text="Close",
has_cancel=False,
)
update_widget.exec_()
update_widget.launch()

def toggle_updates_triggered(self) -> None:
"""Change the underlying update check settings based on the user's choice."""
Expand Down Expand Up @@ -320,7 +320,7 @@ def closeEvent(self, e: QtGui.QCloseEvent) -> None:
else:
self.dangerzone.app.exit(0)
else:
accept_exit = alert_widget.exec_()
accept_exit = alert_widget.launch()
if not accept_exit:
e.ignore()
return
Expand Down Expand Up @@ -485,7 +485,7 @@ def documents_selected(self, docs: List[Document]) -> None:
self.dangerzone,
message="Dangerzone does not support adding documents after the conversion has started.",
has_cancel=False,
).exec_()
).launch()
return

# Ensure all files in batch are in the same directory
Expand All @@ -495,7 +495,7 @@ def documents_selected(self, docs: List[Document]) -> None:
self.dangerzone,
message="Dangerzone does not support adding documents from multiple locations.\n\n The newly added documents were ignored.",
has_cancel=False,
).exec_()
).launch()
return

# Clear previously selected documents
Expand Down Expand Up @@ -841,7 +841,7 @@ def select_output_directory(self) -> None:
dialog.setFileMode(QtWidgets.QFileDialog.Directory)
dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)

if dialog.exec_() == QtWidgets.QFileDialog.Accepted:
if dialog.exec() == QtWidgets.QFileDialog.Accepted:
selected_dir = dialog.selectedFiles()[0]
if selected_dir is not None:
self.dangerzone.output_dir = str(selected_dir)
Expand Down

0 comments on commit 828c04d

Please sign in to comment.