Example #1
0
    def __init__(self, parent, model):
        QTableView.__init__(self, parent)
        self.setModel(model)

        self.frozen_table_view = FrozenTableView(self)
        self.frozen_table_view.update_geometry()

        self.setHorizontalScrollMode(1)
        self.setVerticalScrollMode(1)

        self.horizontalHeader().sectionResized.connect(
            self.update_section_width)
        self.verticalHeader().sectionResized.connect(
            self.update_section_height)

        self.frozen_table_view.verticalScrollBar().valueChanged.connect(
            self.verticalScrollBar().setValue)

        self.sort_old = [None]
        self.header_class = self.horizontalHeader()
        self.header_class.sectionClicked.connect(self.sortByColumn)
        self.menu = self.setup_menu()
        config_shortcut(self.copy,
                        context='variable_explorer',
                        name='copy',
                        parent=self)
        self.horizontalScrollBar().valueChanged.connect(
            lambda val: self.load_more_data(val, columns=True))
        self.verticalScrollBar().valueChanged.connect(
            lambda val: self.load_more_data(val, rows=True))
        self.verticalScrollBar().valueChanged.connect(
            self.frozen_table_view.verticalScrollBar().setValue)
Example #2
0
    def __init__(self, parent, model):
        QTableView.__init__(self, parent)
        self.setModel(model)

        self.frozen_table_view = FrozenTableView(self)
        self.frozen_table_view.update_geometry()

        self.setHorizontalScrollMode(1)
        self.setVerticalScrollMode(1)

        self.horizontalHeader().sectionResized.connect(self.update_section_width)
        self.verticalHeader().sectionResized.connect(self.update_section_height)

        self.frozen_table_view.verticalScrollBar().valueChanged.connect(
            self.verticalScrollBar().setValue)

        self.sort_old = [None]
        self.header_class = self.horizontalHeader()
        self.header_class.sectionClicked.connect(self.sortByColumn)
        self.menu = self.setup_menu()
        config_shortcut(self.copy, context='variable_explorer', name='copy',
                        parent=self)
        self.horizontalScrollBar().valueChanged.connect(
                        lambda val: self.load_more_data(val, columns=True))
        self.verticalScrollBar().valueChanged.connect(
                        lambda val: self.load_more_data(val, rows=True))
        self.verticalScrollBar().valueChanged.connect(
            self.frozen_table_view.verticalScrollBar().setValue)
Example #3
0
    def create_shortcuts(self, parent):
        """Create shortcuts for this widget"""
        # Configurable
        findnext = config_shortcut(self.find_next,
                                   context='_',
                                   name='Find next',
                                   parent=parent)
        findprev = config_shortcut(self.find_previous,
                                   context='_',
                                   name='Find previous',
                                   parent=parent)
        togglefind = config_shortcut(self.show,
                                     context='_',
                                     name='Find text',
                                     parent=parent)
        togglereplace = config_shortcut(self.show_replace,
                                        context='_',
                                        name='Replace text',
                                        parent=parent)
        hide = config_shortcut(self.hide,
                               context='_',
                               name='hide find and replace',
                               parent=self)

        return [findnext, findprev, togglefind, togglereplace, hide]
Example #4
0
    def create_shortcuts(self):
        """Create shortcuts for this widget."""
        # Configurable
        copyfig = config_shortcut(self.copy_figure, context='plots',
                                  name='copy', parent=self)
        prevfig = config_shortcut(self.go_previous_thumbnail, context='plots',
                                  name='previous figure', parent=self)
        nextfig = config_shortcut(self.go_next_thumbnail, context='plots',
                                  name='next figure', parent=self)

        return [copyfig, prevfig, nextfig]
Example #5
0
    def create_shortcuts(self):
        """Create shortcuts for this widget."""
        # Configurable
        copyfig = config_shortcut(self.copy_figure, context='plots',
                                  name='copy', parent=self)
        prevfig = config_shortcut(self.go_previous_thumbnail, context='plots',
                                  name='previous figure', parent=self)
        nextfig = config_shortcut(self.go_next_thumbnail, context='plots',
                                  name='next figure', parent=self)

        return [copyfig, prevfig, nextfig]
