Ejemplo n.º 1
0
 def on_noise(self, noise):
     if noise == "hiss_start":
         print("hiss_start")
         # ctrl.mouse_click(button=0, hold=16000)
     if noise == "hiss_end":
         print("hiss_end")
         ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 2
0
    def mouse_drag(button: int):
        """Press and hold/release a specific mouse button for dragging"""
        # Clear any existing drags
        self.mouse_drag_end()

        # Start drag
        ctrl.mouse_click(button=button, down=True)
Ejemplo n.º 3
0
def on_pop(active):
    if (gaze_job or scroll_job):
        if settings.get("user.mouse_enable_pop_stops_scroll") >= 1:
            stop_scroll()
    elif not eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None:
        if settings.get("user.mouse_enable_pop_click") >= 1:
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 4
0
def on_pop(active):
    if gaze_job or scroll_job:
        if setting_mouse_enable_pop_stops_scroll.get() >= 1:
            stop_scroll()
    else:
        if setting_mouse_enable_pop_click.get() >= 1:
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 5
0
def on_pop(active):
    if (gaze_job or scroll_job):
        if settings.get("user.mouse_enable_pop_stops_scroll") >= 1:
            stop_scroll()
    else:
        if settings.get("user.mouse_enable_pop_click") >= 1:
            ctrl.mouse_click(button=0, hold=16000)
 def mouse_click(button: int = 0):
     """click right mouse button, holding it down a little bit longer"""
     print("mouse long right")
     if button == 1:
         ctrl.mouse_click(button=button, hold=200000)
     else:
         ctrl.mouse_click(button=button)
Ejemplo n.º 7
0
    def on_noise(self, noise):
        if eye_zoom_mouse.zoom_mouse.enabled:
            return
        if not eye_mouse.control_mouse.enabled:
            return
        now = time.time()
        # print("{} {}".format(noise, now - self.hiss_last))

        if noise == "pop":
            ctrl.mouse_click(button=0, hold=16000)
        elif noise == "hiss_start":
            if now - self.hiss_last < 0.4:
                self.button = 0
                ctrl.mouse_click(button=self.button, down=True)
                self.hiss_last = now
                self.dragging = True
            else:
                self.mouse_origin = self.mouse_last
            self.hiss_start = now
        elif noise == "hiss_end":
            duration = time.time() - self.hiss_start
            print("Hiss duration: {}".format(duration))
            if self.dragging:
                ctrl.mouse_click(button=self.button, up=True)
                self.dragging = False
            else:
                if duration > 0.7:
                    self.button = 2
                    ctrl.mouse_click(button=2)
                elif duration > 0.3:
                    self.button = 1
                    ctrl.mouse_click(button=1)
            self.hiss_last = now
            self.hiss_start = 0
Ejemplo n.º 8
0
 def on_noise(self, noise):
     now = time.time()
     if noise == 'pop':
         ctrl.mouse_click(button=0, hold=16000)
     elif noise == 'hiss_start':
         if now - self.hiss_last < 0.25:
             ctrl.mouse_click(button=self.button, down=True)
             self.hiss_last = now
             self.dragging = True
         else:
             self.mouse_origin = self.mouse_last
         self.hiss_start = now
     elif noise == 'hiss_end':
         if self.dragging:
             ctrl.mouse_click(button=self.button, up=True)
             self.dragging = False
         else:
             duration = time.time() - self.hiss_start
             if duration > 0.5:
                 self.button = 1
                 ctrl.mouse_click(button=1)
                 self.hiss_last = now
             elif duration > 0.2:
                 self.button = 0
                 ctrl.mouse_click(button=0)
                 self.hiss_last = now
         self.hiss_start = 0
Ejemplo n.º 9
0
 def mouse_click(button: int, count: int):
     """Click the specified mouse button a certain number of times."""
     for i in range(count):
         ctrl.mouse_click(button=button)
     if (eye_zoom_mouse.zoom_mouse.enabled and
             eye_zoom_mouse.zoom_mouse.state != eye_zoom_mouse.STATE_IDLE):
         eye_zoom_mouse.zoom_mouse.cancel()
