mirror of
https://github.com/freedomofpress/dangerzone.git
synced 2025-05-04 12:41:50 +02:00
Remove unused dangerzone.gui.common.Alert
This commit is contained in:
parent
7eb10231a4
commit
2f48e8aad9
1 changed files with 0 additions and 71 deletions
|
@ -96,74 +96,3 @@ class GuiCommon(object):
|
|||
pass
|
||||
|
||||
return pdf_viewers
|
||||
|
||||
|
||||
class Alert(QtWidgets.QDialog):
|
||||
def __init__(
|
||||
self,
|
||||
message: str,
|
||||
ok_text="Ok",
|
||||
extra_button_text=None,
|
||||
):
|
||||
super(Alert, self).__init__()
|
||||
self.setWindowTitle("dangerzone")
|
||||
self.setWindowIcon(QIcon(dzutil.WINDOW_ICON_PATH))
|
||||
self.setModal(True)
|
||||
|
||||
flags = ( # TODO Mypy: unsupported left operand type for | ("WindowType")
|
||||
QtCore.Qt.CustomizeWindowHint # type: ignore
|
||||
| QtCore.Qt.WindowTitleHint
|
||||
| QtCore.Qt.WindowSystemMenuHint
|
||||
| QtCore.Qt.WindowCloseButtonHint
|
||||
| QtCore.Qt.WindowStaysOnTopHint
|
||||
)
|
||||
self.setWindowFlags(flags)
|
||||
|
||||
logo = QtWidgets.QLabel()
|
||||
logo.setPixmap(
|
||||
QtGui.QPixmap.fromImage(
|
||||
QtGui.QImage(dzutil.get_resource_path("icon.png"))
|
||||
)
|
||||
)
|
||||
|
||||
label = QtWidgets.QLabel()
|
||||
label.setText(message)
|
||||
label.setWordWrap(True)
|
||||
|
||||
message_layout = QtWidgets.QHBoxLayout()
|
||||
message_layout.addWidget(logo)
|
||||
message_layout.addSpacing(10)
|
||||
message_layout.addWidget(label, stretch=1)
|
||||
|
||||
ok_button = QtWidgets.QPushButton(ok_text)
|
||||
ok_button.clicked.connect(self.clicked_ok)
|
||||
if extra_button_text:
|
||||
extra_button = QtWidgets.QPushButton(extra_button_text)
|
||||
extra_button.clicked.connect(self.clicked_extra)
|
||||
cancel_button = QtWidgets.QPushButton("Cancel")
|
||||
cancel_button.clicked.connect(self.clicked_cancel)
|
||||
|
||||
buttons_layout = QtWidgets.QHBoxLayout()
|
||||
buttons_layout.addStretch()
|
||||
buttons_layout.addWidget(ok_button)
|
||||
if extra_button_text:
|
||||
buttons_layout.addWidget(extra_button)
|
||||
buttons_layout.addWidget(cancel_button)
|
||||
|
||||
layout = QtWidgets.QVBoxLayout()
|
||||
layout.addLayout(message_layout)
|
||||
layout.addSpacing(10)
|
||||
layout.addLayout(buttons_layout)
|
||||
self.setLayout(layout)
|
||||
|
||||
def clicked_ok(self):
|
||||
self.done(QtWidgets.QDialog.Accepted)
|
||||
|
||||
def clicked_extra(self):
|
||||
self.done(2)
|
||||
|
||||
def clicked_cancel(self):
|
||||
self.done(QtWidgets.QDialog.Rejected)
|
||||
|
||||
def launch(self):
|
||||
return self.exec_()
|
||||
|
|
Loading…
Reference in a new issue