summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiguel Jacq <mig@mig5.net>2019-03-25 15:28:31 +1100
committerMiguel Jacq <mig@mig5.net>2019-03-25 15:28:31 +1100
commitee3a14a0253b409ad58c289cea788333cda93d37 (patch)
tree6e9b8bfea44846914b9bdc96aea15eb9be77dcdb
parentc411e8d61a952faca758673a5c59133986fd9623 (diff)
downloadonionshare-ee3a14a0253b409ad58c289cea788333cda93d37.tar.gz
onionshare-ee3a14a0253b409ad58c289cea788333cda93d37.zip
Standardise all startup_timer, scheduled_start attributes as 'autostart_timer'
-rw-r--r--onionshare/__init__.py2
-rw-r--r--onionshare/settings.py2
-rw-r--r--onionshare_gui/mode/__init__.py16
-rw-r--r--onionshare_gui/onionshare_gui.py16
-rw-r--r--onionshare_gui/server_status.py94
-rw-r--r--onionshare_gui/settings_dialog.py44
-rw-r--r--onionshare_gui/threads.py12
-rw-r--r--share/locale/en.json10
-rw-r--r--tests/GuiBaseTest.py16
-rw-r--r--tests/GuiShareTest.py10
-rw-r--r--tests/local_onionshare_share_mode_autostart_and_autostop_timer_mismatch_test.py4
-rw-r--r--tests/local_onionshare_share_mode_autostart_timer_test.py (renamed from tests/local_onionshare_share_mode_startup_timer_test.py)6
-rw-r--r--tests/local_onionshare_share_mode_autostart_timer_too_short_test.py6
-rw-r--r--tests/local_onionshare_share_mode_cancel_share_test.py2
-rw-r--r--tests/onionshare_share_mode_cancel_share_test.py2
-rw-r--r--tests/test_onionshare_settings.py2
16 files changed, 122 insertions, 122 deletions
diff --git a/onionshare/__init__.py b/onionshare/__init__.py
index 722b4018..03961f8d 100644
--- a/onionshare/__init__.py
+++ b/onionshare/__init__.py
@@ -138,7 +138,7 @@ def main(cwd=None):
if autostart_timer > 0:
# Can't set a schedule that is later than the auto-stop timer
if app.autostop_timer > 0 and app.autostop_timer < autostart_timer:
- print(strings._('gui_autostop_timer_cant_be_earlier_than_startup'))
+ print(strings._('gui_autostop_timer_cant_be_earlier_than_autostart_timer'))
sys.exit()
app.start_onion_service(False, True)
diff --git a/onionshare/settings.py b/onionshare/settings.py
index a5d4db6a..1eaa4e40 100644
--- a/onionshare/settings.py
+++ b/onionshare/settings.py
@@ -85,7 +85,7 @@ class Settings(object):
'auth_password': '',
'close_after_first_download': True,
'autostop_timer': False,
- 'startup_timer': False,
+ 'autostart_timer': False,
'use_stealth': False,
'use_autoupdate': True,
'autoupdate_timestamp': None,
diff --git a/onionshare_gui/mode/__init__.py b/onionshare_gui/mode/__init__.py
index 954bcc4d..8f5ff32b 100644
--- a/onionshare_gui/mode/__init__.py
+++ b/onionshare_gui/mode/__init__.py
@@ -24,7 +24,7 @@ from onionshare.common import AutoStopTimer
from ..server_status import ServerStatus
from ..threads import OnionThread
-from ..threads import StartupTimer
+from ..threads import AutoStartTimer
from ..widgets import Alert
class Mode(QtWidgets.QWidget):
@@ -115,12 +115,12 @@ 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.scheduled_start:
+ if self.server_status.autostart_timer_datetime:
now = QtCore.QDateTime.currentDateTime()
if self.server_status.local_only:
- seconds_remaining = now.secsTo(self.server_status.startup_timer.dateTime())
+ seconds_remaining = now.secsTo(self.server_status.autostart_timer_widget.dateTime())
else:
- seconds_remaining = now.secsTo(self.server_status.scheduled_start.replace(second=0, microsecond=0))
+ seconds_remaining = now.secsTo(self.server_status.autostart_timer_datetime.replace(second=0, microsecond=0))
# Update the server button
if seconds_remaining > 0:
self.server_status.server_button.setText(strings._('gui_waiting_to_start').format(self.human_friendly_time(seconds_remaining)))
@@ -183,15 +183,15 @@ 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, slug
# and onion address, but it will not start the WebThread yet.
- if self.server_status.scheduled_start:
+ if self.server_status.autostart_timer_datetime:
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.scheduled_start:
- self.common.log('Mode', 'start_server', 'Starting startup timer')
- self.startup_thread = StartupTimer(self)
+ 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
self.startup_thread.success.connect(self.start_scheduled_service)
self.startup_thread.error.connect(self.start_server_error)
diff --git a/onionshare_gui/onionshare_gui.py b/onionshare_gui/onionshare_gui.py
index 0627d205..88c0052e 100644
--- a/onionshare_gui/onionshare_gui.py
+++ b/onionshare_gui/onionshare_gui.py
@@ -228,7 +228,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.server_status_label.setText(strings._('gui_status_indicator_share_stopped'))
elif self.share_mode.server_status.status == ServerStatus.STATUS_WORKING:
self.server_status_image_label.setPixmap(QtGui.QPixmap.fromImage(self.server_status_image_working))
- if self.share_mode.server_status.scheduled_start:
+ if self.share_mode.server_status.autostart_timer_datetime:
self.server_status_label.setText(strings._('gui_status_indicator_share_scheduled'))
else:
self.server_status_label.setText(strings._('gui_status_indicator_share_working'))
@@ -242,7 +242,7 @@ class OnionShareGui(QtWidgets.QMainWindow):
self.server_status_label.setText(strings._('gui_status_indicator_receive_stopped'))
elif self.receive_mode.server_status.status == ServerStatus.STATUS_WORKING:
self.server_status_image_label.setPixmap(QtGui.QPixmap.fromImage(self.server_status_image_working))
- if self.receive_mode.server_status.scheduled_start:
+ if self.receive_mode.server_status.autostart_timer_datetime:
self.server_status_label.setText(strings._('gui_status_indicator_receive_scheduled'))
else:
self.server_status_label.setText(strings._('gui_status_indicator_receive_working'))
@@ -319,12 +319,12 @@ class OnionShareGui(QtWidgets.QMainWindow):
if not self.common.settings.get('autostop_timer'):
self.share_mode.server_status.autostop_timer_container.hide()
self.receive_mode.server_status.autostop_timer_container.hide()
- # If we switched off the startup timer setting, ensure the widget is hidden.
- if not self.common.settings.get('startup_timer'):
- self.share_mode.server_status.scheduled_start = None
- self.receive_mode.server_status.scheduled_start = None
- self.share_mode.server_status.startup_timer_container.hide()
- self.receive_mode.server_status.startup_timer_container.hide()
+ # If we switched off the auto-start timer setting, ensure the widget is hidden.
+ if not self.common.settings.get('autostart_timer'):
+ self.share_mode.server_status.autostart_timer_datetime = None
+ self.receive_mode.server_status.autostart_timer_datetime = None
+ self.share_mode.server_status.autostart_timer_container.hide()
+ self.receive_mode.server_status.autostart_timer_container.hide()
d = SettingsDialog(self.common, self.onion, self.qtapp, self.config, self.local_only)
d.settings_saved.connect(reload_settings)
diff --git a/onionshare_gui/server_status.py b/onionshare_gui/server_status.py
index d05c8251..9f5b095d 100644
--- a/onionshare_gui/server_status.py
+++ b/onionshare_gui/server_status.py
@@ -56,35 +56,35 @@ class ServerStatus(QtWidgets.QWidget):
self.app = app
self.web = None
- self.scheduled_start = None
+ self.autostart_timer_datetime = None
self.local_only = local_only
self.resizeEvent(None)
- # Startup timer layout
- self.startup_timer_label = QtWidgets.QLabel(strings._('gui_settings_startup_timer'))
- self.startup_timer = QtWidgets.QDateTimeEdit()
- self.startup_timer.setDisplayFormat("hh:mm A MMM d, yy")
+ # Auto-start timer layout
+ self.autostart_timer_label = QtWidgets.QLabel(strings._('gui_settings_autostart_timer'))
+ self.autostart_timer_widget = QtWidgets.QDateTimeEdit()
+ self.autostart_timer_widget.setDisplayFormat("hh:mm A MMM d, yy")
if self.local_only:
# For testing
- self.startup_timer.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(15))
- self.startup_timer.setMinimumDateTime(QtCore.QDateTime.currentDateTime())
+ self.autostart_timer_widget.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(15))
+ self.autostart_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime())
else:
# Set proposed timer to be 5 minutes into the future
- self.startup_timer.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
+ self.autostart_timer_widget.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
# Onion services can take a little while to start, so reduce the risk of it expiring too soon by setting the minimum to 60s from now
- self.startup_timer.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
- self.startup_timer.setCurrentSection(QtWidgets.QDateTimeEdit.MinuteSection)
- startup_timer_layout = QtWidgets.QHBoxLayout()
- startup_timer_layout.addWidget(self.startup_timer_label)
- startup_timer_layout.addWidget(self.startup_timer)
-
- # Startup timer container, so it can all be hidden and shown as a group
- startup_timer_container_layout = QtWidgets.QVBoxLayout()
- startup_timer_container_layout.addLayout(startup_timer_layout)
- self.startup_timer_container = QtWidgets.QWidget()
- self.startup_timer_container.setLayout(startup_timer_container_layout)
- self.startup_timer_container.hide()
+ self.autostart_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
+ self.autostart_timer_widget.setCurrentSection(QtWidgets.QDateTimeEdit.MinuteSection)
+ autostart_timer_layout = QtWidgets.QHBoxLayout()
+ autostart_timer_layout.addWidget(self.autostart_timer_label)
+ autostart_timer_layout.addWidget(self.autostart_timer_widget)
+
+ # Auto-start timer container, so it can all be hidden and shown as a group
+ autostart_timer_container_layout = QtWidgets.QVBoxLayout()
+ autostart_timer_container_layout.addLayout(autostart_timer_layout)
+ self.autostart_timer_container = QtWidgets.QWidget()
+ self.autostart_timer_container.setLayout(autostart_timer_container_layout)
+ self.autostart_timer_container.hide()
# Auto-stop timer layout
self.autostop_timer_label = QtWidgets.QLabel(strings._('gui_settings_autostop_timer'))
@@ -149,7 +149,7 @@ class ServerStatus(QtWidgets.QWidget):
layout = QtWidgets.QVBoxLayout()
layout.addWidget(self.server_button)
layout.addLayout(url_layout)
- layout.addWidget(self.startup_timer_container)
+ layout.addWidget(self.autostart_timer_container)
layout.addWidget(self.autostop_timer_container)
self.setLayout(layout)
@@ -181,13 +181,13 @@ class ServerStatus(QtWidgets.QWidget):
except:
pass
- def startup_timer_reset(self):
+ def autostart_timer_reset(self):
"""
- Reset the timer in the UI after stopping a share
+ Reset the auto-start timer in the UI after stopping a share
"""
- self.startup_timer.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
+ self.autostart_timer_widget.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
if not self.local_only:
- self.startup_timer.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
+ self.autostart_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
def autostop_timer_reset(self):
"""
@@ -244,8 +244,8 @@ class ServerStatus(QtWidgets.QWidget):
self.common.settings.set('slug', self.web.slug)
self.common.settings.save()
- if self.common.settings.get('startup_timer'):
- self.startup_timer_container.hide()
+ if self.common.settings.get('autostart_timer'):
+ self.autostart_timer_container.hide()
if self.common.settings.get('autostop_timer'):
self.autostop_timer_container.hide()
@@ -269,8 +269,8 @@ class ServerStatus(QtWidgets.QWidget):
else:
self.server_button.setText(strings._('gui_receive_start_server'))
self.server_button.setToolTip('')
- if self.common.settings.get('startup_timer'):
- self.startup_timer_container.show()
+ if self.common.settings.get('autostart_timer'):
+ self.autostart_timer_container.show()
if self.common.settings.get('autostop_timer'):
self.autostop_timer_container.show()
elif self.status == self.STATUS_STARTED:
@@ -280,17 +280,17 @@ class ServerStatus(QtWidgets.QWidget):
self.server_button.setText(strings._('gui_share_stop_server'))
else:
self.server_button.setText(strings._('gui_receive_stop_server'))
- if self.common.settings.get('startup_timer'):
- self.startup_timer_container.hide()
+ if self.common.settings.get('autostart_timer'):
+ self.autostart_timer_container.hide()
if self.common.settings.get('autostop_timer'):
self.autostop_timer_container.hide()
self.server_button.setToolTip(strings._('gui_stop_server_autostop_timer_tooltip').format(self.autostop_timer_widget.dateTime().toString("H:mmAP, MMM dd, yy")))
elif self.status == self.STATUS_WORKING:
self.server_button.setStyleSheet(self.common.css['server_status_button_working'])
self.server_button.setEnabled(True)
- if self.scheduled_start:
- self.startup_timer_container.hide()
- self.server_button.setToolTip(strings._('gui_start_server_startup_timer_tooltip').format(self.startup_timer.dateTime().toString("H:mmAP, MMM dd, yy")))
+ if self.autostart_timer_datetime:
+ self.autostart_timer_container.hide()
+ self.server_button.setToolTip(strings._('gui_start_server_autostart_timer_tooltip').format(self.autostart_timer_widget.dateTime().toString("H:mmAP, MMM dd, yy")))
else:
self.server_button.setText(strings._('gui_please_wait'))
if self.common.settings.get('autostop_timer'):
@@ -299,9 +299,9 @@ class ServerStatus(QtWidgets.QWidget):
self.server_button.setStyleSheet(self.common.css['server_status_button_working'])
self.server_button.setEnabled(False)
self.server_button.setText(strings._('gui_please_wait'))
- if self.common.settings.get('startup_timer'):
- self.startup_timer_container.hide()
- self.server_button.setToolTip(strings._('gui_start_server_startup_timer_tooltip').format(self.startup_timer.dateTime().toString("H:mmAP, MMM dd, yy")))
+ if self.common.settings.get('autostart_timer'):
+ self.autostart_timer_container.hide()
+ self.server_button.setToolTip(strings._('gui_start_server_autostart_timer_tooltip').format(self.autostart_timer_widget.dateTime().toString("H:mmAP, MMM dd, yy")))
if self.common.settings.get('autostop_timer'):
self.autostop_timer_container.hide()
@@ -311,15 +311,15 @@ class ServerStatus(QtWidgets.QWidget):
"""
if self.status == self.STATUS_STOPPED:
can_start = True
- if self.common.settings.get('startup_timer'):
+ if self.common.settings.get('autostart_timer'):
if self.local_only:
- self.scheduled_start = self.startup_timer.dateTime().toPyDateTime()
+ self.autostart_timer_datetime = self.autostart_timer_widget.dateTime().toPyDateTime()
else:
- self.scheduled_start = self.startup_timer.dateTime().toPyDateTime().replace(second=0, microsecond=0)
+ self.autostart_timer_datetime = self.autostart_timer_widget.dateTime().toPyDateTime().replace(second=0, microsecond=0)
# If the timer has actually passed already before the user hit Start, refuse to start the server.
- if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.scheduled_start:
+ if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.autostart_timer_datetime:
can_start = False
- Alert(self.common, strings._('gui_server_startup_timer_expired'), QtWidgets.QMessageBox.Warning)
+ Alert(self.common, strings._('gui_server_autostart_timer_expired'), QtWidgets.QMessageBox.Warning)
if self.common.settings.get('autostop_timer'):
if self.local_only:
self.autostop_timer_datetime = self.autostop_timer_widget.dateTime().toPyDateTime()
@@ -330,9 +330,9 @@ class ServerStatus(QtWidgets.QWidget):
if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.autostop_timer_datetime:
can_start = False
Alert(self.common, strings._('gui_server_autostop_timer_expired'), QtWidgets.QMessageBox.Warning)
- if self.common.settings.get('startup_timer'):
- if self.autostop_timer_datetime <= self.scheduled_start:
- Alert(self.common, strings._('gui_autostop_timer_cant_be_earlier_than_startup'), QtWidgets.QMessageBox.Warning)
+ if self.common.settings.get('autostart_timer'):
+ if self.autostop_timer_datetime <= self.autostart_timer_datetime:
+ Alert(self.common, strings._('gui_autostop_timer_cant_be_earlier_than_autostart_timer'), QtWidgets.QMessageBox.Warning)
can_start = False
if can_start:
self.start_server()
@@ -364,7 +364,7 @@ class ServerStatus(QtWidgets.QWidget):
Stop the server.
"""
self.status = self.STATUS_WORKING
- self.startup_timer_reset()
+ self.autostart_timer_reset()
self.autostop_timer_reset()
self.update()
self.server_stopped.emit()
@@ -375,7 +375,7 @@ class ServerStatus(QtWidgets.QWidget):
"""
self.common.log('ServerStatus', 'cancel_server', 'Canceling the server mid-startup')
self.status = self.STATUS_WORKING
- self.startup_timer_reset()
+ self.autostart_timer_reset()
self.autostop_timer_reset()
self.update()
self.server_canceled.emit()
diff --git a/onionshare_gui/settings_dialog.py b/onionshare_gui/settings_dialog.py
index f5d9c85a..2419723d 100644
--- a/onionshare_gui/settings_dialog.py
+++ b/onionshare_gui/settings_dialog.py
@@ -71,22 +71,22 @@ class SettingsDialog(QtWidgets.QDialog):
self.public_mode_widget = QtWidgets.QWidget()
self.public_mode_widget.setLayout(public_mode_layout)
- # Whether or not to use a startup ('auto-start') timer
- self.startup_timer_checkbox = QtWidgets.QCheckBox()
- self.startup_timer_checkbox.setCheckState(QtCore.Qt.Checked)
- self.startup_timer_checkbox.setText(strings._("gui_settings_startup_timer_checkbox"))
- startup_timer_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Startup-Timer"))
- startup_timer_label.setStyleSheet(self.common.css['settings_whats_this'])
- startup_timer_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
- startup_timer_label.setOpenExternalLinks(True)
- startup_timer_label.setMinimumSize(public_mode_label.sizeHint())
- startup_timer_layout = QtWidgets.QHBoxLayout()
- startup_timer_layout.addWidget(self.startup_timer_checkbox)
- startup_timer_layout.addWidget(startup_timer_label)
- startup_timer_layout.addStretch()
- startup_timer_layout.setContentsMargins(0,0,0,0)
- self.startup_timer_widget = QtWidgets.QWidget()
- self.startup_timer_widget.setLayout(startup_timer_layout)
+ # Whether or not to use an auto-start timer
+ self.autostart_timer_checkbox = QtWidgets.QCheckBox()
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Checked)
+ self.autostart_timer_checkbox.setText(strings._("gui_settings_autostart_timer_checkbox"))
+ autostart_timer_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Startup-Timer"))
+ autostart_timer_label.setStyleSheet(self.common.css['settings_whats_this'])
+ autostart_timer_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
+ autostart_timer_label.setOpenExternalLinks(True)
+ autostart_timer_label.setMinimumSize(public_mode_label.sizeHint())
+ autostart_timer_layout = QtWidgets.QHBoxLayout()
+ autostart_timer_layout.addWidget(self.autostart_timer_checkbox)
+ autostart_timer_layout.addWidget(autostart_timer_label)
+ autostart_timer_layout.addStretch()
+ autostart_timer_layout.setContentsMargins(0,0,0,0)
+ self.autostart_timer_widget = QtWidgets.QWidget()
+ self.autostart_timer_widget.setLayout(autostart_timer_layout)
# Whether or not to use an auto-stop timer
self.autostop_timer_checkbox = QtWidgets.QCheckBox()
@@ -108,7 +108,7 @@ class SettingsDialog(QtWidgets.QDialog):
# General settings layout
general_group_layout = QtWidgets.QVBoxLayout()
general_group_layout.addWidget(self.public_mode_widget)
- general_group_layout.addWidget(self.startup_timer_widget)
+ general_group_layout.addWidget(self.autostart_timer_widget)
general_group_layout.addWidget(self.autostop_timer_widget)
general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label"))
general_group.setLayout(general_group_layout)
@@ -506,11 +506,11 @@ class SettingsDialog(QtWidgets.QDialog):
else:
self.close_after_first_download_checkbox.setCheckState(QtCore.Qt.Unchecked)
- startup_timer = self.old_settings.get('startup_timer')
- if startup_timer:
- self.startup_timer_checkbox.setCheckState(QtCore.Qt.Checked)
+ autostart_timer = self.old_settings.get('autostart_timer')
+ if autostart_timer:
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Checked)
else:
- self.startup_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
+ self.autostart_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
autostop_timer = self.old_settings.get('autostop_timer')
if autostop_timer:
@@ -956,7 +956,7 @@ class SettingsDialog(QtWidgets.QDialog):
settings.load() # To get the last update timestamp
settings.set('close_after_first_download', self.close_after_first_download_checkbox.isChecked())
- settings.set('startup_timer', self.startup_timer_checkbox.isChecked())
+ settings.set('autostart_timer', self.autostart_timer_checkbox.isChecked())
settings.set('autostop_timer', self.autostop_timer_checkbox.isChecked())
# Complicated logic here to force v2 onion mode on or off depending on other settings
diff --git a/onionshare_gui/threads.py b/onionshare_gui/threads.py
index cb7447b5..26a9ee6b 100644
--- a/onionshare_gui/threads.py
+++ b/onionshare_gui/threads.py
@@ -90,30 +90,30 @@ class WebThread(QtCore.QThread):
self.success.emit()
-class StartupTimer(QtCore.QThread):
+class AutoStartTimer(QtCore.QThread):
"""
Waits for a prescribed time before allowing a share to start
"""
success = QtCore.pyqtSignal()
error = QtCore.pyqtSignal(str)
def __init__(self, mode, canceled=False):
- super(StartupTimer, self).__init__()
+ super(AutoStartTimer, self).__init__()
self.mode = mode
self.canceled = canceled
- self.mode.common.log('StartupTimer', '__init__')
+ self.mode.common.log('AutoStartTimer', '__init__')
# allow this thread to be terminated
self.setTerminationEnabled()
def run(self):
now = QtCore.QDateTime.currentDateTime()
- scheduled_start = now.secsTo(self.mode.server_status.scheduled_start)
+ autostart_timer_datetime_delta = now.secsTo(self.mode.server_status.autostart_timer_datetime)
try:
# Sleep until scheduled time
- while scheduled_start > 0 and self.canceled == False:
+ while autostart_timer_datetime_delta > 0 and self.canceled == False:
time.sleep(0.1)
now = QtCore.QDateTime.currentDateTime()
- scheduled_start = now.secsTo(self.mode.server_status.scheduled_start)
+ autostart_timer_datetime_delta = now.secsTo(self.mode.server_status.autostart_timer_datetime)
# Timer has now finished
if self.canceled == False:
self.mode.server_status.server_button.setText(strings._('gui_please_wait'))
diff --git a/share/locale/en.json b/share/locale/en.json
index 1dad3c36..196894e9 100644
--- a/share/locale/en.json
+++ b/share/locale/en.json
@@ -38,7 +38,7 @@
"gui_share_stop_server": "Stop sharing",
"gui_share_stop_server_autostop_timer": "Stop Sharing ({})",
"gui_stop_server_autostop_timer_tooltip": "Auto-stop timer ends at {}",
- "gui_start_server_startup_timer_tooltip": "Auto-start timer ends at {}",
+ "gui_start_server_autostart_timer_tooltip": "Auto-start timer ends at {}",
"gui_receive_start_server": "Start Receive Mode",
"gui_receive_stop_server": "Stop Receive Mode",
"gui_receive_stop_server_autostop_timer": "Stop Receive Mode ({}s remaining)",
@@ -102,8 +102,8 @@
"gui_settings_button_help": "Help",
"gui_settings_autostop_timer_checkbox": "Use auto-stop timer",
"gui_settings_autostop_timer": "Stop the share at:",
- "gui_settings_startup_timer_checkbox": "Use auto-start timer",
- "gui_settings_startup_timer": "Start the share at:",
+ "gui_settings_autostart_timer_checkbox": "Use auto-start timer",
+ "gui_settings_autostart_timer": "Start the share at:",
"settings_error_unknown": "Can't connect to Tor controller because your settings don't make sense.",
"settings_error_automatic": "Could not connect to the Tor controller. Is Tor Browser (available from torproject.org) running in the background?",
"settings_error_socket_port": "Can't connect to the Tor controller at {}:{}.",
@@ -131,8 +131,8 @@
"gui_tor_connection_lost": "Disconnected from Tor.",
"gui_server_started_after_autostop_timer": "The auto-stop timer ran out before the server started. Please make a new share.",
"gui_server_autostop_timer_expired": "The auto-stop timer already ran out. Please update it to start sharing.",
- "gui_server_startup_timer_expired": "The scheduled time has already passed. Please update it to start sharing.",
- "gui_autostop_timer_cant_be_earlier_than_startup": "The auto-stop time can't be the same or earlier than the start-up time. Please update it to start sharing.",
+ "gui_server_autostart_timer_expired": "The scheduled time has already passed. Please update it to start sharing.",
+ "gui_autostop_timer_cant_be_earlier_than_autostart_timer": "The auto-stop time can't be the same or earlier than the auto-start time. Please update it to start sharing.",
"share_via_onionshare": "OnionShare it",
"gui_connect_to_tor_for_onion_settings": "Connect to Tor to see onion service settings",
"gui_use_legacy_v2_onions_checkbox": "Use legacy addresses",
diff --git a/tests/GuiBaseTest.py b/tests/GuiBaseTest.py
index ec8dc870..d3fc9945 100644
--- a/tests/GuiBaseTest.py
+++ b/tests/GuiBaseTest.py
@@ -308,16 +308,16 @@ class GuiBaseTest(object):
# We should have timed out now
self.assertEqual(mode.server_status.status, 0)
- # Startup timer tests
- def set_startup_timer(self, mode, timer):
+ # Auto-start timer tests
+ def set_autostart_timer(self, mode, timer):
'''Test that the timer can be set'''
schedule = QtCore.QDateTime.currentDateTime().addSecs(timer)
- mode.server_status.startup_timer.setDateTime(schedule)
- self.assertTrue(mode.server_status.startup_timer.dateTime(), schedule)
+ mode.server_status.autostart_timer_widget.setDateTime(schedule)
+ self.assertTrue(mode.server_status.autostart_timer_widget.dateTime(), schedule)
- def startup_timer_widget_hidden(self, mode):
- '''Test that the startup timer widget is hidden when share has started'''
- self.assertFalse(mode.server_status.startup_timer_container.isVisible())
+ def autostart_timer_widget_hidden(self, mode):
+ '''Test that the auto-start timer widget is hidden when share has started'''
+ self.assertFalse(mode.server_status.autostart_timer_container.isVisible())
def scheduled_service_started(self, mode, wait):
'''Test that the server has timed out after the timer ran out'''
@@ -331,7 +331,7 @@ class GuiBaseTest(object):
self.server_status_indicator_says_scheduled(mode)
self.add_delete_buttons_hidden()
self.settings_button_is_hidden()
- self.set_startup_timer(mode, 10)
+ self.set_autostart_timer(mode, 10)
QtTest.QTest.mousePress(mode.server_status.server_button, QtCore.Qt.LeftButton)
QtTest.QTest.qWait(2000)
QtTest.QTest.mouseRelease(mode.server_status.server_button, QtCore.Qt.LeftButton)
diff --git a/tests/GuiShareTest.py b/tests/GuiShareTest.py
index d25c6c34..29661712 100644
--- a/tests/GuiShareTest.py
+++ b/tests/GuiShareTest.py
@@ -195,12 +195,12 @@ class GuiShareTest(GuiBaseTest):
self.server_timed_out(self.gui.share_mode, 10000)
self.web_server_is_stopped()
- def run_all_share_mode_startup_timer_tests(self, public_mode):
- """Auto-stop timer tests in share mode"""
+ def run_all_share_mode_autostart_timer_tests(self, public_mode):
+ """Auto-start timer tests in share mode"""
self.run_all_share_mode_setup_tests()
- self.set_startup_timer(self.gui.share_mode, 5)
+ self.set_autostart_timer(self.gui.share_mode, 5)
self.server_working_on_start_button_pressed(self.gui.share_mode)
- self.startup_timer_widget_hidden(self.gui.share_mode)
+ self.autostart_timer_widget_hidden(self.gui.share_mode)
self.server_status_indicator_says_scheduled(self.gui.share_mode)
self.web_server_is_stopped()
self.scheduled_service_started(self.gui.share_mode, 7000)
@@ -209,7 +209,7 @@ class GuiShareTest(GuiBaseTest):
def run_all_share_mode_autostop_autostart_mismatch_tests(self, public_mode):
"""Auto-stop timer tests in share mode"""
self.run_all_share_mode_setup_tests()
- self.set_startup_timer(self.gui.share_mode, 15)
+ self.set_autostart_timer(self.gui.share_mode, 15)
self.set_timeout(self.gui.share_mode, 5)
QtCore.QTimer.singleShot(4000, self.accept_dialog)
QtTest.QTest.mouseClick(self.gui.share_mode.server_status.server_button, QtCore.Qt.LeftButton)
diff --git a/tests/local_onionshare_share_mode_autostart_and_autostop_timer_mismatch_test.py b/tests/local_onionshare_share_mode_autostart_and_autostop_timer_mismatch_test.py
index 2017e58d..70a9ecb3 100644
--- a/tests/local_onionshare_share_mode_autostart_and_autostop_timer_mismatch_test.py
+++ b/tests/local_onionshare_share_mode_autostart_and_autostop_timer_mismatch_test.py
@@ -4,12 +4,12 @@ import unittest
from .GuiShareTest import GuiShareTest
-class LocalShareModeStartupTimerTest(unittest.TestCase, GuiShareTest):
+class LocalShareModeAutoStartTimerTest(unittest.TestCase, GuiShareTest):
@classmethod
def setUpClass(cls):
test_settings = {
"public_mode": False,
- "startup_timer": True,
+ "autostart_timer": True,
"autostop_timer": True,
}
cls.gui = GuiShareTest.set_up(test_settings)
diff --git a/tests/local_onionshare_share_mode_startup_timer_test.py b/tests/local_onionshare_share_mode_autostart_timer_test.py
index b5e08b10..9da75f1d 100644
--- a/tests/local_onionshare_share_mode_startup_timer_test.py
+++ b/tests/local_onionshare_share_mode_autostart_timer_test.py
@@ -4,12 +4,12 @@ import unittest
from .GuiShareTest import GuiShareTest
-class LocalShareModeStartupTimerTest(unittest.TestCase, GuiShareTest):
+class LocalShareModeAutoStartTimerTest(unittest.TestCase, GuiShareTest):
@classmethod
def setUpClass(cls):
test_settings = {
"public_mode": False,
- "startup_timer": True,
+ "autostart_timer": True,
}
cls.gui = GuiShareTest.set_up(test_settings)
@@ -20,7 +20,7 @@ class LocalShareModeStartupTimerTest(unittest.TestCase, GuiShareTest):
@pytest.mark.gui
def test_gui(self):
self.run_all_common_setup_tests()
- self.run_all_share_mode_startup_timer_tests(False)
+ self.run_all_share_mode_autostart_timer_tests(False)
if __name__ == "__main__":
unittest.main()
diff --git a/tests/local_onionshare_share_mode_autostart_timer_too_short_test.py b/tests/local_onionshare_share_mode_autostart_timer_too_short_test.py
index 12343478..92bbe12d 100644
--- a/tests/local_onionshare_share_mode_autostart_timer_too_short_test.py
+++ b/tests/local_onionshare_share_mode_autostart_timer_too_short_test.py
@@ -5,12 +5,12 @@ from PyQt5 import QtCore, QtTest
from .GuiShareTest import GuiShareTest
-class LocalShareModeStartupTimerTooShortTest(unittest.TestCase, GuiShareTest):
+class LocalShareModeAutoStartTimerTooShortTest(unittest.TestCase, GuiShareTest):
@classmethod
def setUpClass(cls):
test_settings = {
"public_mode": False,
- "startup_timer": True,
+ "autostart_timer": True,
}
cls.gui = GuiShareTest.set_up(test_settings)
@@ -23,7 +23,7 @@ class LocalShareModeStartupTimerTooShortTest(unittest.TestCase, GuiShareTest):
self.run_all_common_setup_tests()
self.run_all_share_mode_setup_tests()
# Set a low timeout
- self.set_startup_timer(self.gui.share_mode, 2)
+ self.set_autostart_timer(self.gui.share_mode, 2)
QtTest.QTest.qWait(3000)
QtCore.QTimer.singleShot(4000, self.accept_dialog)
QtTest.QTest.mouseClick(self.gui.share_mode.server_status.server_button, QtCore.Qt.LeftButton)
diff --git a/tests/local_onionshare_share_mode_cancel_share_test.py b/tests/local_onionshare_share_mode_cancel_share_test.py
index 24408730..ba52721d 100644
--- a/tests/local_onionshare_share_mode_cancel_share_test.py
+++ b/tests/local_onionshare_share_mode_cancel_share_test.py
@@ -8,7 +8,7 @@ class LocalShareModeCancelTest(unittest.TestCase, GuiShareTest):
@classmethod
def setUpClass(cls):
test_settings = {
- "startup_timer": True,
+ "autostart_timer": True,
}
cls.gui = GuiShareTest.set_up(test_settings)
diff --git a/tests/onionshare_share_mode_cancel_share_test.py b/tests/onionshare_share_mode_cancel_share_test.py
index ed087a2c..3fc4f592 100644
--- a/tests/onionshare_share_mode_cancel_share_test.py
+++ b/tests/onionshare_share_mode_cancel_share_test.py
@@ -8,7 +8,7 @@ class ShareModeCancelTest(unittest.TestCase, TorGuiShareTest):
@classmethod
def setUpClass(cls):
test_settings = {
- "startup_timer": True,
+ "autostart_timer": True,
}
cls.gui = TorGuiShareTest.set_up(test_settings)
diff --git a/tests/test_onionshare_settings.py b/tests/test_onionshare_settings.py
index 40eb9a0f..bcc2f7cb 100644
--- a/tests/test_onionshare_settings.py
+++ b/tests/test_onionshare_settings.py
@@ -52,7 +52,7 @@ class TestSettings:
'auth_password': '',
'close_after_first_download': True,
'autostop_timer': False,
- 'startup_timer': False,
+ 'autostart_timer': False,
'use_stealth': False,
'use_autoupdate': True,
'autoupdate_timestamp': None,