From 9ae6df1b0767112e3a9bbbaf76e6d9a13b996d82 Mon Sep 17 00:00:00 2001 From: Micah Lee Date: Thu, 29 Dec 2016 14:23:19 -0800 Subject: [PATCH] Remove the alert function, replace it with the Alert class --- onionshare_gui/onionshare_gui.py | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py index 16b5615c..439b221a 100644 --- a/onionshare_gui/onionshare_gui.py +++ b/onionshare_gui/onionshare_gui.py @@ -30,7 +30,7 @@ from .file_selection import FileSelection from .server_status import ServerStatus from .downloads import Downloads from .options import Options - +from .alert import Alert class Application(QtWidgets.QApplication): """ @@ -238,7 +238,7 @@ class OnionShareGui(QtWidgets.QMainWindow): """ If there's an error when trying to start the onion service """ - alert(error, QtWidgets.QMessageBox.Warning) + Alert(error, QtWidgets.QMessageBox.Warning) self.server_status.stop_server() self.status_bar.clearMessage() @@ -298,7 +298,7 @@ class OnionShareGui(QtWidgets.QMainWindow): elif event["type"] == web.REQUEST_RATE_LIMIT: self.stop_server() - alert(strings._('error_rate_limit'), QtWidgets.QMessageBox.Critical) + Alert(strings._('error_rate_limit'), QtWidgets.QMessageBox.Critical) elif event["type"] == web.REQUEST_PROGRESS: self.downloads.update_download(event["data"]["id"], event["data"]["bytes"]) @@ -396,18 +396,6 @@ class ZipProgressBar(QtWidgets.QProgressBar): self.setValue(0) -def alert(msg, icon=QtWidgets.QMessageBox.NoIcon): - """ - Pop up a message in a dialog window. - """ - dialog = QtWidgets.QMessageBox() - dialog.setWindowTitle("OnionShare") - dialog.setWindowIcon(window_icon) - dialog.setText(msg) - dialog.setIcon(icon) - dialog.exec_() - - def main(): """ The main() function implements all of the logic that the GUI version of onionshare uses. @@ -447,7 +435,7 @@ def main(): valid = True for filename in filenames: if not os.path.exists(filename): - alert(strings._("not_a_file", True).format(filename)) + Alert(strings._("not_a_file", True).format(filename)) valid = False if not valid: sys.exit()