mirror of
https://github.com/onionshare/onionshare.git
synced 2025-01-11 15:29:38 -05:00
start QApplication before doing other Qt stuff
This commit is contained in:
parent
6aedd7e534
commit
38f073b6c7
@ -64,6 +64,9 @@ def select_file(strings):
|
||||
def main():
|
||||
onionshare.strings = onionshare.load_strings()
|
||||
|
||||
# start the Qt app
|
||||
app = Application()
|
||||
|
||||
# check for root in Tails
|
||||
if onionshare.get_platform() == 'Tails' and not onionshare.is_root():
|
||||
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
||||
@ -83,14 +86,6 @@ def main():
|
||||
if not filename:
|
||||
return
|
||||
|
||||
# start the Qt app
|
||||
def shutdown():
|
||||
onionshare.tails_close_port(onionshare_port)
|
||||
onionshare.tails_close_port(webapp_port)
|
||||
|
||||
app = Application()
|
||||
app.connect(app, SIGNAL("aboutToQuit()"), shutdown)
|
||||
|
||||
# initialize the web app
|
||||
webapp.onionshare = onionshare
|
||||
webapp.onionshare_port = onionshare_port
|
||||
@ -105,6 +100,12 @@ def main():
|
||||
webapp_thread = WebAppThread(webapp_port)
|
||||
webapp_thread.start()
|
||||
|
||||
# clean up when app quits
|
||||
def shutdown():
|
||||
onionshare.tails_close_port(onionshare_port)
|
||||
onionshare.tails_close_port(webapp_port)
|
||||
app.connect(app, SIGNAL("aboutToQuit()"), shutdown)
|
||||
|
||||
# launch the window
|
||||
web = Window(basename, webapp_port)
|
||||
web.show()
|
||||
|
Loading…
Reference in New Issue
Block a user