mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-04-28 18:02:38 +02:00
Bind Alert
instances to the main window alert
property
This commit is contained in:
parent
3d5cacfffb
commit
970a82f432
1 changed files with 6 additions and 6 deletions
|
@ -413,7 +413,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
self.content_widget.show()
|
self.content_widget.show()
|
||||||
|
|
||||||
def closeEvent(self, e: QtGui.QCloseEvent) -> None:
|
def closeEvent(self, e: QtGui.QCloseEvent) -> None:
|
||||||
alert_widget = Alert(
|
self.alert = Alert(
|
||||||
self.dangerzone,
|
self.dangerzone,
|
||||||
message="Some documents are still being converted.\n Are you sure you want to quit?",
|
message="Some documents are still being converted.\n Are you sure you want to quit?",
|
||||||
ok_text="Abort conversions",
|
ok_text="Abort conversions",
|
||||||
|
@ -427,7 +427,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
else:
|
else:
|
||||||
self.dangerzone.app.exit(0)
|
self.dangerzone.app.exit(0)
|
||||||
else:
|
else:
|
||||||
accept_exit = alert_widget.launch()
|
accept_exit = self.alert.launch()
|
||||||
if not accept_exit:
|
if not accept_exit:
|
||||||
e.ignore()
|
e.ignore()
|
||||||
return
|
return
|
||||||
|
@ -671,7 +671,7 @@ class ContentWidget(QtWidgets.QWidget):
|
||||||
|
|
||||||
def documents_selected(self, docs: List[Document]) -> None:
|
def documents_selected(self, docs: List[Document]) -> None:
|
||||||
if self.conversion_started:
|
if self.conversion_started:
|
||||||
Alert(
|
self.alert = Alert(
|
||||||
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,
|
||||||
|
@ -681,7 +681,7 @@ class ContentWidget(QtWidgets.QWidget):
|
||||||
# Ensure all files in batch are in the same directory
|
# Ensure all files in batch are in the same directory
|
||||||
dirnames = {os.path.dirname(doc.input_filename) for doc in docs}
|
dirnames = {os.path.dirname(doc.input_filename) for doc in docs}
|
||||||
if len(dirnames) > 1:
|
if len(dirnames) > 1:
|
||||||
Alert(
|
self.alert = Alert(
|
||||||
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,
|
||||||
|
@ -850,14 +850,14 @@ class DocSelectionDropFrame(QtWidgets.QFrame):
|
||||||
text = f"{num_unsupported_docs} files are not supported."
|
text = f"{num_unsupported_docs} files are not supported."
|
||||||
ok_text = "Continue without these files"
|
ok_text = "Continue without these files"
|
||||||
|
|
||||||
alert_widget = Alert(
|
self.alert = Alert(
|
||||||
self.dangerzone,
|
self.dangerzone,
|
||||||
message=f"{text}\nThe supported extensions are: "
|
message=f"{text}\nThe supported extensions are: "
|
||||||
+ ", ".join(get_supported_extensions()),
|
+ ", ".join(get_supported_extensions()),
|
||||||
ok_text=ok_text,
|
ok_text=ok_text,
|
||||||
)
|
)
|
||||||
|
|
||||||
return alert_widget.exec_()
|
return self.alert.exec_()
|
||||||
|
|
||||||
|
|
||||||
class SettingsWidget(QtWidgets.QWidget):
|
class SettingsWidget(QtWidgets.QWidget):
|
||||||
|
|
Loading…
Reference in a new issue