def mouse_alternates(mode, nexus, monitor=1): if nexus.dep.PIL: if mode == "legion" and not utilities.window_exists(None, "legiongrid"): r = monitors[int(monitor) - 1].rectangle bbox = [ int(r.x), int(r.y), int(r.x) + int(r.dx) - 1, int(r.y) + int(r.dy) - 1 ] ls = LegionScanner() ls.scan(bbox) tscan = ls.get_update() Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["LEGION_PATH"], "-t", tscan[0], "-m", str(monitor) ]) # , "-d", "500_500_500_500" elif mode == "rainbow" and not utilities.window_exists(None, "rainbowgrid"): Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["RAINBOW_PATH"], "-g", "r", "-m", str(monitor) ]) elif mode == "douglas" and not utilities.window_exists(None, "douglasgrid"): Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["DOUGLAS_PATH"], "-g", "d", "-m", str(monitor) ]) else: utilities.availability_message(mode.title(), "PIL")
def wait_for_death(title, timeout=5): t = 0.0 inc = 0.1 while t < timeout: if not utilities.window_exists(None, title): break t += inc time.sleep(inc) if t >= timeout: print("wait_for_death()" + " timed out (" + title + ")")
def mouse_alternates(mode, monitor=1, rough=True): args = [] if mode == "legion" and not utilities.window_exists(None, "legiongrid"): from castervoice.asynch.mouse.legion import LegionScanner r = monitors[int(monitor) - 1].rectangle bbox = [ int(r.x), int(r.y), int(r.x) + int(r.dx) - 1, int(r.y) + int(r.dy) - 1 ] ls = LegionScanner() ls.scan(bbox, rough) tscan = ls.get_update() args = [ settings.settings(["paths", "PYTHONW"]), settings.settings(["paths", "LEGION_PATH"]), "-t", tscan[0], "-m", str(monitor) ] elif mode == "rainbow" and not utilities.window_exists( None, "rainbowgrid"): args = [ settings.settings(["paths", "PYTHONW"]), settings.settings(["paths", "RAINBOW_PATH"]), "-g", "r", "-m", str(monitor) ] elif mode == "douglas" and not utilities.window_exists( None, "douglasgrid"): args = [ settings.settings(["paths", "PYTHONW"]), settings.settings(["paths", "DOUGLAS_PATH"]), "-g", "d", "-m", str(monitor) ] elif mode == "sudoku" and not utilities.window_exists(None, "sudokugrid"): args = [ settings.settings(["paths", "PYTHONW"]), settings.settings(["paths", "SUDOKU_PATH"]), "-g", "s", "-m", str(monitor) ] global GRID_PROCESS GRID_PROCESS = subprocess.Popen(args) if args else None
def mouse_alternates(mode, monitor=1): if mode == "legion" and not utilities.window_exists(None, "legiongrid"): r = monitors[int(monitor) - 1].rectangle bbox = [ int(r.x), int(r.y), int(r.x) + int(r.dx) - 1, int(r.y) + int(r.dy) - 1 ] ls = LegionScanner() ls.scan(bbox) tscan = ls.get_update() Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["LEGION_PATH"], "-t", tscan[0], "-m", str(monitor) ]) elif mode == "rainbow" and not utilities.window_exists( None, "rainbowgrid"): Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["RAINBOW_PATH"], "-g", "r", "-m", str(monitor) ]) elif mode == "douglas" and not utilities.window_exists( None, "douglasgrid"): Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["DOUGLAS_PATH"], "-g", "d", "-m", str(monitor) ]) elif mode == "sudoku" and not utilities.window_exists(None, "sudokugrid"): Popen([ settings.SETTINGS["paths"]["PYTHONW"], settings.SETTINGS["paths"]["SUDOKU_PATH"], "-g", "s", "-m", str(monitor) ])