def on_button_press(self, target, event, user_data): if event.button == 3: # First send to background process if handled, do nothing else if (not event.get_state() & Gdk.ModifierType.SHIFT_MASK and Vte.Terminal.do_button_press_event( self.terminal, event)): return True menu = mk_terminal_context_menu( self.terminal, self.get_window(), self.get_settings(), TerminalContextMenuCallbacks( self.terminal, self.get_window(), self.get_settings(), self.get_root_box().get_notebook(), ), ) menu.connect("hide", MenuHideCallback(self.get_window()).on_hide) HidePrevention(self.get_window()).prevent() try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.time) self.terminal.grab_focus() return True self.terminal.grab_focus() return False
def on_button_press(self, target, event, user_data): if event.button == 3: menu = mk_notebook_context_menu(self) menu.connect("hide", MenuHideCallback(self.guake.window).on_hide) try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.time) return False
def on_button_press(self, target, event, user_data): if event.button == 3: menu = mk_notebook_context_menu(self) menu.connect("hide", MenuHideCallback(self.guake.window).on_hide) try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.time) elif event.type == Gdk.EventType.DOUBLE_BUTTON_PRESS and event.button == 1: self.new_page_with_focus() return False
def on_button_press(self, target, event, user_data): if event.button == 3: menu = mk_tab_context_menu(self) menu.connect("hide", MenuHideCallback(self.get_toplevel()).on_hide) HidePrevention(self.get_toplevel()).prevent() try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.get_time()) return True if event.button == 2: prompt_cfg = self.notebook.guake.settings.general.get_int('prompt-on-close-tab') self.notebook.delete_page_by_label(self, prompt=prompt_cfg) return True if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: self.on_rename(None) return False
def on_button_press(self, target, event, user_data): if event.button == 3: menu = mk_tab_context_menu(self) menu.connect("hide", MenuHideCallback(self.get_toplevel()).on_hide) HidePrevention(self.get_toplevel()).prevent() try: menu.popup_at_pointer(event) except AttributeError: # Gtk 3.18 fallback ("'Menu' object has no attribute 'popup_at_pointer'") menu.popup(None, None, None, None, event.button, event.get_time()) self.notebook.get_current_terminal().grab_focus() return True if event.button == 2: self.notebook.delete_page_by_label(self) return True if event.button == 1 and event.type == Gdk.EventType._2BUTTON_PRESS: self.on_rename(None) self.notebook.get_current_terminal().grab_focus() return False