def on_add_term(self, term):
        box = gui.Box(self.box, 'vertical', expand=True, stretch=0)
        bpx = gui.Box(box, 'horizontal', expand=True, stretch=0)
        term._butt = gui.Button(bpx, term.name, toggle=True)
        term._butt.connect('toggled', lambda on: self.on_toggled(term, on),
                           True)
        term._butt.connect('double-clicked',
                           lambda: self.on_btn_doubleclicked(term), True)
        t = gui.Toolbar(bpx, expand=False, stretch=0)
        term._act = gui.Command('x',
                                '',
                                lambda checked: self.on_use(term, checked),
                                '16/down.png',
                                type='check')
        t.append(term._act)
        t.append(gui.Command('x', '', lambda: self.on_close(term),
                             'close.png'))
        t._widget.Realize()
        term._box = box
        term._tx = None

        self.create_parambox(term)
        if sum((hasattr(t, '_butt') and t._butt.state)
               for t in self.function.terms) == 0:
            self.function.terms[0]._butt.state = True
            self.graph.selected_function = self.function.terms[0]

        term._act.state = True
    def __init__(self, graph, view, parent, **place):
        gui.Box.__init__(self, parent, 'vertical', **place)

        self.graph = graph
        self.view = view

        self.project = graph.project
        self.folder = None

        self.toolbar = gui.Toolbar(self, stretch=0)
        gui.Label(self, 'Worksheet', stretch=0)
        self.toolbar.append(
            gui.Command('Add', 'Add datasets to the graph', self.on_add,
                        'add.png'))
        self.toolbar.append(
            gui.Command('Remove', 'Remove datasets from the graph',
                        self.on_remove, 'remove.png'))
        self.toolbar._widget.Realize()

        self.worksheet_list = gui.List(self,
                                       editable=False,
                                       model=WorksheetListModel(
                                           self.project.top))
        #        self.worksheet_list.connect('item-activated', self.on_wslist_activated)
        self.worksheet_list.connect('selection-changed', self.on_wslist_select)
        self.worksheet_list.connect('item-activated', self.on_item_activated)

        gui.Label(self, 'X column', stretch=0)
        self.x_list = gui.List(self, model=ColumnListModel())

        gui.Label(self, 'Y column', stretch=0)
        self.y_list = gui.List(self, model=ColumnListModel())
Beispiel #3
0
 def on_right_clicked(self, row, col):
     menu = gui.Menu()
     menu.append(gui.Command('Set value', 'setvalue', self.on_set_value, 'stock_edit.png'))
     menu.append(gui.Command('Insert row', 'insert', self.on_insert, 'table-insert-row.png'))
     menu.append(gui.Command('Delete', 'delete', self.on_set_value, 'stock_delete.png'))
     self.clickcell = row, col
     self.table._widget.PopupMenu(menu._menu)
 def on_legend_right_click(self, item):
     if item == -1:
         return
     item = self.legend.model[item]
     menu = gui.Menu()
     menu.append(gui.Command('Hide', '', object))
     menu.append(gui.Command('Show', '', object))
     menu.append(gui.Command('Show Only', '', object))
     menu.append(None)
     menu.append(gui.Command('Remove', '', object))
     menu.append(None)
     menu.append(gui.Command('Select All', '', object))
     self.legend._widget.PopupMenu(menu._menu)