Example #6
0
 def create_shortcuts(self):
     array_inline = config_shortcut(lambda: self.enter_array_inline(),
                                    context='array_builder',
                                    name='enter array inline', parent=self)
     array_table = config_shortcut(lambda: self.enter_array_table(),
                                   context='array_builder',
                                   name='enter array table', parent=self)
     inspectsc = config_shortcut(self.inspect_current_object,
                                 context='Console',
                                 name='Inspect current object',
                                 parent=self)
     return [inspectsc, array_inline, array_table]
Example #7
0
 def create_shortcuts(self):
     array_inline = config_shortcut(lambda: self.enter_array_inline(),
                                    context='array_builder',
                                    name='enter array inline', parent=self)
     array_table = config_shortcut(lambda: self.enter_array_table(),
                                   context='array_builder',
                                   name='enter array table', parent=self)
     inspectsc = config_shortcut(self.inspect_current_object,
                                 context='Console',
                                 name='Inspect current object',
                                 parent=self)
     return [inspectsc, array_inline, array_table]
Example #8
0
    def create_shortcuts(self):
        inspect = config_shortcut(
            self._control.inspect_current_object, context="Console", name="Inspect current object", parent=self
        )
        clear_console = config_shortcut(self.clear_console, context="Console", name="Clear shell", parent=self)

        # Fixed shortcuts
        fixed_shortcut("Ctrl+T", self, lambda: self.new_client.emit())
        fixed_shortcut("Ctrl+Alt+R", self, lambda: self.reset_namespace())
        fixed_shortcut(SHORTCUT_INLINE, self, lambda: self._control.enter_array_inline())
        fixed_shortcut(SHORTCUT_TABLE, self, lambda: self._control.enter_array_table())

        return [inspect, clear_console]
Example #9
0
    def create_shortcuts(self):
        """Create shortcuts for ipyconsole."""
        inspect = config_shortcut(self._control.inspect_current_object,
                                  context='Console',
                                  name='Inspect current object', parent=self)
        clear_console = config_shortcut(self.clear_console, context='Console',
                                        name='Clear shell', parent=self)
        restart_kernel = config_shortcut(self.ipyclient.restart_kernel,
                                         context='ipython_console',
                                         name='Restart kernel', parent=self)
        new_tab = config_shortcut(lambda: self.new_client.emit(),
                                  context='ipython_console', name='new tab',
                                  parent=self)
        reset_namespace = config_shortcut(lambda: self._reset_namespace(),
                                          context='ipython_console',
                                          name='reset namespace', parent=self)
        array_inline = config_shortcut(self._control.enter_array_inline,
                                       context='array_builder',
                                       name='enter array inline', parent=self)
        array_table = config_shortcut(self._control.enter_array_table,
                                      context='array_builder',
                                      name='enter array table', parent=self)
        clear_line = 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]
Example #10
0
    def __init__(self,
                 parent,
                 actions=None,
                 menu=None,
                 corner_widgets=None,
                 menu_use_tooltips=False):
        BaseTabs.__init__(self, parent, actions, menu, corner_widgets,
                          menu_use_tooltips)
        tab_bar = TabBar(self, parent)
        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)

        config_shortcut(lambda: self.tab_navigate(1),
                        context='editor',
                        name='go to next file',
                        parent=parent)
        config_shortcut(lambda: self.tab_navigate(-1),
                        context='editor',
                        name='go to previous file',
                        parent=parent)
        config_shortcut(lambda: self.sig_close_tab.emit(self.currentIndex()),
                        context='editor',
                        name='close file 1',
                        parent=parent)
        config_shortcut(lambda: self.sig_close_tab.emit(self.currentIndex()),
                        context='editor',
                        name='close file 2',
                        parent=parent)
