From 2f48e8aad99cf0dea8ff12e05925bc12d94449b5 Mon Sep 17 00:00:00 2001 From: Guthrie McAfee Armstrong Date: Mon, 6 Jun 2022 21:30:17 -0400 Subject: [PATCH] Remove unused dangerzone.gui.common.Alert --- dangerzone/gui/common.py | 71 ---------------------------------------- 1 file changed, 71 deletions(-) diff --git a/dangerzone/gui/common.py b/dangerzone/gui/common.py index 6993ffe..7782836 100644 --- a/dangerzone/gui/common.py +++ b/dangerzone/gui/common.py @@ -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_()