Ejemplo n.º 10
0
def on_pop(active):
    if (gaze_job or scroll_job):
        if registry.settings["user.mouse_enable_pop_stops_scroll"][1] == 'true':
            stop_scroll()
    elif not eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None:
        if registry.settings["user.mouse_enable_pop_click"][1] == 'true':
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 11
0
def on_pop(active):
    if setting_mouse_enable_pop_stops_scroll.get() >= 1 and (gaze_job
                                                             or scroll_job):
        stop_scroll()
    elif setting_mouse_enable_pop_click.get() >= 1:
        if (eye_mouse.mouse.attached_tracker is None
                or not eye_zoom_mouse.zoom_mouse.enabled):
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 12
0
 def on_noise(self, noise):
     # now = time.time()
     if not voice.talon.enabled:
         return
     if noise == "pop" and eye_zoom_mouse.zoom_mouse.enabled:
         return
     if noise == "pop":
         ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 13
0
def on_pop(active):
    print("heard a pop lol {}".format(str(
        setting_mouse_enable_pop_click.get())))
    if setting_mouse_enable_pop_stops_scroll.get() >= 1 and (gaze_job
                                                             or scroll_job):
        stop_scroll()
    elif config.control_mouse >= 1:
        ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 14
0
def delayed_click(m, button=0, times=1):
    old = eye_mouse.config.control_mouse
    eye_mouse.config.control_mouse = False
    x, y = click_pos(m)
    ctrl.mouse(x, y)
    ctrl.mouse_click(x, y, button=button, times=times, wait=16000)
    time.sleep(0.032)
    eye_mouse.config.control_mouse = old
Ejemplo n.º 15
0
 def slack_close_right_sidebar():
     "close right sidebar"
     rect = ui.active_window().rect
     old_x, old_y = ctrl.mouse_pos()
     x = rect.width - 30
     ctrl.mouse_move(x, 123)
     ctrl.mouse_click()
     ctrl.mouse_move(old_x, old_y)
Ejemplo n.º 16
0
 def drop(modifiers: List[str] = []):
     # Some drag actions require that the mouse wait in the drop position
     # for a little while before dropping. Movement is instant with the zoom
     # mouse, so insert an artificial wait.
     time.sleep(0.3)
     # TODO: Port to newapi actions once I know the interface
     ctrl.mouse_click(button=0, up=True)
     Modifiers(modifiers).__exit__(None, None, None)
Ejemplo n.º 17
0
 def on_hiss(start: bool):
     # TODO: Replace with newapi actions once I know the interface
     #
     # TODO: Maybe use audio cues to notify user of premature release?
     if start:
         ctrl.mouse_click(button=0, down=True)
     else:
         ctrl.mouse_click(button=0, up=True)
Ejemplo n.º 18
0
 def delayed_click(m, button=0, times=1, from_end=False, mods=None):
     if mods is None:
         mods = []
     for key in mods:
         ctrl.key_press(key, down=True)
     ctrl.mouse_click(button=button, times=times)
     for key in mods[::-1]:
         ctrl.key_press(key, up=True)
     time.sleep(0.032)
Ejemplo n.º 19
0
 def mouse_drag():
     """(TEMPORARY) Press and hold/release button 0 depending on state for dragging"""
     global dragging
     if not dragging:
         dragging = True
         ctrl.mouse_click(button=0, down=True)
     else:
         dragging = False
         ctrl.mouse_click(up=True)
Ejemplo n.º 20
0
def mouse_install(m):
    move_mouse_absolute(1860, 92)(m)
    ctrl.mouse_click(pos=(None, None), button=0, times=1)
    sleep(0.3)
    press('down')
    sleep(0.3)
    press('down')
    sleep(0.3)
    press('down')
