コード例 #1
0
ファイル: LiveGraph.py プロジェクト: kagelump/calsol
    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
ファイル: HistGraph.py プロジェクト: kagelump/calsol
    def __init__(self, tab_bar, desc_sets, connection, parent=None):
        BaseTabViewWidget.__init__(self, parent)

        self.tab_bar = tab_bar
        self.connection = connection

        desc_map = {}
        for fname, desc_set in desc_sets:
            for id_, descr in desc_set.items():
                for [name, units, desc] in descr.get("messages", []):
                    desc_map[id_+":"+name] = descr
        
        self.plotWidget = HistoricalPlot(desc_map, connection, self)
        self.controlWidget = ControlWidget(self.plotWidget, parent=self)
        self.layout = QtGui.QVBoxLayout(self)
        self.layout.addWidget(self.plotWidget)
        self.layout.addWidget(self.controlWidget)
        self.setLayout(self.layout)
コード例 #3
0
ファイル: LiveGraph.py プロジェクト: kagelump/calsol
 def json_friendly(self):
     "Serializes to a json-friendly data-structure. Adds timescale and plot info"
     json = BaseTabViewWidget.json_friendly(self)
     json["timescale"] = self.timescale
     json["plots"] = [plot.json_friendly() for plot in self.plots]
     return json
コード例 #4
0
ファイル: HistGraph.py プロジェクト: kagelump/calsol
 def json_friendly(self):
     json = BaseTabViewWidget.json_friendly(self)
     self.plotWidget.add_json(json)
     return json