diff --git a/src/visiongui/driver/DesktopDriverInterface.py b/src/visiongui/driver/DesktopDriverInterface.py index 2312921..e185986 100644 --- a/src/visiongui/driver/DesktopDriverInterface.py +++ b/src/visiongui/driver/DesktopDriverInterface.py @@ -34,7 +34,7 @@ def find_window( self, *, title: re.Pattern[str], - timeout: int, + timeout: float, ) -> pywinctl.Window: ... @abstractmethod @@ -42,7 +42,7 @@ def wait_for_window_to_disappear( self, *, title: re.Pattern[str], - timeout: int, + timeout: float, ) -> None: ... @abstractmethod @@ -52,7 +52,7 @@ def switch_to(self, *, target_window: pywinctl.Window) -> None: ... def close( self, *, - OS_PROCESS_KILL_TIMEOUT: int, + OS_PROCESS_KILL_TIMEOUT: float, ) -> None: ... @abstractmethod @@ -60,10 +60,10 @@ def find_element_by_image( self, *, image_path: str, - timeout: int, + timeout: float, log_image_name: str, - margin_of_error: int, - time_held_stable_on_screen: int, + margin_of_error: float, + time_held_stable_on_screen: float, debug_output_base_path: str, match_with_color: bool = False, ) -> DesktopElementInterface: ... diff --git a/src/visiongui/driver/DesktopDriverWindowsImplementation.py b/src/visiongui/driver/DesktopDriverWindowsImplementation.py index 652abc7..92bdc4e 100644 --- a/src/visiongui/driver/DesktopDriverWindowsImplementation.py +++ b/src/visiongui/driver/DesktopDriverWindowsImplementation.py @@ -48,7 +48,7 @@ def find_window( self, *, title: re.Pattern[str], - timeout: int, + timeout: float, ) -> pywinctl.Window: return find_window( title=title, @@ -59,7 +59,7 @@ def wait_for_window_to_disappear( self, *, title: re.Pattern[str], - timeout: int, + timeout: float, ) -> None: return wait_for_window_to_disappear( title=title, @@ -70,10 +70,10 @@ def find_element_by_image( self, *, image_path: str, - timeout: int, + timeout: float, log_image_name: str, - margin_of_error: int, - time_held_stable_on_screen: int, + margin_of_error: float, + time_held_stable_on_screen: float, debug_output_base_path: str, match_with_color: bool = False, ) -> DesktopElementInterface: @@ -98,7 +98,7 @@ def switch_to( def close( self, *, - OS_PROCESS_KILL_TIMEOUT: int, + OS_PROCESS_KILL_TIMEOUT: float, ) -> None: close( self, diff --git a/src/visiongui/driver/close.py b/src/visiongui/driver/close.py index b6d2d1f..e15336f 100644 --- a/src/visiongui/driver/close.py +++ b/src/visiongui/driver/close.py @@ -11,7 +11,7 @@ def close( driver: DesktopDriverInterface, - OS_PROCESS_KILL_TIMEOUT: int, + OS_PROCESS_KILL_TIMEOUT: float, ) -> None: if not isinstance(driver, DesktopDriverInterface): raise TypeError("Expected driver to be an instance of DesktopDriver") diff --git a/src/visiongui/driver/exception.py b/src/visiongui/driver/exception.py index 7bc639e..0f9095b 100644 --- a/src/visiongui/driver/exception.py +++ b/src/visiongui/driver/exception.py @@ -2,7 +2,7 @@ class ExceptionTimeout(Exception): def __init__( self, *, - timeout: int, + timeout: float, ): super().__init__(f"Element was not found within the {timeout}-second timeout") @@ -11,8 +11,8 @@ class ExceptionElementNotStableLongEnough(Exception): def __init__( self, *, - time_held_stable_on_screen: int, - timeout: int, + time_held_stable_on_screen: float, + timeout: float, ): super().__init__( f"Element was not stable on screen for {time_held_stable_on_screen} seconds within the {timeout}-second timeout", @@ -23,7 +23,7 @@ class ExceptionElementNotFound(ExceptionTimeout): def __init__( self, *, - timeout: int, + timeout: float, ): super().__init__(timeout=timeout) @@ -33,7 +33,7 @@ def __init__( self, *, window_title: str, - timeout: int, + timeout: float, ): super().__init__( f"Window '{window_title}' not found within the {timeout}-second timeout", diff --git a/src/visiongui/driver/find_element_by_image.py b/src/visiongui/driver/find_element_by_image.py index 2a47bc6..eabfff3 100644 --- a/src/visiongui/driver/find_element_by_image.py +++ b/src/visiongui/driver/find_element_by_image.py @@ -26,8 +26,8 @@ def _is_stable( get_current_location: Callable[[], DesktopElementImplementation | bool], - timeout: int, - time_held_stable_on_screen: int, + timeout: float, + time_held_stable_on_screen: float, ) -> DesktopElementImplementation: start_time = time.time() last_location: DesktopElementImplementation | None = None @@ -120,11 +120,11 @@ def _match_template( def find_element_by_image( image_path: str, - timeout: int, + timeout: float, log_image_name: str, debug_output_base_path: str, margin_of_error: float, - time_held_stable_on_screen: int, + time_held_stable_on_screen: float, match_with_color: bool = False, ) -> DesktopElementImplementation: if not image_path or not os.path.isfile(image_path): diff --git a/src/visiongui/driver/find_window.py b/src/visiongui/driver/find_window.py index cf10cee..70b249e 100644 --- a/src/visiongui/driver/find_window.py +++ b/src/visiongui/driver/find_window.py @@ -26,7 +26,7 @@ def _get_matching_window(title: re.Pattern[str]) -> pywinctl.Window | None: def find_window( title: re.Pattern[str], - timeout: int, + timeout: float, ) -> pywinctl.Window: def _window_check() -> pywinctl.Window | None: return _get_matching_window(title) diff --git a/src/visiongui/driver/wait.py b/src/visiongui/driver/wait.py index c05855f..a4e3391 100644 --- a/src/visiongui/driver/wait.py +++ b/src/visiongui/driver/wait.py @@ -8,7 +8,7 @@ class WebDriverWait: - def __init__(self, timeout: int, poll_frequency: float = 0.1): + def __init__(self, timeout: float, poll_frequency: float = 0.1): self.timeout = timeout self.poll_frequency = poll_frequency diff --git a/src/visiongui/driver/wait_for_window_to_disappear.py b/src/visiongui/driver/wait_for_window_to_disappear.py index a5bbe1b..7c16347 100644 --- a/src/visiongui/driver/wait_for_window_to_disappear.py +++ b/src/visiongui/driver/wait_for_window_to_disappear.py @@ -12,7 +12,7 @@ def wait_for_window_to_disappear( title: re.Pattern[str], - timeout: int, + timeout: float, ) -> None: def _window_check() -> bool: return _get_matching_window(title) is None