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:
		@@ -5,13 +5,13 @@ def press_mouse(mouse_input: MouseInput) -> None:
 | 
			
		||||
    """Presses mouse buttons at the given position."""
 | 
			
		||||
    x, y = mouse_input.x, mouse_input.y
 | 
			
		||||
    button = mouse_input.click_type
 | 
			
		||||
    if button == ButtonType.LEFT:
 | 
			
		||||
    if button == "left":
 | 
			
		||||
        pyautogui.click(x, y, button='left')
 | 
			
		||||
    elif button == ButtonType.DOUBLE_LEFT:
 | 
			
		||||
    elif button == "double_left":
 | 
			
		||||
        pyautogui.doubleClick(x, y)
 | 
			
		||||
    elif button == ButtonType.RIGHT:
 | 
			
		||||
    elif button == "right":
 | 
			
		||||
        pyautogui.click(x, y, button='right')
 | 
			
		||||
    elif button == ButtonType.MIDDLE:
 | 
			
		||||
    elif button == "middle":
 | 
			
		||||
        pyautogui.click(x, y, button='middle')
 | 
			
		||||
 | 
			
		||||
def press_keyboard(keyboard_input: KeyboardInput) -> None:
 | 
			
		||||
 
 | 
			
		||||
@@ -40,6 +40,7 @@ class WebServerApp:
 | 
			
		||||
                    img_data = None
 | 
			
		||||
            else:
 | 
			
		||||
                if 'host_screenshot' in data:
 | 
			
		||||
                    print('Taking screenshot...')
 | 
			
		||||
                    # take a screenshot right here
 | 
			
		||||
                    # capture the full screen
 | 
			
		||||
                    screenshot_img = ImageGrab.grab()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user