Example #11
0
    def create_shortcuts(self):
        """Create shortcuts for ipyconsole."""
        inspect = config_shortcut(self._control.inspect_current_object,
                                  context='Console',
                                  name='Inspect current object', parent=self)
        clear_console = config_shortcut(self.clear_console, context='Console',
                                        name='Clear shell', parent=self)
        restart_kernel = config_shortcut(self.ipyclient.restart_kernel,
                                         context='ipython_console',
                                         name='Restart kernel', parent=self)
        new_tab = config_shortcut(lambda: self.new_client.emit(),
                                  context='ipython_console', name='new tab',
                                  parent=self)
        reset_namespace = config_shortcut(lambda: self._reset_namespace(),
                                          context='ipython_console',
                                          name='reset namespace', parent=self)
        array_inline = config_shortcut(self._control.enter_array_inline,
                                       context='array_builder',
                                       name='enter array inline', parent=self)
        array_table = config_shortcut(self._control.enter_array_table,
                                      context='array_builder',
                                      name='enter array table', parent=self)
        clear_line = 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]
Example #12
0
    def create_shortcuts(self):
        inspect = config_shortcut(self._control.inspect_current_object,
                                  context='Console', name='Inspect current object',
                                  parent=self)
        clear_console = config_shortcut(self.clear_console, context='Console',
                                        name='Clear shell', parent=self)

        # Fixed shortcuts
        fixed_shortcut("Ctrl+T", self, lambda: self.new_client.emit())
        fixed_shortcut("Ctrl+R", self, lambda: self.reset_namespace())
        fixed_shortcut(SHORTCUT_INLINE, self,
                       lambda: self._control.enter_array_inline())
        fixed_shortcut(SHORTCUT_TABLE, self,
                       lambda: self._control.enter_array_table())

        return [inspect, clear_console]
Example #13
0
    def create_shortcuts(self, parent):
        """Create shortcuts for this widget"""
        # Configurable
        findnext = config_shortcut(self.find_next, context='_',
                                   name='Find next', parent=parent)
        findprev = config_shortcut(self.find_previous, context='_',
                                   name='Find previous', parent=parent)
        togglefind = config_shortcut(self.show, context='_',
                                     name='Find text', parent=parent)
        togglereplace = config_shortcut(self.show_replace,
                                        context='_', name='Replace text',
                                        parent=parent)
        hide = config_shortcut(self.hide, context='_', name='hide find and replace',
                               parent=self)

        return [findnext, findprev, togglefind, togglereplace, hide]
Example #14
0
    def create_shortcuts(self, parent):
        """Create shortcuts for this widget"""
        # Configurable
        findnext = config_shortcut(self.find_next, context='_',
                                   name='Find next', parent=parent)
        findprev = config_shortcut(self.find_previous, context='_',
                                   name='Find previous', parent=parent)
        togglefind = config_shortcut(self.show, context='_',
                                     name='Find text', parent=parent)
        togglereplace = config_shortcut(self.toggle_replace_widgets,
                                        context='_', name='Replace text',
                                        parent=parent)
        # Fixed
        fixed_shortcut("Escape", self, self.hide)

        return [findnext, findprev, togglefind, togglereplace]
Example #15
0
    def __init__(self, parent, model):
        QTableView.__init__(self, parent)
        self.setModel(model)

        self.sort_old = [None]
        self.header_class = self.horizontalHeader()
        self.header_class.sectionClicked.connect(self.sortByColumn)
        self.menu = self.setup_menu()
        config_shortcut(self.copy,
                        context='variable_explorer',
                        name='copy',
                        parent=self)
        self.horizontalScrollBar().valueChanged.connect(
            lambda val: self.load_more_data(val, columns=True))
        self.verticalScrollBar().valueChanged.connect(
            lambda val: self.load_more_data(val, rows=True))
Example #16
0
    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()
        config_shortcut(self.copy, context='variable_explorer', name='copy',
                        parent=self)
        self.horizontalScrollBar().valueChanged.connect(
                            lambda val: self.load_more_data(val, columns=True))
        self.verticalScrollBar().valueChanged.connect(
                               lambda val: self.load_more_data(val, rows=True))
