Standardise all startup_timer, scheduled_start attributes as 'autostart_timer'

This commit is contained in:
Miguel Jacq 2019-03-25 15:28:31 +11:00
parent c411e8d61a
commit ee3a14a025
No known key found for this signature in database
GPG key ID: EEA4341C6D97A0B6
16 changed files with 121 additions and 121 deletions

View file

@ -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'))