def select_text(): global x1, y1, x2, y2 x2, y2 = get_cursor_position() s = control.nexus().comm.get_com("grids") s.kill() Grid.wait_for_grid_exit() drag_from_to(x1, y1, x2, y2)
def send_input(n, action): s = control.nexus().comm.get_com("grids") int_a = int(action) response = None if int_a != 2: s.go(str(n)) elif int_a == 2: response = s.retrieve_data_for_highlight(str(int(n))) s.kill() Grid.wait_for_grid_exit() if int_a == 0: Mouse("left").execute() elif int_a == 1: Mouse("right").execute() elif int_a == 2: x1 = response["l"] + 2 x2 = response["r"] y = response["y"] Mouse("[{}, {}]".format(x1, y)).execute() time.sleep(0.1) Mouse("left:down").execute() Mouse("[{}, {}]".format(x2, y)).execute() time.sleep(0.1) Mouse("left:up").execute()
def send_input_select(x1, y1, x2, y2): s = control.nexus().comm.get_com("grids") s.move_mouse(int(x1), int(y1)) _x1, _y1 = get_cursor_position() s.move_mouse(int(x2), int(y2)) _x2, _y2 = get_cursor_position() s.kill() Grid.wait_for_grid_exit() drag_from_to(_x1, _y1, _x2, _y2)
def send_input_select(pre1, color1, n1, pre2, color2, n2): s = control.nexus().comm.get_com("grids") s.move_mouse(int(pre1), int(color1), int(n1)) _x1, _y1 = get_cursor_position() s.move_mouse(int(pre2), int(color2), int(n2)) _x2, _y2 = get_cursor_position() s.kill() Grid.wait_for_grid_exit() drag_from_to(_x1, _y1, _x2, _y2)
def move_mouse(n, s, action): sudoku = control.nexus().comm.get_com("grids") sudoku.move_mouse(int(n), int(s)) int_a = int(action) if (int_a == 0) | (int_a == 1) | (int_a == 2) | (int_a == -1): sudoku.kill() Grid.wait_for_grid_exit() time.sleep(0.1) perform_mouse_action(int(action))
def send_input(x, y, action): s = control.nexus().comm.get_com("grids") s.move_mouse(int(x), int(y)) int_a = int(action) if (int_a == 0) | (int_a == 1) | (int_a == 2) | (int_a == -1): s.kill() Grid.wait_for_grid_exit() if int_a == 0: Mouse("left").execute() if int_a == 1: Mouse("left:2").execute() elif int_a == 2: Mouse("right").execute()
def send_input(pre, color, n, action): s = control.nexus().comm.get_com("grids") s.move_mouse(int(pre), int(color), int(n)) int_a = int(action) if (int_a == 0) | (int_a == 1) | (int_a == 2) | (int_a == -1): s.kill() Grid.wait_for_grid_exit() time.sleep(0.1) if int_a == 0: Mouse("left").execute() if int_a == 1: Mouse("left:2").execute() elif int_a == 2: Mouse("right").execute()
def drag_highlight(n1, n2): s = control.nexus().comm.get_com("grids") response1 = s.retrieve_data_for_highlight(str(int(n1))) response2 = s.retrieve_data_for_highlight(str(int(n2))) s.kill() Grid.wait_for_grid_exit() x11 = response1["l"] + 2 y1 = response1["y"] x22 = response2["r"] y2 = response2["y"] Mouse("[{}, {}]".format(x11, y1)).execute() time.sleep(0.1) Mouse("left:down").execute() Mouse("[{}, {}]".format(x22, y2)).execute() time.sleep(0.1) Mouse("left:up").execute()
def drag_mouse(n0, s0, n, s, action): sudoku = control.nexus().comm.get_com("grids") # These numbers are internal to the monitor the screen is on x, y = sudoku.get_mouse_pos(int(n), int(s)) # If dragging from a different location, move there first if int(n0) > 0: sudoku.move_mouse(int(n0), int(s0)) sudoku.kill() Grid.wait_for_grid_exit() time.sleep(0.1) # Hold down click, move to drag destination, and release click Mouse("left:down/10").execute() Mouse("[{}, {}]".format(x, y)).execute() time.sleep(0.1) Mouse("left:up/30").execute() perform_mouse_action(int(action))
def get_rule(): return LegionGridRule, RuleDetails(name="legion grid rule", function_context=lambda: Grid.is_grid_active("legion"))
def get_rule(): return RainbowGridRule, RuleDetails( name="rainbow grid rule", function_context=lambda: Grid.is_grid_active("rainbow"))
def get_rule(): return DouglasGridRule, RuleDetails( name="douglas grid rule", function_context=lambda: Grid.is_grid_active("douglas"))
def get_rule(): Details = RuleDetails( name="Sudoku Grid", function_context=lambda: Grid.is_grid_active("sudoku")) return SudokuGridRule, Details