Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/visiongui/driver/DesktopDriverInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ def find_window(
self,
*,
title: re.Pattern[str],
timeout: int,
timeout: float,
) -> pywinctl.Window: ...

@abstractmethod
def wait_for_window_to_disappear(
self,
*,
title: re.Pattern[str],
timeout: int,
timeout: float,
) -> None: ...

@abstractmethod
Expand All @@ -52,18 +52,18 @@ def switch_to(self, *, target_window: pywinctl.Window) -> None: ...
def close(
self,
*,
OS_PROCESS_KILL_TIMEOUT: int,
OS_PROCESS_KILL_TIMEOUT: float,
) -> None: ...

@abstractmethod
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: ...
12 changes: 6 additions & 6 deletions src/visiongui/driver/DesktopDriverWindowsImplementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def find_window(
self,
*,
title: re.Pattern[str],
timeout: int,
timeout: float,
) -> pywinctl.Window:
return find_window(
title=title,
Expand All @@ -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,
Expand All @@ -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:
Expand All @@ -98,7 +98,7 @@ def switch_to(
def close(
self,
*,
OS_PROCESS_KILL_TIMEOUT: int,
OS_PROCESS_KILL_TIMEOUT: float,
) -> None:
close(
self,
Expand Down
2 changes: 1 addition & 1 deletion src/visiongui/driver/close.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
10 changes: 5 additions & 5 deletions src/visiongui/driver/exception.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand All @@ -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",
Expand All @@ -23,7 +23,7 @@ class ExceptionElementNotFound(ExceptionTimeout):
def __init__(
self,
*,
timeout: int,
timeout: float,
):
super().__init__(timeout=timeout)

Expand All @@ -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",
Expand Down
8 changes: 4 additions & 4 deletions src/visiongui/driver/find_element_by_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion src/visiongui/driver/find_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/visiongui/driver/wait.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/visiongui/driver/wait_for_window_to_disappear.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down