Use exec instead of exec_ for Qt dialogs

`exec_` is being deprecated in favor of `exec`.

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

Fixes #595
This commit is contained in:
Naglis Jonaitis 2024-04-20 13:28:26 +03:00 committed by Alex Pyrgiotis
parent 5dcccd1ced
commit 8694fb21ec
No known key found for this signature in database
GPG key ID: B6C15EBA0357C9AA
3 changed files with 11 additions and 7 deletions

View file

@ -7,6 +7,10 @@ since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.or
## Unreleased
### Fixed
- Fix a deprecation warning in PySide6, thanks to [@naglis](https://github.com/naglis) ([issue #595](https://github.com/freedomofpress/dangerzone/issues/595))
## Dangerzone 0.6.1
### Added

View file

@ -198,7 +198,7 @@ class Dialog(QtWidgets.QDialog):
self.done(int(QtWidgets.QDialog.Rejected))
def launch(self) -> int:
return self.exec_()
return self.exec()
class Alert(Dialog):

View file

@ -205,7 +205,7 @@ class MainWindow(QtWidgets.QMainWindow):
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"""
@ -226,7 +226,7 @@ class MainWindow(QtWidgets.QMainWindow):
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."""
@ -320,7 +320,7 @@ class MainWindow(QtWidgets.QMainWindow):
else:
self.dangerzone.app.exit(0)
else:
accept_exit = alert_widget.exec_()
accept_exit = alert_widget.launch()
if not accept_exit:
e.ignore()
return
@ -485,7 +485,7 @@ class ContentWidget(QtWidgets.QWidget):
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
@ -495,7 +495,7 @@ class ContentWidget(QtWidgets.QWidget):
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
@ -841,7 +841,7 @@ class SettingsWidget(QtWidgets.QWidget):
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)