예제 #1
0
def mouse_alternates(mode):
    if control.nexus().dep.PIL:
        try:
            if mode == "legion":
                if utilities.window_exists(None, "legiongrid"):
                    pass
                else:
                    ls = LegionScanner()
                    ls.scan()  #[500, 500, 1000, 1000]
                    tscan = ls.get_update()
                    Popen([
                        "pythonw", settings.SETTINGS["paths"]["LEGION_PATH"],
                        "-t", tscan[0]
                    ])  #, "-d", "500_500_500_500"
            elif mode == "rainbow":
                Popen([
                    "pythonw", settings.SETTINGS["paths"]["RAINBOW_PATH"],
                    "-m", "r"
                ])
            elif mode == "douglas":
                Popen([
                    "pythonw", settings.SETTINGS["paths"]["DOUGLAS_PATH"],
                    "-m", "d"
                ])
        except Exception:
            utilities.simple_log(True)
    else:
        utilities.availability_message(mode.title(), "PIL")
예제 #2
0
파일: navigation.py 프로젝트: seekM/caster
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")
예제 #3
0
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([
                "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([
                "pythonw", settings.SETTINGS["paths"]["RAINBOW_PATH"], "-g",
                "r", "-m",
                str(monitor)
            ])
        elif mode == "douglas" and not utilities.window_exists(
                None, "douglasgrid"):
            Popen([
                "pythonw", settings.SETTINGS["paths"]["DOUGLAS_PATH"], "-g",
                "d", "-m",
                str(monitor)
            ])
    else:
        utilities.availability_message(mode.title(), "PIL")
예제 #4
0
 def begin(self):
     ''''''
     if settings.SETTINGS["auto_com"]["active"]:
         if self._nexus.dep.NATLINK and not settings.WSR:
             self._nexus.timer.add_callback(lambda: self._toggle(), settings.SETTINGS["auto_com"]["interval"])
         else:
             utilities.availability_message("Auto-Command-Mode", "natlink")
예제 #5
0
 def _execute(self, data=None):
     if control.nexus().dep.NATLINK:
         executable = utilities.get_active_window_path(natlink).split("\\")[-1]
         is_executable = executable in self.executables
         if (is_executable and not self.negate) or (self.negate and not is_executable):
             self.action._execute()
     else:
         utilities.availability_message("SelectiveAction", "natlink")
         self.action._execute()
예제 #6
0
def mouse_alternates(mode):
    if control.nexus().dep.PIL:
        try:
            if mode == "legion":
                if utilities.window_exists(None, "legiongrid"):
                    pass
                else:
                    ls = LegionScanner()
                    ls.scan()#[500, 500, 1000, 1000]
                    tscan = ls.get_update()
                    Popen(["pythonw", settings.SETTINGS["paths"]["LEGION_PATH"], "-t", tscan[0]])#, "-d", "500_500_500_500"
            elif mode == "rainbow":
                Popen(["pythonw", settings.SETTINGS["paths"]["RAINBOW_PATH"], "-m", "r"])
            elif mode == "douglas":
                Popen(["pythonw", settings.SETTINGS["paths"]["DOUGLAS_PATH"], "-m", "d"])
        except Exception:
            utilities.simple_log(True)
    else:
        utilities.availability_message(mode.title(), "PIL")    
예제 #7
0
import Tkinter as tk

from dragonfly import monitors

try: # Style C -- may be imported into Caster, or externally
    BASE_PATH = os.path.realpath(__file__).split("\\caster")[0].replace("\\", "/")
    if BASE_PATH not in sys.path:
        sys.path.append(BASE_PATH)
finally:
    from caster.lib import settings, utilities
    from caster.lib.dfplus.communication import Communicator

try:
    from PIL import ImageGrab, ImageTk, ImageDraw, ImageFont
except ImportError:
    utilities.availability_message("Douglas Grid / Rainbow Grid", "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 + ")")

class Dimensions:
    def __init__(self, w, h, x, y):
예제 #8
0
import sys, os
import threading

try:  # Style C -- may be imported into Caster, or externally
    BASE_PATH = os.path.realpath(__file__).split("\\caster")[0].replace(
        "\\", "/")
    if BASE_PATH not in sys.path:
        sys.path.append(BASE_PATH)
finally:
    from caster.asynch.mouse.grids import TkTransparent, Dimensions
    from caster.lib import settings, utilities

try:
    from PIL import ImageGrab
except ImportError:
    utilities.availability_message("Legion", "PIL")


class Rectangle:
    top = None
    bottom = None
    left = None
    right = None


class LegionGrid(TkTransparent):
    def __init__(self, grid_size=None, tirg=None, auto_quit=False):
        self.setup_XMLRPC_server()
        TkTransparent.__init__(self, settings.LEGION_TITLE, grid_size)
        self.attributes("-alpha", 0.7)
예제 #9
0
from dragonfly import monitors


try: # Style C -- may be imported into Caster, or externally
    BASE_PATH = os.path.realpath(__file__).split("\\caster")[0].replace("\\", "/")
    if BASE_PATH not in sys.path:
        sys.path.append(BASE_PATH)
finally:
    from caster.asynch.mouse.grids import TkTransparent, Dimensions
    from caster.lib import gdi, settings, utilities

try:
    from PIL import ImageGrab
except ImportError:
    utilities.availability_message("Legion", "PIL")

class Rectangle:
    top = None
    bottom = None
    left = None
    right = None

class LegionGrid(TkTransparent):
    def __init__(self, grid_size=None, tirg=None, auto_quit=False):
        self.setup_xmlrpc_server()
        TkTransparent.__init__(self, settings.LEGION_TITLE, grid_size)
        self.attributes("-alpha", 0.7)
        
        self.tirg_positions = {}
        if tirg is not None:
예제 #10
0
from caster.lib import settings, utilities, control

if settings.SETTINGS["auto_com"]["active"]:
    if control.nexus().dep.NATLINK:
        from caster.asynch.auto_com import toggler
        toggler.initialize_auto_com_internal()
    else:
        utilities.availability_message("Auto-Command-Mode", "natlink")
예제 #11
0
파일: __init__.py 프로젝트: j127/caster
from caster.lib import settings, utilities, control
 
if settings.SETTINGS["auto_com"]["active"]:
    if control.nexus().dep.NATLINK:
        from caster.asynch.auto_com import toggler
        toggler.initialize_auto_com_internal()
    else:
        utilities.availability_message("Auto-Command-Mode", "natlink")