4141 AUTOSPLIT_VERSION ,
4242 BGRA_CHANNEL_COUNT ,
4343 FROZEN ,
44+ ONE_SECOND ,
4445 auto_split_directory ,
4546 decimal ,
4647 flatten ,
@@ -76,7 +77,9 @@ class AutoSplit(QMainWindow, design.Ui_MainWindow):
7677
7778 # Timers
7879 timer_live_image = QtCore .QTimer ()
80+ timer_live_image .setTimerType (QtCore .Qt .TimerType .PreciseTimer )
7981 timer_start_image = QtCore .QTimer ()
82+ timer_start_image .setTimerType (QtCore .Qt .TimerType .PreciseTimer )
8083
8184 # Widgets
8285 AboutWidget : about .Ui_AboutAutoSplitWidget | None = None
@@ -205,7 +208,7 @@ def _update_checker_widget_signal_slot(latest_version: str, check_on_open: bool)
205208
206209 # live image checkbox
207210 self .timer_live_image .timeout .connect (lambda : self .__update_live_image_details (None , True ))
208- self .timer_live_image .start (int (1000 / self .settings_dict ["fps_limit" ]))
211+ self .timer_live_image .start (int (ONE_SECOND / self .settings_dict ["fps_limit" ]))
209212
210213 # Automatic timer start
211214 self .timer_start_image .timeout .connect (self .__start_image_function )
@@ -296,7 +299,7 @@ def __load_start_image(self, started_by_button: bool = False, wait_for_delay: bo
296299 self .highest_similarity = 0.0
297300 self .reset_highest_similarity = 0.0
298301 self .split_below_threshold = False
299- self .timer_start_image .start (int (1000 / self .settings_dict ["fps_limit" ]))
302+ self .timer_start_image .start (int (ONE_SECOND / self .settings_dict ["fps_limit" ]))
300303
301304 QApplication .processEvents ()
302305
@@ -341,7 +344,7 @@ def __start_image_function(self):
341344 if self .start_image .get_delay_time (self ) > 0 :
342345 self .start_image_status_value_label .setText ("delaying start..." )
343346 delay_start_time = time ()
344- start_delay = self .start_image .get_delay_time (self ) / 1000
347+ start_delay = self .start_image .get_delay_time (self ) / ONE_SECOND
345348 time_delta = 0.0
346349 while time_delta < start_delay :
347350 delay_time_left = start_delay - time_delta
@@ -564,7 +567,7 @@ def __auto_splitter(self): # noqa: PLR0912,PLR0915
564567 while self .split_image_number < number_of_split_images :
565568 # Check if we are not waiting for the split delay to send the key press
566569 if self .waiting_for_split_delay :
567- time_millis = int (round (time () * 1000 ))
570+ time_millis = int (round (time () * ONE_SECOND ))
568571 if time_millis < split_time :
569572 QApplication .processEvents ()
570573 continue
@@ -583,9 +586,9 @@ def __auto_splitter(self): # noqa: PLR0912,PLR0915
583586 if not self .split_image .check_flag (DUMMY_FLAG ):
584587 # If it's a delayed split, check if the delay has passed
585588 # Otherwise calculate the split time for the key press
586- split_delay = self .split_image .get_delay_time (self ) / 1000
589+ split_delay = self .split_image .get_delay_time (self ) / ONE_SECOND
587590 if split_delay > 0 and not self .waiting_for_split_delay :
588- split_time = round (time () + split_delay * 1000 )
591+ split_time = round (time () + split_delay * ONE_SECOND )
589592 self .waiting_for_split_delay = True
590593 buttons_to_disable = [
591594 self .next_image_button ,
@@ -668,7 +671,7 @@ def __similarity_threshold_loop(self, number_of_split_images: int, dummy_splits_
668671 # Limit the number of time the comparison runs to reduce cpu usage
669672 frame_interval = 1 / self .settings_dict ["fps_limit" ]
670673 # Use a time delta to have a consistant check interval
671- wait_delta_ms = int ((frame_interval - (time () - start ) % frame_interval ) * 1000 )
674+ wait_delta_ms = int ((frame_interval - (time () - start ) % frame_interval ) * ONE_SECOND )
672675
673676 below_flag = self .split_image .check_flag (BELOW_FLAG )
674677 # if the b flag is set, let similarity go above threshold first,
0 commit comments