mirror of
https://github.com/onionshare/onionshare.git
synced 2024-10-01 01:35:40 -04:00
Merge branch 'mig5-local_only_gui' into develop
This commit is contained in:
commit
bb39ef9a34
@ -108,7 +108,7 @@ def main():
|
||||
app = OnionShare(onion, local_only, stay_open, shutdown_timeout)
|
||||
|
||||
# Launch the gui
|
||||
gui = OnionShareGui(onion, qtapp, app, filenames, config)
|
||||
gui = OnionShareGui(onion, qtapp, app, filenames, config, local_only)
|
||||
|
||||
# Clean up when app quits
|
||||
def shutdown():
|
||||
|
@ -43,7 +43,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
starting_server_step3 = QtCore.pyqtSignal()
|
||||
starting_server_error = QtCore.pyqtSignal(str)
|
||||
|
||||
def __init__(self, onion, qtapp, app, filenames, config=False):
|
||||
def __init__(self, onion, qtapp, app, filenames, config=False, local_only=False):
|
||||
super(OnionShareGui, self).__init__()
|
||||
|
||||
self._initSystemTray()
|
||||
@ -53,6 +53,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
self.onion = onion
|
||||
self.qtapp = qtapp
|
||||
self.app = app
|
||||
self.local_only = local_only
|
||||
|
||||
self.setWindowTitle('OnionShare')
|
||||
self.setWindowIcon(QtGui.QIcon(common.get_resource_path('images/logo.png')))
|
||||
@ -218,6 +219,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
tor_con = TorConnectionDialog(self.qtapp, self.settings, self.onion)
|
||||
tor_con.canceled.connect(self._tor_connection_canceled)
|
||||
tor_con.open_settings.connect(self._tor_connection_open_settings)
|
||||
if not self.local_only:
|
||||
tor_con.start()
|
||||
|
||||
# Start the timer
|
||||
@ -338,6 +340,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
# We might've stopped the main requests timer if a Tor connection failed.
|
||||
# If we've reloaded settings, we probably succeeded in obtaining a new
|
||||
# connection. If so, restart the timer.
|
||||
if not self.local_only:
|
||||
if self.onion.is_authenticated():
|
||||
if not self.timer.isActive():
|
||||
self.timer.start(500)
|
||||
@ -350,7 +353,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
if not self.settings.get('shutdown_timeout'):
|
||||
self.server_status.shutdown_timeout_container.hide()
|
||||
|
||||
d = SettingsDialog(self.onion, self.qtapp, self.config)
|
||||
d = SettingsDialog(self.onion, self.qtapp, self.config, self.local_only)
|
||||
d.settings_saved.connect(reload_settings)
|
||||
d.exec_()
|
||||
|
||||
@ -547,6 +550,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
||||
"""
|
||||
self.update()
|
||||
|
||||
if not self.local_only:
|
||||
# Have we lost connection to Tor somehow?
|
||||
if not self.onion.is_authenticated():
|
||||
self.timer.stop()
|
||||
|
@ -34,13 +34,14 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
"""
|
||||
settings_saved = QtCore.pyqtSignal()
|
||||
|
||||
def __init__(self, onion, qtapp, config=False):
|
||||
def __init__(self, onion, qtapp, config=False, local_only=False):
|
||||
super(SettingsDialog, self).__init__()
|
||||
common.log('SettingsDialog', '__init__')
|
||||
|
||||
self.onion = onion
|
||||
self.qtapp = qtapp
|
||||
self.config = config
|
||||
self.local_only = local_only
|
||||
|
||||
self.setModal(True)
|
||||
self.setWindowTitle(strings._('gui_settings_window_title', True))
|
||||
@ -677,6 +678,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
# If Tor isn't connected, or if Tor settings have changed, Reinitialize
|
||||
# the Onion object
|
||||
reboot_onion = False
|
||||
if not self.local_only:
|
||||
if self.onion.is_authenticated():
|
||||
common.log('SettingsDialog', 'save_clicked', 'Connected to Tor')
|
||||
def changed(s1, s2, keys):
|
||||
@ -722,6 +724,9 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
else:
|
||||
self.settings_saved.emit()
|
||||
self.close()
|
||||
else:
|
||||
self.settings_saved.emit()
|
||||
self.close()
|
||||
|
||||
def cancel_clicked(self):
|
||||
"""
|
||||
@ -862,6 +867,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
||||
common.log('SettingsDialog', 'closeEvent')
|
||||
|
||||
# On close, if Tor isn't connected, then quit OnionShare altogether
|
||||
if not self.local_only:
|
||||
if not self.onion.is_authenticated():
|
||||
common.log('SettingsDialog', 'closeEvent', 'Closing while not connected to Tor')
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user