summaryrefslogtreecommitdiff
path: root/onionshare_gui
diff options
context:
space:
mode:
authorMicah Lee <micah@micahflee.com>2020-06-28 12:29:38 -0700
committerMicah Lee <micah@micahflee.com>2020-06-28 12:29:38 -0700
commitc3948ed95072984e40f03535b7e7c92c00d8b258 (patch)
tree65f6b1853576fee20856344a01d41b0b178d9096 /onionshare_gui
parenta87faa10183603297976dc1d1d8522fa02427958 (diff)
parenta7856d5dcb42bc95b1a4d6c127fa798f0a61564f (diff)
downloadonionshare-c3948ed95072984e40f03535b7e7c92c00d8b258.tar.gz
onionshare-c3948ed95072984e40f03535b7e7c92c00d8b258.zip
Merge branch 'autostart_fixes' of https://github.com/mig5/onionshare into mig5-autostart_fixes
Diffstat (limited to 'onionshare_gui')
-rw-r--r--onionshare_gui/tab/mode/__init__.py11
-rw-r--r--onionshare_gui/tab/mode/mode_settings_widget.py10
-rw-r--r--onionshare_gui/tab/server_status.py11
-rw-r--r--onionshare_gui/tab/tab.py4
4 files changed, 15 insertions, 21 deletions
diff --git a/onionshare_gui/tab/mode/__init__.py b/onionshare_gui/tab/mode/__init__.py
index 7696f79e..fc79d0ad 100644
--- a/onionshare_gui/tab/mode/__init__.py
+++ b/onionshare_gui/tab/mode/__init__.py
@@ -138,7 +138,7 @@ class Mode(QtWidgets.QWidget):
"""
# If this is a scheduled share, display the countdown til the share starts
if self.server_status.status == ServerStatus.STATUS_WORKING:
- if self.server_status.autostart_timer_datetime:
+ if self.settings.get("general", "autostart_timer"):
now = QtCore.QDateTime.currentDateTime()
if self.server_status.local_only:
seconds_remaining = now.secsTo(
@@ -227,13 +227,8 @@ class Mode(QtWidgets.QWidget):
# Start the onion thread. If this share was scheduled for a future date,
# the OnionThread will start and exit 'early' to obtain the port, password
# and onion address, but it will not start the WebThread yet.
- if self.server_status.autostart_timer_datetime:
+ if self.settings.get("general", "autostart_timer"):
self.start_onion_thread(obtain_onion_early=True)
- else:
- self.start_onion_thread()
-
- # If scheduling a share, delay starting the real share
- if self.server_status.autostart_timer_datetime:
self.common.log("Mode", "start_server", "Starting auto-start timer")
self.startup_thread = AutoStartTimer(self)
# Once the timer has finished, start the real share, with a WebThread
@@ -241,6 +236,8 @@ class Mode(QtWidgets.QWidget):
self.startup_thread.error.connect(self.start_server_error)
self.startup_thread.canceled = False
self.startup_thread.start()
+ else:
+ self.start_onion_thread()
def start_onion_thread(self, obtain_onion_early=False):
self.common.log("Mode", "start_server", "Starting an onion thread")
diff --git a/onionshare_gui/tab/mode/mode_settings_widget.py b/onionshare_gui/tab/mode/mode_settings_widget.py
index 34335494..ed224589 100644
--- a/onionshare_gui/tab/mode/mode_settings_widget.py
+++ b/onionshare_gui/tab/mode/mode_settings_widget.py
@@ -76,7 +76,10 @@ class ModeSettingsWidget(QtWidgets.QWidget):
self.autostart_timer_widget.setCurrentSection(
QtWidgets.QDateTimeEdit.MinuteSection
)
- self.autostart_timer_widget.hide()
+ if self.settings.get("general", "autostart_timer"):
+ self.autostart_timer_widget.show()
+ else:
+ self.autostart_timer_widget.hide()
# Autostart timer layout
autostart_timer_layout = QtWidgets.QHBoxLayout()
@@ -104,7 +107,10 @@ class ModeSettingsWidget(QtWidgets.QWidget):
self.autostop_timer_widget.setCurrentSection(
QtWidgets.QDateTimeEdit.MinuteSection
)
- self.autostop_timer_widget.hide()
+ if self.settings.get("general", "autostop_timer"):
+ self.autostop_timer_widget.show()
+ else:
+ self.autostop_timer_widget.hide()
# Autostop timer layout
autostop_timer_layout = QtWidgets.QHBoxLayout()
diff --git a/onionshare_gui/tab/server_status.py b/onionshare_gui/tab/server_status.py
index e22e8547..cd9b8db9 100644
--- a/onionshare_gui/tab/server_status.py
+++ b/onionshare_gui/tab/server_status.py
@@ -273,7 +273,7 @@ class ServerStatus(QtWidgets.QWidget):
self.common.gui.css["server_status_button_working"]
)
self.server_button.setEnabled(True)
- if self.autostart_timer_datetime:
+ if self.settings.get("general", "autostart_timer"):
self.server_button.setToolTip(
strings._("gui_start_server_autostart_timer_tooltip").format(
self.mode_settings_widget.autostart_timer_widget.dateTime().toString(
@@ -283,15 +283,6 @@ class ServerStatus(QtWidgets.QWidget):
)
else:
self.server_button.setText(strings._("gui_please_wait"))
-
- if self.settings.get("general", "autostart_timer"):
- self.server_button.setToolTip(
- strings._("gui_start_server_autostart_timer_tooltip").format(
- self.mode_settings_widget.autostart_timer_widget.dateTime().toString(
- "h:mm AP, MMMM dd, yyyy"
- )
- )
- )
else:
self.server_button.setStyleSheet(
self.common.gui.css["server_status_button_working"]
diff --git a/onionshare_gui/tab/tab.py b/onionshare_gui/tab/tab.py
index aa4518b5..5117618f 100644
--- a/onionshare_gui/tab/tab.py
+++ b/onionshare_gui/tab/tab.py
@@ -287,7 +287,7 @@ class Tab(QtWidgets.QWidget):
strings._("gui_status_indicator_share_stopped")
)
elif self.share_mode.server_status.status == ServerStatus.STATUS_WORKING:
- if self.share_mode.server_status.autostart_timer_datetime:
+ if self.settings.get("general", "autostart_timer"):
self.set_server_status_indicator_working(
strings._("gui_status_indicator_share_scheduled")
)
@@ -320,7 +320,7 @@ class Tab(QtWidgets.QWidget):
strings._("gui_status_indicator_receive_stopped")
)
elif self.receive_mode.server_status.status == ServerStatus.STATUS_WORKING:
- if self.receive_mode.server_status.autostart_timer_datetime:
+ if self.settings.get("general", "autostart_timer"):
self.set_server_status_indicator_working(
strings._("gui_status_indicator_receive_scheduled")
)