(self, widget, event)
return False
Handler for modifier + mouse wheel scroll events
Handler for modifier + mouse wheel scroll events
Handler for modifier + mouse wheel scroll events
def on_mousewheel(self, widget, event):
        """Handler for modifier + mouse wheel scroll events"""
        SMOOTH_SCROLL_UP = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y <= 0.
        SMOOTH_SCROLL_DOWN = event.direction == Gdk.ScrollDirection.SMOOTH and event.delta_y > 0.
        if event.state & Gdk.ModifierType.CONTROL_MASK == Gdk.ModifierType.CONTROL_MASK:
            # Zoom the terminal(s) in or out if not disabled in config
            if self.config["disable_mousewheel_zoom"] is True:
                return False
            # Choice of target terminals depends on Shift and Super modifiers
            if event.state & Gdk.ModifierType.MOD4_MASK == Gdk.ModifierType.MOD4_MASK:
                targets = self.terminator.terminals
            elif event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK:
                targets = self.terminator.get_target_terms(self)
            else:
                targets = [self]
            if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:
                for target in targets:
                    target.zoom_in()
                return True
            elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN:
                for target in targets:
                    target.zoom_out()
                return True
        if event.state & Gdk.ModifierType.SHIFT_MASK == Gdk.ModifierType.SHIFT_MASK:
            # Shift + mouse wheel up/down
            if event.direction == Gdk.ScrollDirection.UP or SMOOTH_SCROLL_UP:
                self.scroll_by_page(-1)
                return True
            elif event.direction == Gdk.ScrollDirection.DOWN or SMOOTH_SCROLL_DOWN:
                self.scroll_by_page(1)
                return True
        return False
def on_mousewheel ( self , widget , event ) : SMOOTH_SCROLL_UP = event . direction == Gdk . ScrollDirection . SMOOTH and event . delta_y <= 0. SMOOTH_SCROLL_DOWN = event . direction == Gdk . ScrollDirection . SMOOTH and event . delta_y > 0. if event . state & Gdk . ModifierType . CONTROL_MASK == Gdk . ModifierType . CONTROL_MASK : # Zoom the terminal(s) in or out if not disabled in config if self . config [ "disable_mousewheel_zoom" ] is True : return False # Choice of target terminals depends on Shift and Super modifiers if event . state & Gdk . ModifierType . MOD4_MASK == Gdk . ModifierType . MOD4_MASK : targets = self . terminator . terminals elif event . state & Gdk . ModifierType . SHIFT_MASK == Gdk . ModifierType . SHIFT_MASK : targets = self . terminator . get_target_terms ( self ) else : targets = [ self ] if event . direction == Gdk . ScrollDirection . UP or SMOOTH_SCROLL_UP : for target in targets : target . zoom_in ( ) return True elif event . direction == Gdk . ScrollDirection . DOWN or SMOOTH_SCROLL_DOWN : for target in targets : target . zoom_out ( ) return True if event . state & Gdk . ModifierType . SHIFT_MASK == Gdk . ModifierType . SHIFT_MASK : # Shift + mouse wheel up/down if event . direction == Gdk . ScrollDirection . UP or SMOOTH_SCROLL_UP : self . scroll_by_page ( - 1 ) return True elif event . direction == Gdk . ScrollDirection . DOWN or SMOOTH_SCROLL_DOWN : self . scroll_by_page ( 1 ) return True return False