Example #17
0
    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()
        config_shortcut(self.copy, context='variable_explorer', name='copy',
                        parent=self)
        self.horizontalScrollBar().valueChanged.connect(
                            lambda val: self.load_more_data(val, columns=True))
        self.verticalScrollBar().valueChanged.connect(
                               lambda val: self.load_more_data(val, rows=True))
Example #18
0
 def create_shortcuts(self):
     fixed_shortcut(SHORTCUT_INLINE, self, lambda: self.enter_array_inline())
     fixed_shortcut(SHORTCUT_TABLE, self, lambda: self.enter_array_table())
     inspectsc = config_shortcut(self.inspect_current_object,
                                 context='Console',
                                 name='Inspect current object',
                                 parent=self)
     return [inspectsc]
Example #19
0
 def create_shortcuts(self):
     fixed_shortcut(SHORTCUT_INLINE, self,
                    lambda: self.enter_array_inline())
     fixed_shortcut(SHORTCUT_TABLE, self, lambda: self.enter_array_table())
     inspectsc = config_shortcut(self.inspect_current_object,
                                 context='Console',
                                 name='Inspect current object',
                                 parent=self)
     return [inspectsc]
Example #20
0
    def create_shortcuts(self):
        """Create shortcuts for this widget."""
        # Configurable
        copyfig = config_shortcut(self.copy_figure,
                                  context='plots',
                                  name='copy',
                                  parent=self)

        return [copyfig]
Example #21
0
    def create_shortcuts(self):
        inspect = config_shortcut(self._control.inspect_current_object,
                                  context='Console',
                                  name='Inspect current object',
                                  parent=self)
        clear_console = config_shortcut(self.clear_console,
                                        context='Console',
                                        name='Clear shell',
                                        parent=self)
        new_tab = config_shortcut(lambda: self.new_client.emit(),
                                  context='ipython_console',
                                  name='new tab',
                                  parent=self)
        reset_namespace = config_shortcut(lambda: self.reset_namespace(),
                                          context='ipython_console',
                                          name='reset namespace',
                                          parent=self)
        array_inline = config_shortcut(lambda: self.enter_array_inline(),
                                       context='array_builder',
                                       name='enter array inline',
                                       parent=self)
        array_table = config_shortcut(lambda: self.enter_array_table(),
                                      context='array_builder',
                                      name='enter array table',
                                      parent=self)

        return [
            inspect, clear_console, new_tab, reset_namespace, array_inline,
            array_table
        ]
Example #22
0
    def create_shortcuts(self, parent):
        """Create shortcuts for this widget"""
        # Configurable
        findnext = config_shortcut(self.find_next,
                                   context='_',
                                   name='Find next',
                                   parent=parent)
        findprev = config_shortcut(self.find_previous,
                                   context='_',
                                   name='Find previous',
                                   parent=parent)
        togglefind = config_shortcut(self.show,
                                     context='_',
                                     name='Find text',
                                     parent=parent)
        togglereplace = config_shortcut(self.toggle_replace_widgets,
                                        context='_',
                                        name='Replace text',
                                        parent=parent)
        # Fixed
        fixed_shortcut("Escape", self, self.hide)

        return [findnext, findprev, togglefind, togglereplace]
Example #23
0
    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)
        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)
        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]
Example #24
0
    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)

        config_shortcut(lambda: self.tab_navigate(1), context='editor',
                        name='go to next file', parent=parent)
        config_shortcut(lambda: self.tab_navigate(-1), context='editor',
                        name='go to previous file', parent=parent)
        config_shortcut(lambda: self.sig_close_tab.emit(self.currentIndex()),
                        context='editor', name='close file 1', parent=parent)
        config_shortcut(lambda: self.sig_close_tab.emit(self.currentIndex()),
                        context='editor', name='close file 2', parent=parent)