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")
sys.path.append(BASE_PATH) finally: from castervoice.asynch.mouse.grids import TkTransparent, Dimensions from castervoice.lib import gdi, settings, utilities settings.initialize() import six if six.PY2: from castervoice.lib.util.pathlib import Path else: from pathlib import Path # pylint: disable=import-error try: from PIL import ImageGrab, ImageFilter, Image except ImportError: utilities.availability_message("Legion", "PIL") ''' The screen will be divided into vertical columns of equal width. The width of each Legion box cannot exceed the width of the column. This way relative partitioning is achieved since larger resolutions will be partitioned into columns of larger width. ''' class Rectangle: y1 = None y2 = None x1 = None x2 = None
if BASE_PATH not in sys.path: sys.path.append(BASE_PATH) finally: from castervoice.lib import settings, utilities from castervoice.lib.actions import Mouse from castervoice.lib.contexts import is_linux from castervoice.lib.merge.communication import Communicator settings.initialize() if is_linux(): from tkinter import ttk, font try: from PIL import ImageGrab, ImageTk, ImageDraw, ImageFont except ImportError: utilities.availability_message("Douglas Grid / Rainbow Grid / Sudoku Grid", "PIL") class Dimensions: def __init__(self, w, h, x, y): self.width = w self.height = h self.x = x self.y = y # rewrite dp grid using this class TkTransparent(tk.Tk): def reset_xs_ys(self): self.xs = [] self.ys = []