Skip to content

Commit 9fe5466

Browse files
committed
Centralized qWait typing fix
1 parent bbee09e commit 9fe5466

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

src/AutoSplit.py

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@
2020

2121
import certifi
2222
import cv2
23-
from PyQt6 import QtCore, QtGui, QtTest
23+
from PyQt6 import QtCore, QtGui
24+
from PyQt6.QtTest import QTest
2425
from PyQt6.QtWidgets import QApplication, QFileDialog, QMainWindow, QMessageBox, QWidget
2526
from win32 import win32gui
2627
from AutoSplitImage import COMPARISON_RESIZE, AutoSplitImage, ImageType
@@ -343,13 +344,11 @@ def __start_image_function(self):
343344
delay_time_left = start_delay - (time() - delay_start_time)
344345
self.current_split_image.setText(
345346
f"Delayed Before Starting:\n {seconds_remaining_text(delay_time_left)}")
346-
# Email sent to [email protected]
347-
QtTest.QTest.qWait(1) # type: ignore
347+
QTest.qWait(1)
348348

349349
self.start_image_status_value_label.setText("started")
350350
send_command(self, "start")
351-
# Email sent to [email protected]
352-
QtTest.QTest.qWait(int(1 / self.settings_dict["fps_limit"])) # type: ignore
351+
QTest.qWait(int(1 / self.settings_dict["fps_limit"]))
353352
self.start_auto_splitter()
354353

355354
# update x, y, width, height when spinbox values are changed
@@ -605,8 +604,7 @@ def __auto_splitter(self):
605604

606605
# limit the number of time the comparison runs to reduce cpu usage
607606
frame_interval: float = 1 / self.settings_dict["fps_limit"]
608-
# Email sent to [email protected]
609-
QtTest.QTest.qWait(int(frame_interval - (time() - start) % frame_interval)) # type: ignore
607+
QTest.qWait(int(frame_interval - (time() - start) % frame_interval))
610608
QApplication.processEvents()
611609

612610
# comes here when threshold gets met
@@ -636,8 +634,7 @@ def __auto_splitter(self):
636634
capture = self.__get_capture_for_comparison()
637635
if self.__reset_if_should(capture):
638636
continue
639-
# Email sent to [email protected]
640-
QtTest.QTest.qWait(1) # type: ignore
637+
QTest.qWait(1)
641638

642639
self.waiting_for_split_delay = False
643640

@@ -691,8 +688,7 @@ def __auto_splitter(self):
691688
send_command(self, "reset")
692689
self.reset()
693690
continue
694-
# Email sent to [email protected]
695-
QtTest.QTest.qWait(1) # type: ignore
691+
QTest.qWait(1)
696692

697693
# loop breaks to here when the last image splits
698694
self.gui_changes_on_reset()

src/screen_region.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
import cv2
1010

1111
import numpy as np
12-
from PyQt6 import QtCore, QtGui, QtTest, QtWidgets
12+
from PyQt6 import QtCore, QtGui, QtWidgets
13+
from PyQt6.QtTest import QTest
1314
from win32 import win32gui
1415
from win32con import GA_ROOT, MAXBYTE, SM_XVIRTUALSCREEN, SM_YVIRTUALSCREEN, SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN
1516

@@ -35,8 +36,7 @@ def select_region(autosplit: AutoSplit):
3536
y = selector.y()
3637
if width > 0 and height > 0:
3738
break
38-
# Email sent to [email protected]
39-
QtTest.QTest.qWait(1) # type: ignore
39+
QTest.qWait(1)
4040
del selector
4141

4242
hwnd, window_text = __get_window_from_point(x, y)
@@ -66,8 +66,7 @@ def select_window(autosplit: AutoSplit):
6666
y = selector.y()
6767
if x and y:
6868
break
69-
# Email sent to [email protected]
70-
QtTest.QTest.qWait(1) # type: ignore
69+
QTest.qWait(1)
7170
del selector
7271

7372
hwnd, window_text = __get_window_from_point(x, y)

typings/PyQt6/QtTest.pyi

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import typing
2+
import PyQt6.sip
3+
4+
5+
class QTest(PyQt6.sip.simplewrapper):
6+
# Email sent to [email protected]
7+
@typing.overload
8+
@staticmethod
9+
def qWait(ms: int) -> None: ...
10+
@typing.overload
11+
def qWait(self, ms: int) -> None: ...

0 commit comments

Comments
 (0)