예제 #1
0
    def test_parsing_cluster_graph(self):
        """ Test parsing of a graph with nested clusters.
        """
        parser = GodotDataParser()
        graph = parser.parse_dot_file(SIMPLE_GRAPH)
#        self.failUnless(graph.name == "testG")
        graph.configure_traits()
예제 #2
0
 def test_parsing_cluster_graph(self):
     """ Test parsing of a graph with nested clusters.
     """
     parser = GodotDataParser()
     graph = parser.parse_dot_file(SIMPLE_GRAPH)
     #        self.failUnless(graph.name == "testG")
     graph.configure_traits()
예제 #3
0
 def _parse_dot_code_fired(self):
     """ Parses the dot_code string and replaces the existing model.
     """
     parser = GodotDataParser()
     graph  = parser.parse_dot_data(self.dot_code)
     if graph is not None:
         self.model = graph
예제 #4
0
    def open_file(self, info):
        """ Handles the open action. """

        if not info.initialized: return # Escape.

#        retval = self.edit_traits(parent=info.ui.control, view="file_view")

        dlg = FileDialog( action = "open",
            wildcard = "Graphviz Files (*.dot, *.xdot, *.txt)|"
                "*.dot;*.xdot;*.txt|Dot Files (*.dot)|*.dot|"
                "All Files (*.*)|*.*|")

        if dlg.open() == OK:
            parser = GodotDataParser()
            model = parser.parse_dot_file(dlg.path)
            if model is not None:
                self.model = model
            else:
                print "error parsing: %s" % dlg.path

            self.save_file = dlg.path

        del dlg