mirror of
https://github.com/onionshare/onionshare.git
synced 2025-04-29 03:36:26 -04:00
ported alert to Qt
This commit is contained in:
parent
ff7791939b
commit
03d2053eff
@ -1,23 +1,17 @@
|
|||||||
import onionshare, webapp
|
import onionshare, webapp
|
||||||
import threading, os, sys, subprocess
|
import threading, os, sys, subprocess
|
||||||
|
|
||||||
import gtk
|
|
||||||
|
|
||||||
from PyQt4.QtCore import *
|
from PyQt4.QtCore import *
|
||||||
from PyQt4.QtGui import *
|
from PyQt4.QtGui import *
|
||||||
from PyQt4.QtWebKit import *
|
from PyQt4.QtWebKit import *
|
||||||
|
|
||||||
qtapp = QApplication(sys.argv)
|
qtapp = QApplication(sys.argv)
|
||||||
|
|
||||||
def alert(msg, type=gtk.MESSAGE_INFO):
|
def alert(msg, icon=QMessageBox.NoIcon):
|
||||||
dialog = gtk.MessageDialog(
|
dialog = QMessageBox()
|
||||||
parent=None,
|
dialog.setText(msg)
|
||||||
flags=gtk.DIALOG_MODAL,
|
dialog.setIcon(icon)
|
||||||
type=type,
|
dialog.exec_()
|
||||||
buttons=gtk.BUTTONS_OK,
|
|
||||||
message_format=msg)
|
|
||||||
response = dialog.run()
|
|
||||||
dialog.destroy()
|
|
||||||
|
|
||||||
def select_file(strings):
|
def select_file(strings):
|
||||||
# get filename, either from argument or file chooser dialog
|
# get filename, either from argument or file chooser dialog
|
||||||
@ -36,7 +30,7 @@ def select_file(strings):
|
|||||||
|
|
||||||
# validate filename
|
# validate filename
|
||||||
if not os.path.isfile(filename):
|
if not os.path.isfile(filename):
|
||||||
alert(strings["not_a_file"].format(filename), gtk.MESSAGE_ERROR)
|
alert(strings["not_a_file"].format(filename), QMessageBox.Warning)
|
||||||
return False, False
|
return False, False
|
||||||
|
|
||||||
filename = os.path.abspath(filename)
|
filename = os.path.abspath(filename)
|
||||||
@ -84,7 +78,7 @@ def main():
|
|||||||
try:
|
try:
|
||||||
onion_host = onionshare.start_hidden_service(onionshare_port)
|
onion_host = onionshare.start_hidden_service(onionshare_port)
|
||||||
except onionshare.NoTor as e:
|
except onionshare.NoTor as e:
|
||||||
alert(e.args[0], gtk.MESSAGE_ERROR)
|
alert(e.args[0], QMessageBox.Warning)
|
||||||
return
|
return
|
||||||
onionshare.tails_open_port(onionshare_port)
|
onionshare.tails_open_port(onionshare_port)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user