def create_shortcuts(self, parent): """Create shortcuts for this widget""" # Configurable findnext = CONF.config_shortcut(self.find_next, context='find_replace', name='Find next', parent=parent) findprev = CONF.config_shortcut(self.find_previous, context='find_replace', name='Find previous', parent=parent) togglefind = CONF.config_shortcut(self.show, context='find_replace', name='Find text', parent=parent) togglereplace = CONF.config_shortcut(self.show_replace, context='find_replace', name='Replace text', parent=parent) hide = CONF.config_shortcut(self.hide, context='find_replace', name='hide find and replace', parent=self) return [findnext, findprev, togglefind, togglereplace, hide]
def create_shortcuts(self): array_inline = CONF.config_shortcut(lambda: self.enter_array_inline(), context='array_builder', name='enter array inline', parent=self) array_table = CONF.config_shortcut(lambda: self.enter_array_table(), context='array_builder', name='enter array table', parent=self) inspectsc = CONF.config_shortcut(self.inspect_current_object, context='Console', name='Inspect current object', parent=self) clear_line_sc = CONF.config_shortcut( self.clear_line, context='Console', name="Clear line", parent=self, ) clear_shell_sc = CONF.config_shortcut( self.clear_terminal, context='Console', name="Clear shell", parent=self, ) return [ inspectsc, array_inline, array_table, clear_line_sc, clear_shell_sc ]
def setup_toolbar(self): """Setup toolbar""" load_button = create_toolbutton( self, text=_('Import data'), icon=ima.icon('fileimport'), triggered=lambda: self.import_data()) self.save_button = create_toolbutton( self, text=_("Save data"), icon=ima.icon('filesave'), triggered=lambda: self.save_data(self.filename)) self.save_button.setEnabled(False) save_as_button = create_toolbutton( self, text=_("Save data as..."), icon=ima.icon('filesaveas'), triggered=self.save_data) reset_namespace_button = create_toolbutton( self, text=_("Remove all variables"), icon=ima.icon('editdelete'), triggered=self.reset_namespace) self.search_button = create_toolbutton( self, text=_("Search variable names and types"), icon=ima.icon('find'), toggled=self.show_finder) CONF.config_shortcut( lambda: self.show_finder(set_visible=True), context='variable_explorer', name='search', parent=self) self.refresh_button = create_toolbutton( self, text=_("Refresh variables"), icon=ima.icon('refresh'), triggered=self.refresh_table) CONF.config_shortcut( self.refresh_table, context='variable_explorer', name='refresh', parent=self) return [load_button, self.save_button, save_as_button, reset_namespace_button, self.search_button, self.refresh_button]
def create_shortcuts(self): """Create local shortcut for the nsbrowser.""" search = CONF.config_shortcut( lambda: self.show_finder(set_visible=True), context='variable_explorer', name='search', parent=self) refresh = CONF.config_shortcut(self.refresh_table, context='variable_explorer', name='refresh', parent=self) return [search, refresh]
def create_shortcuts(self): array_inline = CONF.config_shortcut(lambda: self.enter_array_inline(), context='array_builder', name='enter array inline', parent=self) array_table = CONF.config_shortcut(lambda: self.enter_array_table(), context='array_builder', name='enter array table', parent=self) inspectsc = CONF.config_shortcut(self.inspect_current_object, context='Console', name='Inspect current object', parent=self) return [inspectsc, array_inline, array_table]
def config_shortcut( self, action: QAction, name: str, parent: QWidget, context: Optional[str] = None) -> Shortcut: """ Create a Shortcut namedtuple for a widget. The data contained in this tuple will be registered in our shortcuts preferences page. Parameters ---------- action: QAction Action that will use the shortcut. name: str Key identifier under which the shortcut is stored. parent: QWidget Parent widget for the shortcut. context: Optional[str] Name of the context (plugin) where the shortcut was defined. Returns ------- shortcut: Shortcut Namedtuple with the information of the shortcut as used for the shortcuts preferences page. """ shortcut_context = self.CONF_SECTION if context is None else context return CONF.config_shortcut(action, shortcut_context, name, parent)
def create_shortcuts(self): """Create shortcuts for this widget.""" copyfig_sc = CONF.config_shortcut(self.copy_figure, context='plots', name='copy', parent=self) prevfig = CONF.config_shortcut(self.go_previous_thumbnail, context='plots', name='previous figure', parent=self) nextfig = CONF.config_shortcut(self.go_next_thumbnail, context='plots', name='next figure', parent=self) savefig_sc = CONF.config_shortcut(self.save_figure, context='plots', name='save', parent=self) saveallfig = CONF.config_shortcut(self.save_all_figures, context='plots', name='save all', parent=self) closefig = CONF.config_shortcut(self.close_figure, context='plots', name='close', parent=self) closeallfig = CONF.config_shortcut(self.close_all_figures, context='plots', name='close all', parent=self) zoom_out = CONF.config_shortcut(self.zoom_out, context='plots', name='zoom out', parent=self) zoom_in = CONF.config_shortcut(self.zoom_in, context='plots', name='zoom in', parent=self) return [ copyfig_sc, prevfig, nextfig, savefig_sc, saveallfig, closefig, closeallfig, zoom_out, zoom_in ]
def __init__(self, parent, model, dtype, shape): QTableView.__init__(self, parent) self.setModel(model) self.setItemDelegate(ArrayDelegate(dtype, self)) total_width = 0 for k in range(shape[1]): total_width += self.columnWidth(k) self.viewport().resize(min(total_width, 1024), self.height()) self.shape = shape self.menu = self.setup_menu() CONF.config_shortcut(self.copy, context='variable_explorer', name='copy', parent=self) self.horizontalScrollBar().valueChanged.connect( self._load_more_columns) self.verticalScrollBar().valueChanged.connect(self._load_more_rows)
def create_shortcuts(self): """Create shortcuts for this widget.""" # Configurable copyfig = CONF.config_shortcut(self.copy_figure, context='plots', name='copy', parent=self) prevfig = CONF.config_shortcut(self.go_previous_thumbnail, context='plots', name='previous figure', parent=self) nextfig = CONF.config_shortcut(self.go_next_thumbnail, context='plots', name='next figure', parent=self) return [copyfig, prevfig, nextfig]
def create_shortcuts(self): """Create shortcuts for ipyconsole.""" inspect = CONF.config_shortcut( self._control.inspect_current_object, context='Console', name='Inspect current object', parent=self) clear_console = CONF.config_shortcut( self.clear_console, context='Console', name='Clear shell', parent=self) restart_kernel = CONF.config_shortcut( self.ipyclient.restart_kernel, context='ipython_console', name='Restart kernel', parent=self) new_tab = CONF.config_shortcut( lambda: self.new_client.emit(), context='ipython_console', name='new tab', parent=self) reset_namespace = CONF.config_shortcut( lambda: self._reset_namespace(), context='ipython_console', name='reset namespace', parent=self) array_inline = CONF.config_shortcut( self._control.enter_array_inline, context='array_builder', name='enter array inline', parent=self) array_table = CONF.config_shortcut( self._control.enter_array_table, context='array_builder', name='enter array table', parent=self) clear_line = CONF.config_shortcut( self.ipyclient.clear_line, context='console', name='clear line', parent=self) return [inspect, clear_console, restart_kernel, new_tab, reset_namespace, array_inline, array_table, clear_line]
def __init__(self, parent, actions=None, menu=None, corner_widgets=None, menu_use_tooltips=False, rename_tabs=False, split_char='', split_index=0): BaseTabs.__init__(self, parent, actions, menu, corner_widgets, menu_use_tooltips) tab_bar = TabBar(self, parent, rename_tabs=rename_tabs, split_char=split_char, split_index=split_index) tab_bar.sig_move_tab.connect(self.move_tab) tab_bar.sig_move_tab[(str, int, int)].connect( self.move_tab_from_another_tabwidget) self.setTabBar(tab_bar) CONF.config_shortcut(lambda: self.tab_navigate(1), context='editor', name='go to next file', parent=parent) CONF.config_shortcut(lambda: self.tab_navigate(-1), context='editor', name='go to previous file', parent=parent) CONF.config_shortcut( lambda: self.sig_close_tab.emit(self.currentIndex()), context='editor', name='close file 1', parent=parent) CONF.config_shortcut( lambda: self.sig_close_tab.emit(self.currentIndex()), context='editor', name='close file 2', parent=parent)