mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-08 09:25:17 -04:00
Remove the alert function, replace it with the Alert class
This commit is contained in:
parent
13f1f78da7
commit
9ae6df1b07
1 changed files with 4 additions and 16 deletions
|
@ -30,7 +30,7 @@ from .file_selection import FileSelection
|
||||||
from .server_status import ServerStatus
|
from .server_status import ServerStatus
|
||||||
from .downloads import Downloads
|
from .downloads import Downloads
|
||||||
from .options import Options
|
from .options import Options
|
||||||
|
from .alert import Alert
|
||||||
|
|
||||||
class Application(QtWidgets.QApplication):
|
class Application(QtWidgets.QApplication):
|
||||||
"""
|
"""
|
||||||
|
@ -238,7 +238,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
"""
|
"""
|
||||||
If there's an error when trying to start the onion service
|
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.server_status.stop_server()
|
||||||
self.status_bar.clearMessage()
|
self.status_bar.clearMessage()
|
||||||
|
|
||||||
|
@ -298,7 +298,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||||
|
|
||||||
elif event["type"] == web.REQUEST_RATE_LIMIT:
|
elif event["type"] == web.REQUEST_RATE_LIMIT:
|
||||||
self.stop_server()
|
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:
|
elif event["type"] == web.REQUEST_PROGRESS:
|
||||||
self.downloads.update_download(event["data"]["id"], event["data"]["bytes"])
|
self.downloads.update_download(event["data"]["id"], event["data"]["bytes"])
|
||||||
|
@ -396,18 +396,6 @@ class ZipProgressBar(QtWidgets.QProgressBar):
|
||||||
self.setValue(0)
|
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():
|
def main():
|
||||||
"""
|
"""
|
||||||
The main() function implements all of the logic that the GUI version of onionshare uses.
|
The main() function implements all of the logic that the GUI version of onionshare uses.
|
||||||
|
@ -447,7 +435,7 @@ def main():
|
||||||
valid = True
|
valid = True
|
||||||
for filename in filenames:
|
for filename in filenames:
|
||||||
if not os.path.exists(filename):
|
if not os.path.exists(filename):
|
||||||
alert(strings._("not_a_file", True).format(filename))
|
Alert(strings._("not_a_file", True).format(filename))
|
||||||
valid = False
|
valid = False
|
||||||
if not valid:
|
if not valid:
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue