Exemplo n.º 1
0
 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)
Exemplo n.º 2
0
 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)
Exemplo n.º 3
0
 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)
Exemplo n.º 4
0
 def drag(modifiers: List[str] = []):
     Modifiers(modifiers).__enter__()
     actions.mouse_drag()
     actions.user.shake_mouse()
Exemplo n.º 5
0
 def right_click(modifiers: List[str] = []):
     """Right click at current position."""
     with Modifiers(modifiers):
         actions.mouse_click(button=1)
Exemplo n.º 6
0
 def middle_click(modifiers: List[str] = []):
     """Middle click at current position."""
     with Modifiers(modifiers):
         actions.mouse_click(button=2)
Exemplo n.º 7
0
 def drop(modifiers: List[str] = []):
     """Release a mouse button at current position (default left)."""
     actions.mouse_release()
     Modifiers(modifiers).__exit__(None, None, None)
Exemplo n.º 8
0
 def left_click(modifiers: List[str] = []):
     """Left click at current position."""
     with Modifiers(modifiers):
         actions.mouse_click(button=0)
Exemplo n.º 9
0
 def drag(modifiers: List[str] = []):
     """Hold a mouse button at current position (default left)."""
     Modifiers(modifiers).__enter__()
     actions.mouse_drag()
Exemplo n.º 10
0
 def discord_switch_server(number: int) -> None:
     """Switch to a numbered server in Discord."""
     with Modifiers(["ctrl"]):
         user.type_number(number)
Exemplo n.º 11
0
 def slack_switch_room(number: int) -> None:
     """Switch to a numbered room."""
     with Modifiers(["ctrl"]):
         key("`")
         user.type_number(number)
Exemplo n.º 12
0
 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)
Exemplo n.º 13
0
 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)