Fixes for displaying autostart timer countdown

This commit is contained in:
Miguel Jacq 2019-03-24 18:16:12 +11:00
parent 539be2ded3
commit 2ebc22c5af
No known key found for this signature in database
GPG Key ID: EEA4341C6D97A0B6

View File

@ -117,9 +117,15 @@ class Mode(QtWidgets.QWidget):
if self.server_status.status == ServerStatus.STATUS_WORKING:
if self.server_status.scheduled_start:
now = QtCore.QDateTime.currentDateTime()
seconds_remaining = now.secsTo(self.server_status.startup_timer.dateTime())
if self.server_status.local_only:
seconds_remaining = now.secsTo(self.server_status.startup_timer.dateTime())
else:
seconds_remaining = now.secsTo(self.server_status.scheduled_start.replace(second=0, microsecond=0))
# Update the server button
self.server_status.server_button.setText(strings._('gui_waiting_to_start').format(self.human_friendly_time(seconds_remaining)))
if seconds_remaining > 0:
self.server_status.server_button.setText(strings._('gui_waiting_to_start').format(self.human_friendly_time(seconds_remaining)))
else:
self.server_status.server_button.setText(strings._('gui_please_wait'))
# If the auto-shutdown timer has stopped, stop the server
if self.server_status.status == ServerStatus.STATUS_STARTED: