示例#1
0
 def _nodeContextMenu(self, node):
     e = node.getAttribute("label")
     if self.nodes.has_key(e):
         menu = QtGui.QMenu("Entity " + e, self.view)
         a = menu.addAction("Show graph backward")
         a.connect(Qt.SIGNAL("triggered()"),
                   lambda: self.createGraphBackwardFromEntity(e))
         menu.popup(QtGui.QCursor.pos())
         b = menu.addAction("Show Node Info")
         b.connect(Qt.SIGNAL("triggered()"),
                   lambda: self.getNodeInformation(e))
         menu.popup(QtGui.QCursor.pos())
示例#2
0
    def __init__(self, plugin):
        super(QCPWidget, self).__init__(plugin)
        self.plugin = plugin

        layout = QtGui.QVBoxLayout(self)

        from PythonQt.QCustomPlot import QCustomPlot, QCP
        self.qcpWidget = QCustomPlot()
        self.qcpWidget.autoAddPlottableToLegend = True
        self.qcpWidget.setInteraction(QCP.iRangeDrag, True)  # iRangeDrap
        self.qcpWidget.setInteraction(QCP.iRangeZoom, True)  # iRangeZoom
        self.qcpWidget.setInteraction(QCP.iSelectAxes, True)  # iSelectAxes
        self.qcpWidget.legend().visible = True
        layout.addWidget(self.qcpWidget, 1)
        self.qcpWidget.connect(Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"),
                               self._mouseDoubleClick)
        self.qcpWidget.xAxis().connect(
            Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"),
            self._axesSelectionChanged)
        self.qcpWidget.yAxis().connect(
            Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"),
            self._axesSelectionChanged)

        buttonbar = QtGui.QWidget()
        bbLayout = QtGui.QHBoxLayout(buttonbar)
        button = QtGui.QPushButton("Replot", buttonbar)
        button.connect(QtCore.SIGNAL("clicked()"), self.refreshPlot)
        bbLayout.addWidget(button)
        button = QtGui.QPushButton("Remove", buttonbar)
        button.connect(QtCore.SIGNAL("clicked()"), self.removePlot)
        bbLayout.addWidget(button)
        button = QtGui.QPushButton("Legend", buttonbar)
        button.checkable = True
        button.checked = True
        button.connect(QtCore.SIGNAL("toggled(bool)"), self.toggleLegend)
        bbLayout.addWidget(button)
        button = QtGui.QPushButton(QtGui.QIcon.fromTheme("zoom-fit-best"), "",
                                   buttonbar)
        button.setToolTip("Zoom fit best")
        button.connect(QtCore.SIGNAL("clicked()"), self.qcpWidget.rescaleAxes)
        bbLayout.addWidget(button)

        self.xselect = QtGui.QComboBox(self)
        bbLayout.addWidget(self.xselect, 1)
        layout.addWidget(buttonbar)

        self.data = DataQCP(plugin, self.qcpWidget)
示例#3
0
    def makeRightPane (self, layout):
        from PythonQt.QCustomPlot import QCustomPlot, QCP
        self.qcpWidget = QCustomPlot()
        self.qcpWidget.autoAddPlottableToLegend = True
        self.qcpWidget.setInteraction (QCP.iRangeDrag , True) # iRangeDrap
        self.qcpWidget.setInteraction (QCP.iRangeZoom , True) # iRangeZoom
        self.qcpWidget.setInteraction (QCP.iSelectAxes, True) # iSelectAxes
        self.qcpWidget.legend().visible = True
        layout.addWidget (self.qcpWidget)
        self.qcpWidget.connect (Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"), self._mouseDoubleClick)
        self.qcpWidget.xAxis().connect (Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged)
        self.qcpWidget.yAxis().connect (Qt.SIGNAL("selectionChanged(QCPAxis::SelectableParts)"), self._axesSelectionChanged)

        self.xselect = QtGui.QComboBox(self)
        layout.addWidget (self.xselect)

        # time index is 0 and is value is -1
        self.xselect.addItem ("time", -1)
    def __init__(self, plugin):
        super(Plot, self).__init__(self)
        self.plugin = plugin

        self.qcp = QCustomPlot()
        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.qcp)
        self.qcp.setInteraction(1, True)  # iRangeDrag
        self.qcp.setInteraction(2, True)  # iRangeZoom
        self.qcp.setAutoAddPlottableToLegend(True)
        self.qcp.legend().setVisible(True)
        self.qcp.connect(Qt.SIGNAL("mouseDoubleClick(QMouseEvent*)"),
                         self.doubleClick)

        # The timer user refresh the interface
        self.timer = Qt.QTimer(self)
        self.timer.setSingleShot(False)
        self.timer.setInterval(100)
        self.timer.connect(Qt.SIGNAL("timeout()"), self._step)
示例#5
0
 def _signalContextMenu(self, edge):
     s = edge.getAttribute("xlabel")
     if self.edgesBack.has_key(edge):
         e = self.edges[self.edgesBack[edge]][0]
         menu = QtGui.QMenu("Signal " + e, self.view)
         a = menu.addAction("Toggle display value")
         a.connect(Qt.SIGNAL("triggered()"),
                   lambda: self.plugin.toggleDisplaySignalValue(e, s))
         menu.popup(QtGui.QCursor.pos())
     else:
         print(edge)
    def __init__(self, plugin):
        self.plugin = plugin
        self.graph = QGVScene("graph")
        self.view = QtGui.QGraphicsView(self.graph)
        self.layoutShouldBeFreed = False
        self.graph.connect(Qt.SIGNAL("nodeMouseRelease(QGVNode*)"),
                           self.updateLayout)
        self.graph.connect(Qt.SIGNAL("nodeContextMenu(QGVNode*)"),
                           self._nodeContextMenu)
        self.graph.connect(Qt.SIGNAL("edgeContextMenu(QGVEdge*)"),
                           self._signalContextMenu)

        ### An object returned by re.compile
        self.entityFilter = None
        self.typeCallbacks = {
            "Task": (self._nodeEntityTask, self._edgeEntityTask),
            "SOT": (self._nodeEntitySOT, self._edgeEntitySOT)
        }

        self.initCmd()
        self.createAllGraph()
示例#7
0
    def __init__(self, plugin):
        super(Plot, self).__init__(self)
        self.plugin = plugin

        self.qcp = QCustomPlot()
        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.qcp)
        self.qcp.setInteraction(1, True)  # iRangeDrag
        self.qcp.setInteraction(2, True)  # iRangeZoom
        self.qcp.autoAddPlottableToLegend = True
        self.qcp.legend().visible = True

        self.timer = Qt.QTimer(self)
        self.timer.setSingleShot(False)
        self.timer.setInterval(100)
        self.timer.connect(Qt.SIGNAL("timeout()"), self._step)
示例#8
0
 def _setNextCall (self, f):
     self.timer.disconnect(Qt.SIGNAL("timeout()"))
     self.timer.connect(Qt.SIGNAL("timeout()"), f)