def drop(modifiers: List[str] = []): # Some drag actions require that the mouse wait in the drop position # for a little while before dropping. Movement is instant with the zoom # mouse, so insert an artificial wait. time.sleep(0.3) # TODO: Port to newapi actions once I know the interface ctrl.mouse_click(button=0, up=True) Modifiers(modifiers).__exit__(None, None, None)
def drop(modifiers: List[str] = []): # Some drag actions require that the mouse wait in the drop position # for a little while before dropping. Movement is instant with the zoom # mouse, so insert an artificial wait. # # Also shake the mouse around a bit for cases like tab dragging in # firefox, where instant warping won't register as movement. actions.user.shake_mouse() actions.mouse_release() # TODO: Change this. Context manager is yuck. Introduce lower # abstraction for hold/release modifiers. Modifiers(modifiers).__exit__(None, None, None)
def double_click(modifiers: List[str] = []): """Double left click at current position.""" with Modifiers(modifiers): for i in range(2): actions.mouse_click(button=0)
def drag(modifiers: List[str] = []): Modifiers(modifiers).__enter__() actions.mouse_drag() actions.user.shake_mouse()
def right_click(modifiers: List[str] = []): """Right click at current position.""" with Modifiers(modifiers): actions.mouse_click(button=1)
def middle_click(modifiers: List[str] = []): """Middle click at current position.""" with Modifiers(modifiers): actions.mouse_click(button=2)
def drop(modifiers: List[str] = []): """Release a mouse button at current position (default left).""" actions.mouse_release() Modifiers(modifiers).__exit__(None, None, None)
def left_click(modifiers: List[str] = []): """Left click at current position.""" with Modifiers(modifiers): actions.mouse_click(button=0)
def drag(modifiers: List[str] = []): """Hold a mouse button at current position (default left).""" Modifiers(modifiers).__enter__() actions.mouse_drag()
def discord_switch_server(number: int) -> None: """Switch to a numbered server in Discord.""" with Modifiers(["ctrl"]): user.type_number(number)
def slack_switch_room(number: int) -> None: """Switch to a numbered room.""" with Modifiers(["ctrl"]): key("`") user.type_number(number)
def drop(modifiers: List[str] = []): """Release a mouse button at current position (default left).""" # TODO: Switch to newapi action once I know the interface ctrl.mouse_click(button=0, up=True) Modifiers(modifiers).__exit__(None, None, None)
def drag(modifiers: List[str] = []): """Hold a mouse button at current position (default left).""" Modifiers(modifiers).__enter__() # TODO: Switch to newapi action once I know the interface ctrl.mouse_click(button=0, down=True)