Refactor mouse button handling to use string literals instead of ButtonType constants; add debug print for screenshot action in web server
This commit is contained in:
parent
84d65cb505
commit
41f7d0e210
@ -5,13 +5,13 @@ def press_mouse(mouse_input: MouseInput) -> None:
|
|||||||
"""Presses mouse buttons at the given position."""
|
"""Presses mouse buttons at the given position."""
|
||||||
x, y = mouse_input.x, mouse_input.y
|
x, y = mouse_input.x, mouse_input.y
|
||||||
button = mouse_input.click_type
|
button = mouse_input.click_type
|
||||||
if button == ButtonType.LEFT:
|
if button == "left":
|
||||||
pyautogui.click(x, y, button='left')
|
pyautogui.click(x, y, button='left')
|
||||||
elif button == ButtonType.DOUBLE_LEFT:
|
elif button == "double_left":
|
||||||
pyautogui.doubleClick(x, y)
|
pyautogui.doubleClick(x, y)
|
||||||
elif button == ButtonType.RIGHT:
|
elif button == "right":
|
||||||
pyautogui.click(x, y, button='right')
|
pyautogui.click(x, y, button='right')
|
||||||
elif button == ButtonType.MIDDLE:
|
elif button == "middle":
|
||||||
pyautogui.click(x, y, button='middle')
|
pyautogui.click(x, y, button='middle')
|
||||||
|
|
||||||
def press_keyboard(keyboard_input: KeyboardInput) -> None:
|
def press_keyboard(keyboard_input: KeyboardInput) -> None:
|
||||||
|
@ -40,6 +40,7 @@ class WebServerApp:
|
|||||||
img_data = None
|
img_data = None
|
||||||
else:
|
else:
|
||||||
if 'host_screenshot' in data:
|
if 'host_screenshot' in data:
|
||||||
|
print('Taking screenshot...')
|
||||||
# take a screenshot right here
|
# take a screenshot right here
|
||||||
# capture the full screen
|
# capture the full screen
|
||||||
screenshot_img = ImageGrab.grab()
|
screenshot_img = ImageGrab.grab()
|
||||||
|
Loading…
Reference in New Issue
Block a user