fix time
This commit is contained in:
parent
c281a3cba6
commit
6aac7d2c4d
|
|
@ -4,6 +4,8 @@ import os
|
|||
import sys
|
||||
import weakref
|
||||
from datetime import datetime, timedelta
|
||||
from distutils.util import change_root
|
||||
|
||||
from PyQt5.QtCore import QTimer, pyqtSlot, pyqtSignal
|
||||
from PyQt5.QtWidgets import QMessageBox
|
||||
from lib.db import Archive, Recipes, Users
|
||||
|
|
@ -221,15 +223,20 @@ class Test(Widget):
|
|||
self.next_timer.timeout.connect(self.next)
|
||||
self.next()
|
||||
|
||||
|
||||
def refresh_time(self, init=False):
|
||||
if init:
|
||||
if init and not hasattr(self, 'time_timer'):
|
||||
self.time_timer = QTimer()
|
||||
self.time_timer.setSingleShot(True)
|
||||
self.time_timer.timeout.connect(self.refresh_time)
|
||||
|
||||
t = datetime.now()
|
||||
self.time_l.setText("{d}/{mo}/{y}\n{h}:{m}".format(y=t.year, mo=t.month, d=t.day, h=t.hour, m=t.minute))
|
||||
self.time_timer.start(60 - t.second)
|
||||
self.time_l.setText("{d}/{mo}/{y}\n{h}:{m:02d}".format(
|
||||
y=t.year, mo=t.month, d=t.day, h=t.hour, m=t.minute
|
||||
))
|
||||
|
||||
# Always restart the timer, ensuring intervals are set correctly
|
||||
if hasattr(self, 'time_timer'): # Safeguard for uninitialized timer
|
||||
self.time_timer.start((60 - t.second) * 1000)
|
||||
|
||||
def select_step_img(self, step, suffix=None):
|
||||
img_path = "./src/ui/imgs"
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user