Ejemplo n.º 21
0
def on_pop(active):
    """Defines behavior for pop noises"""
    if gaze_job or scroll_job:
        if setting_mouse_enable_pop_stops_scroll.get() >= 1:
            stop_scroll()
    elif (not eye_zoom_mouse.zoom_mouse.enabled
          and eye_mouse.mouse.attached_tracker is not None):
        if setting_mouse_enable_pop_click.get() >= 1:
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 22
0
def on_pop(active):
    print('we got here')
    if (gaze_job or scroll_job):
        if setting_mouse_enable_pop_stops_scroll.get() >= 1:
            stop_scroll()
    #elif not eye_zoom_mouse.zoom_mouse.enabled and eye_mouse.mouse.attached_tracker is not None:
    else:
        if setting_mouse_enable_pop_click.get() >= 1:
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 23
0
 def mouse_drag():
     """(TEMPORARY) Press and hold/release button 0 depending on state for dragging"""
     if 1 not in ctrl.mouse_buttons_down():
         # print("start drag...")
         ctrl.mouse_click(button=0, down=True)
         # app.notify("drag started")
     else:
         # print("end drag...")
         ctrl.mouse_click(button=0, up=True)
    def on_pop(self, noise):
        if len(mouse.eye_hist) < 2:
            return
        if noise != 'hiss_start':
            return
        now = time.time()
        if self.state == STATE_IDLE:
            if now - self.last_click < config.double_click:
                ctrl.mouse_click(hold=32000)
                return

            l, r = mouse.eye_hist[-1]
            p = (l.gaze + r.gaze) / 2
            main_gaze = -0.02 < p.x < 1.02 and -0.02 < p.y < 1.02 and bool(
                l or r)
            if not main_gaze:
                pass  # return

            ctrl.cursor_visible(False)

            self.gaze = eye_config.size_px * p
            capture = self.gaze - (config.screen_area / 2)
            capture.x = min(max(capture.x, 0),
                            main_screen.width - config.screen_area.x)
            capture.y = min(max(capture.y, 0),
                            main_screen.height - config.screen_area.y)
            self.rect = (capture.x, capture.y, config.screen_area.x,
                         config.screen_area.y)
            self.pos = self.gaze - (config.screen_area * config.img_scale) / 2
            self.pos.x = min(
                max(self.pos.x, 0),
                main_screen.width - config.screen_area.x * config.img_scale)
            self.pos.y = min(
                max(self.pos.y, 0),
                main_screen.height - config.screen_area.y * config.img_scale)
            self.size = Point2d(config.screen_area.x * config.img_scale,
                                config.screen_area.y * config.img_scale)
            self.off = Point2d(0, 0)

            self.frame = 0
            self.canvas = canvas.Canvas(self.pos.x, self.pos.y, self.size.x,
                                        self.size.y)
            if not config.live:
                self.capture()
            self.canvas.register('draw', self.draw)
            self.state = STATE_OVERLAY
        elif self.state == STATE_OVERLAY:
            self.state = STATE_IDLE
            ctrl.cursor_visible(True)
            self.canvas.unregister('draw', self.draw)
            self.canvas.close()
            self.canvas = None
            dot, origin = self.get_pos()
            if origin:
                ctrl.mouse(origin.x, origin.y)
                ctrl.mouse_click(hold=32000)
                self.last_click = time.time()
Ejemplo n.º 25
0
def on_pop(active):
    if setting_mouse_enable_pop_stops_scroll.get() >= 1 and (gaze_job
                                                             or scroll_job):
        stop_scroll()
    elif (not eye_zoom_mouse.zoom_mouse.enabled
          and eye_mouse.mouse.attached_tracker is not None):
        print("Triggering non-zoom click")
        if setting_mouse_enable_pop_click.get() >= 1:
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 26
0
    def mouse_drag_end():
        """Releases any held mouse buttons"""
        buttons_held_down = list(ctrl.mouse_buttons_down())
        for button in buttons_held_down:
            ctrl.mouse_click(button=button, up=True)

        if (eye_zoom_mouse.zoom_mouse.enabled and
                eye_zoom_mouse.zoom_mouse.state != eye_zoom_mouse.STATE_IDLE):
            eye_zoom_mouse.zoom_mouse.cancel()
Ejemplo n.º 27
0
 def on_move(self, typ, e):
     if typ != tap.MMOVE: return
     self.mouse_last = pos = Point2d(e.x, e.y)
     if self.hiss_start and not self.dragging:
         if (pos - self.mouse_origin).len() > 10:
             self.dragging = True
             self.button = 0
             x, y = self.mouse_origin.x, self.mouse_origin.y
             ctrl.mouse(x, y)
             ctrl.mouse_click(x, y, button=0, down=True)
Ejemplo n.º 28
0
def mouse_click_on_hiss(is_active):
    global start
    print(is_active)
    if is_active:
        start = time()
    elif time() - start > noise_length:
        ctrl.mouse_click()


#noise.register('hiss', mouse_click_on_hiss)
Ejemplo n.º 29
0
    def on_noise(self, noise):
        if eye_zoom_mouse.zoom_mouse.enabled:
            return
        if not eye_mouse.control_mouse.enabled:
            return
        now = time.time()
        # print("{} {}".format(noise, now - self.hiss_last))

        if noise == "pop":
            ctrl.mouse_click(button=0, hold=16000)
Ejemplo n.º 30
0
def delayed_click(m, button=0, times=1, down=None, up=None):
    old = eye.config.control_mouse
    eye.config.control_mouse = False
    x, y = click_pos(m)
    ctrl.mouse(x, y)
    for i in range(times):
        time.sleep(0.016)
        ctrl.mouse_click(x, y, button=button, times=i+1, down=down, up=up)
    time.sleep(0.032)
    eye.config.control_mouse = old