Exemplo n.º 1
0
    def start(self):
        """
        Starts the modules, views classes.

        Arguments:
        - self: The main object pointer.
        """
        if self.cfg is None:
            conf_created, self.cfg = settings.load()

        self.proc_args()

        if not self.dbusd.start():
            self.httpd.start()

        if self.cfg.getboolean("main", "startCam"):
            # Lets start the module
            idm = pocv.get_idm(self.cfg.get("main", "algorithm"))
            self.idm = idm.Module(self)
            self.idm.set_capture(self.cfg.getint("cam", "inputDevIndex"))

            #Will return false when cap.image() is false in ui/main
            GObject.timeout_add(150, self.update_frame)    #Thread that updates the image on the screen
            GObject.timeout_add(50, self.update_pointers)   #Thread that moves the mouse

            debug.info("mousetrap", "Idm loaded and started")

        # Lets build the interface
        self.itf = MainGui(self)
        self.itf.build_interface()
        self.itf.load_addons()

        if conf_created:
            from .ui import settings_gui
            settings_gui.showPreffGui(self)

        debug.info("mousetrap", "MouseTrap's Interface Built and Loaded")

        GObject.threads_init()
        self.loop.run()
Exemplo n.º 2
0
              'r' : [ X.ButtonRelease ],
              'c' : [ X.ButtonPress, X.ButtonRelease],
              'd' : [ X.ButtonPress, X.ButtonRelease,
                      X.ButtonPress, X.ButtonRelease ] }


## GTK Display for any user
gtkDisplay = gtk.gdk.Display( "" )

## X Display for non gnome users
xDisplay   = display.Display()

isGnome = False
if env.desktop == "gnome":
    isGnome = True
    debug.info( "mousetrap.app.mouse", "GNOME desktop has been detected" )

    ## pyatspi registry for gnome users
    reg = pyatspi.Registry

## Is the D&D click being used ?
dragging = False


def position( *arg ):
    """
    Get the absolute position of the mouse pointer

    Returns A list with the X and Y coordinates.
    """
    return list(gtkDisplay.get_pointer()[1:3])
Exemplo n.º 3
0
    'p': [X.ButtonPress],
    'r': [X.ButtonRelease],
    'c': [X.ButtonPress, X.ButtonRelease],
    'd': [X.ButtonPress, X.ButtonRelease, X.ButtonPress, X.ButtonRelease]
}

## GTK Display for any user
gtkDisplay = gtk.gdk.Display("")

## X Display for non gnome users
xDisplay = display.Display()

isGnome = False
if env.desktop == "gnome":
    isGnome = True
    debug.info("mousetrap.app.mouse", "GNOME desktop has been detected")

    ## pyatspi registry for gnome users
    reg = pyatspi.Registry

## Is the D&D click being used ?
dragging = False


def position(*arg):
    """
    Get the absolute position of the mouse pointer

    Returns A list with the X and Y coordinates.
    """
    return list(gtkDisplay.get_pointer()[1:3])