예제 #1
0
    def __init__(self, tab_bar, source_finder, parent=None):
        figure = Figure(figsize=(3,3), dpi=72)
        FigureCanvas.__init__(self, figure, parent)
        BaseTabViewWidget.__init__(self, parent, init=False)

        self.figure = figure
        self.plots = []
        self.tab_bar = tab_bar
        self.timescale = 30
        self.find_source = source_finder

        #General plan for actions:
        #Plot specific actions are dispatched through the contextMenuEvent
        #handler which finds the selected plot using get_axes_at_point
        #and then generates a context menu with actions bound to the specific
        #plot. Generic non-plot-specific actions like adjusting the timescale
        #and renaming the tab are bound to the tab view and the tab widget
        #respectively.
        self.timescale_action = QtGui.QAction("Adjust timescale", self)
        self.addAction(self.timescale_action)

        link(self.timescale_action.triggered, self.adjust_timescale)
        FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,
                                         QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
        self.setContextMenuPolicy(QtCore.Qt.DefaultContextMenu)
        self.setAcceptDrops(True)
예제 #2
0
    def __init__(self, desc_map, connection, parent=None):
        figure = Figure(figsize=(3,3), dpi=72)
        FigureCanvas.__init__(self, figure, parent)

        self.figure = figure
        self.connection = connection
        self.desc_map = desc_map
        
        self.start = datetime.datetime.utcnow()
        self.end = datetime.datetime.utcnow()

        self.adjust_signals_action = QtGui.QAction("Adjust signals plotted", self)
        self.addAction(self.adjust_signals_action)
        

        self.views = {}
        self.autoscale = True
        self.showing_dialog = False

        FigureCanvas.setSizePolicy(self, QtGui.QSizePolicy.Expanding,
                                         QtGui.QSizePolicy.Expanding)
        FigureCanvas.updateGeometry(self)
        
        self.plot = self.figure.add_subplot(111)
        self.setAcceptDrops(True)

        link(self.adjust_signals_action.triggered, self.adjust_signals)