Example #1
0
 def __init__(self):
     #Init the base class
     QtGui.QWidget.__init__(self)
     
     self._depGraph = DotGraph()
     self._pnGraph = DotGraph()
     
     self._dep_view = QtGui.QGraphicsView(self._depGraph)
     self._pn_view = QtGui.QGraphicsView(self._pnGraph)
                  
     pass
Example #2
0
    def __init__(self, dotFile, maxDistance):
        """
        * dotfile -- the path to the dot file to load
        * maxDistance -- the maximum distance from the node to allow

        """
        QtGui.QWidget.__init__(self)
        self.__dotFile = dotFile
        self.__maxDistance = maxDistance

        # Load the graph from the dot file
        self.__graph = DotFileGraph(dotFile)
        self.__dotcode = None

        # Create a layout for the widget
        self.__layout = QtGui.QVBoxLayout()
        self.setLayout(self.__layout)

        # Create the graphics scene and view to display the graph
        self.__scene = QtGui.QGraphicsScene()
        self.__scene.setBackgroundBrush(Qt.white)
        self.__view = QtGui.QGraphicsView()
        self.__view.setScene(self.__scene)
        self.__layout.addWidget(self.__view)

        # Create a slider to change the parent depth
        self.__aboveSlider, self.__aboveLabel = self.__createDistanceSlider(
            "Distance above", self.__graph.getAboveDistance(),
            self.__onAboveDistance)

        # Create a slider to change the child depth
        self.__belowSlider, self.__belowLabel = self.__createDistanceSlider(
            "Distance below", self.__graph.getBelowDistance(),
            self.__onBelowDistance)

        # Create a list to view all nodes
        self.__createNodeListWidget()

        # Generates QT widgets from dot code
        self.__dotToQt = DotToQtGenerator()

        # Do the initial display of the graph
        self.updateGraph()

        self.setGeometry(0, 0, 1000, 600)