mirror of
https://github.com/onionshare/onionshare.git
synced 2025-10-03 16:58:48 -04:00
Standardise all shutdown_timer, shutdown_timeout, timeout attributes as 'autostop_timer'
This commit is contained in:
parent
49285e047c
commit
c411e8d61a
65 changed files with 573 additions and 573 deletions
|
@ -20,7 +20,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|||
from PyQt5 import QtCore, QtWidgets, QtGui
|
||||
|
||||
from onionshare import strings
|
||||
from onionshare.common import ShutdownTimer
|
||||
from onionshare.common import AutoStopTimer
|
||||
|
||||
from ..server_status import ServerStatus
|
||||
from ..threads import OnionThread
|
||||
|
@ -127,20 +127,20 @@ class Mode(QtWidgets.QWidget):
|
|||
else:
|
||||
self.server_status.server_button.setText(strings._('gui_please_wait'))
|
||||
|
||||
# If the auto-shutdown timer has stopped, stop the server
|
||||
# If the auto-stop timer has stopped, stop the server
|
||||
if self.server_status.status == ServerStatus.STATUS_STARTED:
|
||||
if self.app.shutdown_timer and self.common.settings.get('shutdown_timeout'):
|
||||
if self.timeout > 0:
|
||||
if self.app.autostop_timer_thread and self.common.settings.get('autostop_timer'):
|
||||
if self.autostop_timer_datetime_delta > 0:
|
||||
now = QtCore.QDateTime.currentDateTime()
|
||||
seconds_remaining = now.secsTo(self.server_status.timeout)
|
||||
seconds_remaining = now.secsTo(self.server_status.autostop_timer_datetime)
|
||||
|
||||
# Update the server button
|
||||
server_button_text = self.get_stop_server_shutdown_timeout_text()
|
||||
server_button_text = self.get_stop_server_autostop_timer_text()
|
||||
self.server_status.server_button.setText(server_button_text.format(self.human_friendly_time(seconds_remaining)))
|
||||
|
||||
self.status_bar.clearMessage()
|
||||
if not self.app.shutdown_timer.is_alive():
|
||||
if self.timeout_finished_should_stop_server():
|
||||
if not self.app.autostop_timer_thread.is_alive():
|
||||
if self.autostop_timer_finished_should_stop_server():
|
||||
self.server_status.stop_server()
|
||||
|
||||
def timer_callback_custom(self):
|
||||
|
@ -149,15 +149,15 @@ class Mode(QtWidgets.QWidget):
|
|||
"""
|
||||
pass
|
||||
|
||||
def get_stop_server_shutdown_timeout_text(self):
|
||||
def get_stop_server_autostop_timer_text(self):
|
||||
"""
|
||||
Return the string to put on the stop server button, if there's a shutdown timeout
|
||||
Return the string to put on the stop server button, if there's an auto-stop timer
|
||||
"""
|
||||
pass
|
||||
|
||||
def timeout_finished_should_stop_server(self):
|
||||
def autostop_timer_finished_should_stop_server(self):
|
||||
"""
|
||||
The shutdown timer expired, should we stop the server? Returns a bool
|
||||
The auto-stop timer expired, should we stop the server? Returns a bool
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -259,18 +259,18 @@ class Mode(QtWidgets.QWidget):
|
|||
|
||||
self.start_server_step3_custom()
|
||||
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
# Convert the date value to seconds between now and then
|
||||
now = QtCore.QDateTime.currentDateTime()
|
||||
self.timeout = now.secsTo(self.server_status.timeout)
|
||||
# Set the shutdown timeout value
|
||||
if self.timeout > 0:
|
||||
self.app.shutdown_timer = ShutdownTimer(self.common, self.timeout)
|
||||
self.app.shutdown_timer.start()
|
||||
# The timeout has actually already passed since the user clicked Start. Probably the Onion service took too long to start.
|
||||
self.autostop_timer_datetime_delta = now.secsTo(self.server_status.autostop_timer_datetime)
|
||||
# Start the auto-stop timer
|
||||
if self.autostop_timer_datetime_delta > 0:
|
||||
self.app.autostop_timer_thread = AutoStopTimer(self.common, self.autostop_timer_datetime_delta)
|
||||
self.app.autostop_timer_thread.start()
|
||||
# The auto-stop timer has actually already passed since the user clicked Start. Probably the Onion service took too long to start.
|
||||
else:
|
||||
self.stop_server()
|
||||
self.start_server_error(strings._('gui_server_started_after_timeout'))
|
||||
self.start_server_error(strings._('gui_server_started_after_autostop_timer'))
|
||||
|
||||
def start_server_step3_custom(self):
|
||||
"""
|
||||
|
|
|
@ -86,24 +86,24 @@ class ReceiveMode(Mode):
|
|||
self.wrapper_layout.addWidget(self.history, stretch=1)
|
||||
self.setLayout(self.wrapper_layout)
|
||||
|
||||
def get_stop_server_shutdown_timeout_text(self):
|
||||
def get_stop_server_autostop_timer_text(self):
|
||||
"""
|
||||
Return the string to put on the stop server button, if there's a shutdown timeout
|
||||
Return the string to put on the stop server button, if there's an auto-stop timer
|
||||
"""
|
||||
return strings._('gui_receive_stop_server_shutdown_timeout')
|
||||
return strings._('gui_receive_stop_server_autostop_timer')
|
||||
|
||||
def timeout_finished_should_stop_server(self):
|
||||
def autostop_timer_finished_should_stop_server(self):
|
||||
"""
|
||||
The shutdown timer expired, should we stop the server? Returns a bool
|
||||
The auto-stop timer expired, should we stop the server? Returns a bool
|
||||
"""
|
||||
# If there were no attempts to upload files, or all uploads are done, we can stop
|
||||
if self.web.receive_mode.upload_count == 0 or not self.web.receive_mode.uploads_in_progress:
|
||||
self.server_status.stop_server()
|
||||
self.server_status_label.setText(strings._('close_on_timeout'))
|
||||
self.server_status_label.setText(strings._('close_on_autostop_timer'))
|
||||
return True
|
||||
# An upload is probably still running - hold off on stopping the share, but block new shares.
|
||||
else:
|
||||
self.server_status_label.setText(strings._('gui_receive_mode_timeout_waiting'))
|
||||
self.server_status_label.setText(strings._('gui_receive_mode_autostop_timer_waiting'))
|
||||
self.web.receive_mode.can_upload = False
|
||||
return False
|
||||
|
||||
|
|
|
@ -121,24 +121,24 @@ class ShareMode(Mode):
|
|||
# Always start with focus on file selection
|
||||
self.file_selection.setFocus()
|
||||
|
||||
def get_stop_server_shutdown_timeout_text(self):
|
||||
def get_stop_server_autostop_timer_text(self):
|
||||
"""
|
||||
Return the string to put on the stop server button, if there's a shutdown timeout
|
||||
Return the string to put on the stop server button, if there's an auto-stop timer
|
||||
"""
|
||||
return strings._('gui_share_stop_server_shutdown_timeout')
|
||||
return strings._('gui_share_stop_server_autostop_timer')
|
||||
|
||||
def timeout_finished_should_stop_server(self):
|
||||
def autostop_timer_finished_should_stop_server(self):
|
||||
"""
|
||||
The shutdown timer expired, should we stop the server? Returns a bool
|
||||
The auto-stop timer expired, should we stop the server? Returns a bool
|
||||
"""
|
||||
# If there were no attempts to download the share, or all downloads are done, we can stop
|
||||
if self.web.share_mode.download_count == 0 or self.web.done:
|
||||
self.server_status.stop_server()
|
||||
self.server_status_label.setText(strings._('close_on_timeout'))
|
||||
self.server_status_label.setText(strings._('close_on_autostop_timer'))
|
||||
return True
|
||||
# A download is probably still running - hold off on stopping the share
|
||||
else:
|
||||
self.server_status_label.setText(strings._('gui_share_mode_timeout_waiting'))
|
||||
self.server_status_label.setText(strings._('gui_share_mode_autostop_timer_waiting'))
|
||||
return False
|
||||
|
||||
def start_server_custom(self):
|
||||
|
|
|
@ -315,10 +315,10 @@ class OnionShareGui(QtWidgets.QMainWindow):
|
|||
self.receive_mode.on_reload_settings()
|
||||
self.status_bar.clearMessage()
|
||||
|
||||
# If we switched off the shutdown timeout setting, ensure the widget is hidden.
|
||||
if not self.common.settings.get('shutdown_timeout'):
|
||||
self.share_mode.server_status.shutdown_timeout_container.hide()
|
||||
self.receive_mode.server_status.shutdown_timeout_container.hide()
|
||||
# If we switched off the auto-stop timer setting, ensure the widget is hidden.
|
||||
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
|
||||
|
|
|
@ -86,30 +86,30 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.startup_timer_container.setLayout(startup_timer_container_layout)
|
||||
self.startup_timer_container.hide()
|
||||
|
||||
# Shutdown timeout layout
|
||||
self.shutdown_timeout_label = QtWidgets.QLabel(strings._('gui_settings_shutdown_timeout'))
|
||||
self.shutdown_timeout = QtWidgets.QDateTimeEdit()
|
||||
self.shutdown_timeout.setDisplayFormat("hh:mm A MMM d, yy")
|
||||
# Auto-stop timer layout
|
||||
self.autostop_timer_label = QtWidgets.QLabel(strings._('gui_settings_autostop_timer'))
|
||||
self.autostop_timer_widget = QtWidgets.QDateTimeEdit()
|
||||
self.autostop_timer_widget.setDisplayFormat("hh:mm A MMM d, yy")
|
||||
if self.local_only:
|
||||
# For testing
|
||||
self.shutdown_timeout.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(15))
|
||||
self.shutdown_timeout.setMinimumDateTime(QtCore.QDateTime.currentDateTime())
|
||||
self.autostop_timer_widget.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(15))
|
||||
self.autostop_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime())
|
||||
else:
|
||||
# Set proposed timeout to be 5 minutes into the future
|
||||
self.shutdown_timeout.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
|
||||
# Set proposed timer to be 5 minutes into the future
|
||||
self.autostop_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.shutdown_timeout.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
|
||||
self.shutdown_timeout.setCurrentSection(QtWidgets.QDateTimeEdit.MinuteSection)
|
||||
shutdown_timeout_layout = QtWidgets.QHBoxLayout()
|
||||
shutdown_timeout_layout.addWidget(self.shutdown_timeout_label)
|
||||
shutdown_timeout_layout.addWidget(self.shutdown_timeout)
|
||||
self.autostop_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
|
||||
self.autostop_timer_widget.setCurrentSection(QtWidgets.QDateTimeEdit.MinuteSection)
|
||||
autostop_timer_layout = QtWidgets.QHBoxLayout()
|
||||
autostop_timer_layout.addWidget(self.autostop_timer_label)
|
||||
autostop_timer_layout.addWidget(self.autostop_timer_widget)
|
||||
|
||||
# Shutdown timeout container, so it can all be hidden and shown as a group
|
||||
shutdown_timeout_container_layout = QtWidgets.QVBoxLayout()
|
||||
shutdown_timeout_container_layout.addLayout(shutdown_timeout_layout)
|
||||
self.shutdown_timeout_container = QtWidgets.QWidget()
|
||||
self.shutdown_timeout_container.setLayout(shutdown_timeout_container_layout)
|
||||
self.shutdown_timeout_container.hide()
|
||||
# Auto-stop timer container, so it can all be hidden and shown as a group
|
||||
autostop_timer_container_layout = QtWidgets.QVBoxLayout()
|
||||
autostop_timer_container_layout.addLayout(autostop_timer_layout)
|
||||
self.autostop_timer_container = QtWidgets.QWidget()
|
||||
self.autostop_timer_container.setLayout(autostop_timer_container_layout)
|
||||
self.autostop_timer_container.hide()
|
||||
|
||||
# Server layout
|
||||
self.server_button = QtWidgets.QPushButton()
|
||||
|
@ -150,7 +150,7 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
layout.addWidget(self.server_button)
|
||||
layout.addLayout(url_layout)
|
||||
layout.addWidget(self.startup_timer_container)
|
||||
layout.addWidget(self.shutdown_timeout_container)
|
||||
layout.addWidget(self.autostop_timer_container)
|
||||
self.setLayout(layout)
|
||||
|
||||
def set_mode(self, share_mode, file_selection=None):
|
||||
|
@ -189,13 +189,13 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
if not self.local_only:
|
||||
self.startup_timer.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
|
||||
|
||||
def shutdown_timeout_reset(self):
|
||||
def autostop_timer_reset(self):
|
||||
"""
|
||||
Reset the timeout in the UI after stopping a share
|
||||
Reset the auto-stop timer in the UI after stopping a share
|
||||
"""
|
||||
self.shutdown_timeout.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
|
||||
self.autostop_timer_widget.setDateTime(QtCore.QDateTime.currentDateTime().addSecs(300))
|
||||
if not self.local_only:
|
||||
self.shutdown_timeout.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
|
||||
self.autostop_timer_widget.setMinimumDateTime(QtCore.QDateTime.currentDateTime().addSecs(60))
|
||||
|
||||
def show_url(self):
|
||||
"""
|
||||
|
@ -247,8 +247,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
if self.common.settings.get('startup_timer'):
|
||||
self.startup_timer_container.hide()
|
||||
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
self.autostop_timer_container.hide()
|
||||
else:
|
||||
self.url_description.hide()
|
||||
self.url.hide()
|
||||
|
@ -271,8 +271,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.server_button.setToolTip('')
|
||||
if self.common.settings.get('startup_timer'):
|
||||
self.startup_timer_container.show()
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.show()
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
self.autostop_timer_container.show()
|
||||
elif self.status == self.STATUS_STARTED:
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_started'])
|
||||
self.server_button.setEnabled(True)
|
||||
|
@ -282,9 +282,9 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
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('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
self.server_button.setToolTip(strings._('gui_stop_server_shutdown_timeout_tooltip').format(self.shutdown_timeout.dateTime().toString("H:mmAP, MMM dd, yy")))
|
||||
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)
|
||||
|
@ -293,8 +293,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
self.server_button.setToolTip(strings._('gui_start_server_startup_timer_tooltip').format(self.startup_timer.dateTime().toString("H:mmAP, MMM dd, yy")))
|
||||
else:
|
||||
self.server_button.setText(strings._('gui_please_wait'))
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
self.autostop_timer_container.hide()
|
||||
else:
|
||||
self.server_button.setStyleSheet(self.common.css['server_status_button_working'])
|
||||
self.server_button.setEnabled(False)
|
||||
|
@ -302,8 +302,8 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
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('shutdown_timeout'):
|
||||
self.shutdown_timeout_container.hide()
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
self.autostop_timer_container.hide()
|
||||
|
||||
def server_button_clicked(self):
|
||||
"""
|
||||
|
@ -320,19 +320,19 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.scheduled_start:
|
||||
can_start = False
|
||||
Alert(self.common, strings._('gui_server_startup_timer_expired'), QtWidgets.QMessageBox.Warning)
|
||||
if self.common.settings.get('shutdown_timeout'):
|
||||
if self.common.settings.get('autostop_timer'):
|
||||
if self.local_only:
|
||||
self.timeout = self.shutdown_timeout.dateTime().toPyDateTime()
|
||||
self.autostop_timer_datetime = self.autostop_timer_widget.dateTime().toPyDateTime()
|
||||
else:
|
||||
# Get the timeout chosen, stripped of its seconds. This prevents confusion if the share stops at (say) 37 seconds past the minute chosen
|
||||
self.timeout = self.shutdown_timeout.dateTime().toPyDateTime().replace(second=0, microsecond=0)
|
||||
# If the timeout has actually passed already before the user hit Start, refuse to start the server.
|
||||
if QtCore.QDateTime.currentDateTime().toPyDateTime() > self.timeout:
|
||||
# Get the timer chosen, stripped of its seconds. This prevents confusion if the share stops at (say) 37 seconds past the minute chosen
|
||||
self.autostop_timer_datetime = self.autostop_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.autostop_timer_datetime:
|
||||
can_start = False
|
||||
Alert(self.common, strings._('gui_server_timeout_expired'), QtWidgets.QMessageBox.Warning)
|
||||
Alert(self.common, strings._('gui_server_autostop_timer_expired'), QtWidgets.QMessageBox.Warning)
|
||||
if self.common.settings.get('startup_timer'):
|
||||
if self.timeout <= self.scheduled_start:
|
||||
Alert(self.common, strings._('gui_timeout_cant_be_earlier_than_startup'), QtWidgets.QMessageBox.Warning)
|
||||
if self.autostop_timer_datetime <= self.scheduled_start:
|
||||
Alert(self.common, strings._('gui_autostop_timer_cant_be_earlier_than_startup'), QtWidgets.QMessageBox.Warning)
|
||||
can_start = False
|
||||
if can_start:
|
||||
self.start_server()
|
||||
|
@ -365,7 +365,7 @@ class ServerStatus(QtWidgets.QWidget):
|
|||
"""
|
||||
self.status = self.STATUS_WORKING
|
||||
self.startup_timer_reset()
|
||||
self.shutdown_timeout_reset()
|
||||
self.autostop_timer_reset()
|
||||
self.update()
|
||||
self.server_stopped.emit()
|
||||
|
||||
|
@ -376,7 +376,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.shutdown_timeout_reset()
|
||||
self.autostop_timer_reset()
|
||||
self.update()
|
||||
self.server_canceled.emit()
|
||||
|
||||
|
|
|
@ -88,28 +88,28 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
self.startup_timer_widget = QtWidgets.QWidget()
|
||||
self.startup_timer_widget.setLayout(startup_timer_layout)
|
||||
|
||||
# Whether or not to use a shutdown ('auto-stop') timer
|
||||
self.shutdown_timeout_checkbox = QtWidgets.QCheckBox()
|
||||
self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
self.shutdown_timeout_checkbox.setText(strings._("gui_settings_shutdown_timeout_checkbox"))
|
||||
shutdown_timeout_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Auto-Stop-Timer"))
|
||||
shutdown_timeout_label.setStyleSheet(self.common.css['settings_whats_this'])
|
||||
shutdown_timeout_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
|
||||
shutdown_timeout_label.setOpenExternalLinks(True)
|
||||
shutdown_timeout_label.setMinimumSize(public_mode_label.sizeHint())
|
||||
shutdown_timeout_layout = QtWidgets.QHBoxLayout()
|
||||
shutdown_timeout_layout.addWidget(self.shutdown_timeout_checkbox)
|
||||
shutdown_timeout_layout.addWidget(shutdown_timeout_label)
|
||||
shutdown_timeout_layout.addStretch()
|
||||
shutdown_timeout_layout.setContentsMargins(0,0,0,0)
|
||||
self.shutdown_timeout_widget = QtWidgets.QWidget()
|
||||
self.shutdown_timeout_widget.setLayout(shutdown_timeout_layout)
|
||||
# Whether or not to use an auto-stop timer
|
||||
self.autostop_timer_checkbox = QtWidgets.QCheckBox()
|
||||
self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
self.autostop_timer_checkbox.setText(strings._("gui_settings_autostop_timer_checkbox"))
|
||||
autostop_timer_label = QtWidgets.QLabel(strings._("gui_settings_whats_this").format("https://github.com/micahflee/onionshare/wiki/Using-the-Auto-Stop-Timer"))
|
||||
autostop_timer_label.setStyleSheet(self.common.css['settings_whats_this'])
|
||||
autostop_timer_label.setTextInteractionFlags(QtCore.Qt.TextBrowserInteraction)
|
||||
autostop_timer_label.setOpenExternalLinks(True)
|
||||
autostop_timer_label.setMinimumSize(public_mode_label.sizeHint())
|
||||
autostop_timer_layout = QtWidgets.QHBoxLayout()
|
||||
autostop_timer_layout.addWidget(self.autostop_timer_checkbox)
|
||||
autostop_timer_layout.addWidget(autostop_timer_label)
|
||||
autostop_timer_layout.addStretch()
|
||||
autostop_timer_layout.setContentsMargins(0,0,0,0)
|
||||
self.autostop_timer_widget = QtWidgets.QWidget()
|
||||
self.autostop_timer_widget.setLayout(autostop_timer_layout)
|
||||
|
||||
# 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.shutdown_timeout_widget)
|
||||
general_group_layout.addWidget(self.autostop_timer_widget)
|
||||
general_group = QtWidgets.QGroupBox(strings._("gui_settings_general_label"))
|
||||
general_group.setLayout(general_group_layout)
|
||||
|
||||
|
@ -512,11 +512,11 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
else:
|
||||
self.startup_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
shutdown_timeout = self.old_settings.get('shutdown_timeout')
|
||||
if shutdown_timeout:
|
||||
self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
autostop_timer = self.old_settings.get('autostop_timer')
|
||||
if autostop_timer:
|
||||
self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Checked)
|
||||
else:
|
||||
self.shutdown_timeout_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
self.autostop_timer_checkbox.setCheckState(QtCore.Qt.Unchecked)
|
||||
|
||||
save_private_key = self.old_settings.get('save_private_key')
|
||||
if save_private_key:
|
||||
|
@ -957,7 +957,7 @@ class SettingsDialog(QtWidgets.QDialog):
|
|||
|
||||
settings.set('close_after_first_download', self.close_after_first_download_checkbox.isChecked())
|
||||
settings.set('startup_timer', self.startup_timer_checkbox.isChecked())
|
||||
settings.set('shutdown_timeout', self.shutdown_timeout_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
|
||||
if self.use_legacy_v2_onions_checkbox.isChecked():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue