mirror of
https://github.com/onionshare/onionshare.git
synced 2025-06-20 04:24:21 -04:00
start QApplication before doing other Qt stuff
This commit is contained in:
parent
6aedd7e534
commit
38f073b6c7
1 changed files with 9 additions and 8 deletions
|
@ -64,6 +64,9 @@ def select_file(strings):
|
||||||
def main():
|
def main():
|
||||||
onionshare.strings = onionshare.load_strings()
|
onionshare.strings = onionshare.load_strings()
|
||||||
|
|
||||||
|
# start the Qt app
|
||||||
|
app = Application()
|
||||||
|
|
||||||
# check for root in Tails
|
# check for root in Tails
|
||||||
if onionshare.get_platform() == 'Tails' and not onionshare.is_root():
|
if onionshare.get_platform() == 'Tails' and not onionshare.is_root():
|
||||||
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
subprocess.call(['/usr/bin/gksudo']+sys.argv)
|
||||||
|
@ -83,14 +86,6 @@ def main():
|
||||||
if not filename:
|
if not filename:
|
||||||
return
|
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
|
# initialize the web app
|
||||||
webapp.onionshare = onionshare
|
webapp.onionshare = onionshare
|
||||||
webapp.onionshare_port = onionshare_port
|
webapp.onionshare_port = onionshare_port
|
||||||
|
@ -105,6 +100,12 @@ def main():
|
||||||
webapp_thread = WebAppThread(webapp_port)
|
webapp_thread = WebAppThread(webapp_port)
|
||||||
webapp_thread.start()
|
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
|
# launch the window
|
||||||
web = Window(basename, webapp_port)
|
web = Window(basename, webapp_port)
|
||||||
web.show()
|
web.show()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue