mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-03 23:15:18 -04:00
Standardise all startup_timer, scheduled_start attributes as 'autostart_timer'
This commit is contained in:
parent
c411e8d61a
commit
ee3a14a025
16 changed files with 121 additions and 121 deletions
|
@ -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'))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue