mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
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:
parent
5dcccd1ced
commit
8694fb21ec
3 changed files with 11 additions and 7 deletions
|
@ -7,6 +7,10 @@ since 0.4.1, and this project adheres to [Semantic Versioning](https://semver.or
|
||||||
|
|
||||||
## Unreleased
|
## 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
|
## Dangerzone 0.6.1
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -198,7 +198,7 @@ class Dialog(QtWidgets.QDialog):
|
||||||
self.done(int(QtWidgets.QDialog.Rejected))
|
self.done(int(QtWidgets.QDialog.Rejected))
|
||||||
|
|
||||||
def launch(self) -> int:
|
def launch(self) -> int:
|
||||||
return self.exec_()
|
return self.exec()
|
||||||
|
|
||||||
|
|
||||||
class Alert(Dialog):
|
class Alert(Dialog):
|
||||||
|
|
|
@ -205,7 +205,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
ok_text="Ok",
|
ok_text="Ok",
|
||||||
has_cancel=False,
|
has_cancel=False,
|
||||||
)
|
)
|
||||||
update_widget.exec_()
|
update_widget.launch()
|
||||||
|
|
||||||
def show_update_error(self) -> None:
|
def show_update_error(self) -> None:
|
||||||
"""Inform the user about an error during update checks"""
|
"""Inform the user about an error during update checks"""
|
||||||
|
@ -226,7 +226,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
ok_text="Close",
|
ok_text="Close",
|
||||||
has_cancel=False,
|
has_cancel=False,
|
||||||
)
|
)
|
||||||
update_widget.exec_()
|
update_widget.launch()
|
||||||
|
|
||||||
def toggle_updates_triggered(self) -> None:
|
def toggle_updates_triggered(self) -> None:
|
||||||
"""Change the underlying update check settings based on the user's choice."""
|
"""Change the underlying update check settings based on the user's choice."""
|
||||||
|
@ -320,7 +320,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
else:
|
else:
|
||||||
self.dangerzone.app.exit(0)
|
self.dangerzone.app.exit(0)
|
||||||
else:
|
else:
|
||||||
accept_exit = alert_widget.exec_()
|
accept_exit = alert_widget.launch()
|
||||||
if not accept_exit:
|
if not accept_exit:
|
||||||
e.ignore()
|
e.ignore()
|
||||||
return
|
return
|
||||||
|
@ -485,7 +485,7 @@ class ContentWidget(QtWidgets.QWidget):
|
||||||
self.dangerzone,
|
self.dangerzone,
|
||||||
message="Dangerzone does not support adding documents after the conversion has started.",
|
message="Dangerzone does not support adding documents after the conversion has started.",
|
||||||
has_cancel=False,
|
has_cancel=False,
|
||||||
).exec_()
|
).launch()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Ensure all files in batch are in the same directory
|
# Ensure all files in batch are in the same directory
|
||||||
|
@ -495,7 +495,7 @@ class ContentWidget(QtWidgets.QWidget):
|
||||||
self.dangerzone,
|
self.dangerzone,
|
||||||
message="Dangerzone does not support adding documents from multiple locations.\n\n The newly added documents were ignored.",
|
message="Dangerzone does not support adding documents from multiple locations.\n\n The newly added documents were ignored.",
|
||||||
has_cancel=False,
|
has_cancel=False,
|
||||||
).exec_()
|
).launch()
|
||||||
return
|
return
|
||||||
|
|
||||||
# Clear previously selected documents
|
# Clear previously selected documents
|
||||||
|
@ -841,7 +841,7 @@ class SettingsWidget(QtWidgets.QWidget):
|
||||||
dialog.setFileMode(QtWidgets.QFileDialog.Directory)
|
dialog.setFileMode(QtWidgets.QFileDialog.Directory)
|
||||||
dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)
|
dialog.setOption(QtWidgets.QFileDialog.ShowDirsOnly, True)
|
||||||
|
|
||||||
if dialog.exec_() == QtWidgets.QFileDialog.Accepted:
|
if dialog.exec() == QtWidgets.QFileDialog.Accepted:
|
||||||
selected_dir = dialog.selectedFiles()[0]
|
selected_dir = dialog.selectedFiles()[0]
|
||||||
if selected_dir is not None:
|
if selected_dir is not None:
|
||||||
self.dangerzone.output_dir = str(selected_dir)
|
self.dangerzone.output_dir = str(selected_dir)
|
||||||
|
|
Loading…
Reference in a new issue