def _configure_accelerators(self): """Configure accelerator group""" group = AcceleratorGroup(self._parent) keyval = gtk.gdk.keyval_from_name # give parent chance to register its own accelerator group PluginBase._configure_accelerators(self) # modify plugin accelerator group so we can have terminal auto-complete with tab plugin_group = self._accelerator_groups[0] plugin_group.disable_accelerator('focus_opposite_object') plugin_group.disable_accelerator('close_tab') # configure accelerator group group.set_name('terminal') group.set_title(_('Terminal')) # add all methods to group group.add_method('create_terminal', _('Create terminal tab'), self._create_terminal) group.add_method('copy_to_clipboard', _('Copy selection to clipboard'), self._copy_selection) group.add_method('paste_from_clipboard', _('Paste from clipboard'), self._paste_selection) group.add_method('focus_opposite_object', _('Focus opposite object'), self._parent.focus_opposite_object) group.add_method('close_tab', _('Close tab'), self._close_tab) # configure accelerators group.set_accelerator('create_terminal', keyval('z'), gtk.gdk.CONTROL_MASK) group.set_accelerator('copy_to_clipboard', keyval('c'), gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK) group.set_accelerator('paste_from_clipboard', keyval('v'), gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK) group.set_accelerator('focus_opposite_object', keyval('Tab'), gtk.gdk.CONTROL_MASK | gtk.gdk.MOD1_MASK) group.set_accelerator('close_tab', keyval('w'), gtk.gdk.CONTROL_MASK) # add accelerator group to the list self._accelerator_groups.append(group)
def _configure_accelerators(self): """Configure accelerator group""" group = AcceleratorGroup(self._parent) keyval = gtk.gdk.keyval_from_name # configure accelerator group group.set_name('plugin_base') group.set_title(_('Plugin Base')) # add all methods to group group.add_method('focus_opposite_object', _('Focus opposite object'), self._parent.focus_opposite_object) group.add_method('next_tab', _('Next tab'), self._notebook_next_tab) group.add_method('previous_tab', _('Previous tab'), self._notebook_previous_tab) group.add_method('duplicate_tab', _('Duplicate tab'), self._duplicate_tab) group.add_method('close_tab', _('Close tab'), self._close_tab) group.add_method('focus_command_entry', _('Focus command entry'), self._focus_command_entry) group.add_method('focus_left_object', _('Focus left object'), self._focus_left_object) group.add_method('focus_right_object', _('Focus right object'), self._focus_right_object) # configure accelerators group.set_accelerator('focus_opposite_object', keyval('Tab'), 0) group.set_accelerator('next_tab', keyval('Tab'), gtk.gdk.CONTROL_MASK) group.set_accelerator('previous_tab', keyval('Tab'), gtk.gdk.CONTROL_MASK | gtk.gdk.SHIFT_MASK) group.set_accelerator('duplicate_tab', keyval('t'), gtk.gdk.CONTROL_MASK) group.set_accelerator('close_tab', keyval('w'), gtk.gdk.CONTROL_MASK) group.set_accelerator('focus_command_entry', keyval('Down'), gtk.gdk.MOD1_MASK) group.set_accelerator('focus_left_object', keyval('Left'), gtk.gdk.MOD1_MASK) group.set_accelerator('focus_right_object', keyval('Right'), gtk.gdk.MOD1_MASK) # add accelerator group to the list self._accelerator_groups.append(group)