Beispiel #5
0
    def __init__(self, parent, worksheet, **place):
        gui.Box.__init__(self, parent, 'horizontal', **place)

        self.worksheet = worksheet
        self.toolbar = gui.Toolbar(self, orientation='vertical', stretch=0)

        self.toolbar.append(gui.Command('New column', 'Create a new column', 
                                       self.on_new_column, 'stock_insert-columns.png'))
        self.toolbar.append(gui.Command('Insert row', 'Insert row', 
                                       self.on_insert, 'table-insert-row.png'))
        self.toolbar.append(gui.Command('Delete column', 'Delete a column', 
                                       self.on_new_column, 'stock_delete-column.png'))

        self.toolbar.append(None)

        self.toolbar.append(gui.Command('Move left', 'Move columns to the left', 
                                       self.on_move_left, '16/left.png'))
        self.toolbar.append(gui.Command('Move right', 'Move columns to the right', 
                                       self.on_move_right, '16/right.png'))
        self.toolbar.append(gui.Command('Move to first', '', 
                                       self.on_move_first, '16/first.png'))
        self.toolbar.append(gui.Command('Move to last', '', 
                                       self.on_move_last, '16/last.png'))

        self.table = gui.Table(self, TableData(self.worksheet))
        self.table.connect('right-clicked', self.on_right_clicked)
        self.table.connect('double-clicked', self.on_double_clicked)

        self.table._widget.DisableDragRowSize()

        self.object = self.worksheet
        self.worksheet.connect('rename', self.on_rename)
    def __init__(self, func, graph, parent, **place):
        gui.Box.__init__(self, parent, 'vertical', **place)
        self.graph = graph
        self.toolbar = gui.Toolbar(self, stretch=0)

        self.scroll = gui.Scrolled(self)
        self.box = gui.Box(self.scroll, 'vertical')
        self.toolbar.append(
            gui.Command('Add term', '', self.do_add, 'function.png'))
        self.toolbar.append(
            gui.Command('Fit properties', '', self.do_configure,
                        'properties.png'))
        self.toolbar.append(gui.Command('Fit', '', self.do_fit,
                                        'manibela.png'))
        self.toolbar.append(
            gui.Command('Save parameters', '', self.do_fit, 'pencil.png'))
        self.toolbar._widget.Realize()

        self.set_function(func)
    def __init__(self, parent, graph, **place):
        gui.Box.__init__(self, parent, 'horizontal', **place)
        self.graph = graph

        tbbox = gui.Box(self, 'horizontal', stretch=0)

        def set_graph_mode(mode):
            def _set():
                self.graph.prev_mode = self.graph.mode
                self.graph.mode = mode

                cur = {
                    'arrow': wx.CURSOR_ARROW,
                    'hand': wx.CURSOR_HAND,
                    'zoom': wx.CURSOR_MAGNIFIER,
                    'range': wx.CURSOR_SIZEWE,
                    'd-reader': wx.CURSOR_CROSS,
                    's-reader': wx.CURSOR_CROSS,
                    'draw-text': wx.CURSOR_IBEAM,
                    'draw-line': wx.CURSOR_PENCIL,
                    'none': wx.CURSOR_NONE
                }[mode]
                self.glwidget._widget.SetCursor(wx.StockCursor(cur))
                self.graph.emit('redraw')

            return _set

        graph.show()

        self.toolbar = gui.Toolbar(tbbox, orientation='vertical', stretch=1)
        self.toolbar.append(
            gui.Command('Arrow',
                        '',
                        set_graph_mode('arrow'),
                        'arrow.png',
                        type='radio'))
        self.toolbar.append(
            gui.Command('Hand',
                        '',
                        set_graph_mode('hand'),
                        'hand.png',
                        type='radio'))
        self.toolbar.append(
            gui.Command('Zoom',
                        '',
                        set_graph_mode('zoom'),
                        'zoom.png',
                        type='radio'))
        self.toolbar.append(
            gui.Command('Range',
                        '',
                        set_graph_mode('range'),
                        'range.png',
                        type='radio'))
        self.toolbar.append(
            gui.Command('Data reader',
                        '',
                        set_graph_mode('d-reader'),
                        'dreader.png',
                        type='radio'))
        self.toolbar.append(
            gui.Command('Screen reader',
                        '',
                        set_graph_mode('s-reader'),
                        'sreader.png',
                        type='radio'))
        self.toolbar.append(None)
        self.toolbar.append(
            gui.Command('Line', '', set_graph_mode('draw-line'),
                        'stock_draw-line.png'))
        self.toolbar.append(
            gui.Command('Text', '', set_graph_mode('draw-text'),
                        'stock_draw-text.png'))
        self.toolbar.append(None)
        self.toolbar.append(
            gui.Command('Select all datasets', '', self.on_selectall,
                        'stock_select-all.png'))

        self.toolbar._widget.Realize()

        #        self.closebar = gui.Toolbar(tbbox, stretch=0)
        #        self.closebar.append(gui.Command('Close', 'Close this worksheet',
        #                                        self.on_close, 'close.png'))
        #        self.closebar._widget.Realize()

        self.panel = gui.MainPanel(self)
        self.box = gui.Splitter(self.panel, 'vertical', proportion=0.8)
        self.scrolled = gui.Scrolled(self.box)
        self.glwidget = gui.OpenGLWidget(self.scrolled)
        self.glwidget.min_size = (400, 200)

        self.glwidget.connect('initialize-gl', self.graph.init)
        self.glwidget.connect('resize-gl', self.graph.reshape)
        self.glwidget.connect('paint-gl', self.graph.display)
        self.glwidget.connect('button-pressed', self.graph.button_press)
        self.glwidget.connect('button-released', self.graph.button_release)
        self.glwidget.connect('button-doubleclicked',
                              self.graph.button_doubleclick)
        self.glwidget.connect('mouse-moved', self.graph.button_motion)
        self.glwidget.connect('key-down', self.graph.key_down)

        self.graph.connect('redraw', self.glwidget.redraw)
        self.graph.connect('object-doubleclicked',
                           self.on_object_doubleclicked)
        self.graph.connect('right-clicked', self.on_right_clicked)

        self.legend = gui.List(self.box,
                               model=LegendModel(self.graph))  #, stretch=0)
        self.legend.connect('selection-changed', self.on_legend_select)

        self.graphdata = GraphDataPanel(self.graph,
                                        self,
                                        self.panel.right_panel,
                                        page_label='Data',
                                        page_pixmap='worksheet.png')
        self.style = GraphStylePanel(self.graph,
                                     self,
                                     self.panel.right_panel,
                                     page_label='Style',
                                     page_pixmap='style.png')
        self.axes = GraphAxesPanel(self.graph,
                                   self,
                                   self.panel.right_panel,
                                   page_label='Axes',
                                   page_pixmap='axes.png')
        self.fit = GraphFunctionsPanel(self.graph.functions[0].func,
                                       self.graph,
                                       self.panel.right_panel,
                                       page_label='Fit',
                                       page_pixmap='function.png')
        self.panel.right_panel._widget.toolbar.Realize()

        self.graph.connect('request-cursor', self.on_request_cursor)

        self.object = self.graph
        self.graph.connect('rename', self.on_rename)
        self.legend.connect('right-click', self.on_legend_right_click)
 def on_right_clicked(self, obj):
     print >> sys.stderr, obj
     menu = gui.Menu()
     menu.append(gui.Command('Delete', 'delete', object, 'open.png'))
     self.glwidget.parent.parent._widget.PopupMenu(menu._menu)