def gaze_scroll(): # print("gaze_scroll") if (eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_IDLE ): # or eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_SLEEP: x, y = ctrl.mouse_pos() # the rect for the window containing the mouse rect = None # on windows, check the active_window first since ui.windows() is not z-ordered if app.platform == "windows" and ui.active_window().rect.contains( x, y): rect = ui.active_window().rect else: windows = ui.windows() for w in windows: if w.rect.contains(x, y): rect = w.rect break if rect is None: # print("no window found!") return midpoint = rect.y + rect.height / 2 amount = int(((y - midpoint) / (rect.height / 10))**3) actions.mouse_scroll(by_lines=False, y=amount)
def scroll(): global scroll_amount if (scroll_amount >= 0) == (amount >= 0): scroll_amount += amount else: scroll_amount = amount actions.mouse_scroll(y=int(amount))
def scroll_continuous_helper(): global scroll_amount # print("scroll_continuous_helper") if scroll_amount and ( eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_IDLE ): # or eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_SLEEP): actions.mouse_scroll(by_lines=False, y=int(scroll_amount / 10))
def scroll_by_cursor(): windows = ui.windows() window = None x, y = ctrl.mouse_pos() for w in windows: if w.rect.contains(x, y): window = w.rect break if window is None: return midpoint = window.y + window.height / 2 amount = int(((y - midpoint) / (window.height / 10))**3) actions.mouse_scroll(by_lines=False, y=amount)
def gaze_scroll(): #print("gaze_scroll") if eye_zoom_mouse.zoom_mouse.state == eye_zoom_mouse.STATE_IDLE: windows = ui.windows() window = None x, y = ctrl.mouse_pos() for w in windows: if w.rect.contains(x, y): window = w.rect break if window is None: #print("no window found!") return midpoint = window.y + window.height / 2 amount = int(((y - midpoint) / (window.height / 10))**3) actions.mouse_scroll(by_lines=False, y=amount)
def mouse_scroll_right(amount: float = 1): """Scrolls right""" actions.mouse_scroll( 0, amount * setting_mouse_wheel_horizontal_amount.get())
def mouse_scroll_left(amount: float = 1): """Scrolls left""" actions.mouse_scroll( 0, -amount * setting_mouse_wheel_horizontal_amount.get())
def mouse_scroll_up(): """Scrolls up""" actions.mouse_scroll( by_lines=False, y=-int(ctx.settings["user.mouse_scroll_sensitivity"]))
def mouse_scroll_down(): """Scrolls down""" actions.mouse_scroll( by_lines=False, y=int(ctx.settings["user.mouse_scroll_sensitivity"]))
def mouse_scroll_up(): """Scrolls up""" stop_scrolling() actions.mouse_scroll(by_lines=False, y=-ctx.settings['user.mouse_scroll_sensitivity'])
def start_scrolling(interval: str, speed: int): global active_job stop_scrolling() active_job = cron.interval( interval, lambda: actions.mouse_scroll(by_lines=False, y=speed))
def mouse_scroll_down(): """Scrolls down""" stop_scrolling() actions.mouse_scroll( by_lines=False, y=int(5 * ctx.settings['user.mouse_scroll_sensitivity']))