mirror of
https://github.com/onionshare/onionshare.git
synced 2025-08-05 21:04:11 -04:00
Move owernship of the TorConnetionDialog objection from __init__.py into the OnionShareGUI class, and make it so when the Tor connection gets canceled, OnionShare quits
This commit is contained in:
parent
d112b35414
commit
2ca92c52db
4 changed files with 57 additions and 38 deletions
|
@ -27,7 +27,6 @@ from onionshare.onionshare import OnionShare
|
|||
from onionshare.settings import Settings
|
||||
|
||||
from .onionshare_gui import OnionShareGui
|
||||
from .tor_connection_dialog import TorConnectionDialog
|
||||
|
||||
class Application(QtWidgets.QApplication):
|
||||
"""
|
||||
|
@ -87,35 +86,22 @@ def main():
|
|||
if not valid:
|
||||
sys.exit()
|
||||
|
||||
# Load settings
|
||||
settings = Settings()
|
||||
settings.load()
|
||||
|
||||
# Start the Onion
|
||||
onion = Onion()
|
||||
|
||||
def exit_early():
|
||||
# Wait for tor to exit
|
||||
onion.cleanup()
|
||||
sys.exit()
|
||||
|
||||
tor_con = TorConnectionDialog(settings, onion)
|
||||
tor_con.canceled.connect(exit_early)
|
||||
tor_con.start()
|
||||
|
||||
# Start the OnionShare app
|
||||
web.set_stay_open(stay_open)
|
||||
app = OnionShare(onion, debug, local_only, stay_open)
|
||||
|
||||
# Launch the gui
|
||||
gui = OnionShareGui(onion, qtapp, app, filenames)
|
||||
|
||||
# Clean up when app quits
|
||||
def shutdown():
|
||||
onion.cleanup()
|
||||
app.cleanup()
|
||||
qtapp.aboutToQuit.connect(shutdown)
|
||||
|
||||
# Launch the gui
|
||||
gui = OnionShareGui(qtapp, app, filenames)
|
||||
|
||||
# All done
|
||||
sys.exit(qtapp.exec_())
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue