Esempio n. 1
0
 def __iter__(self):
     cur = gv.firstedge(self.parent.handle)
     while gv.ok(cur):
         yield (decode_page(gv.nameof(gv.tailof(cur))), 
                decode_page(gv.nameof(gv.headof(cur)))), \
                dict(self.graph._iterattrs(cur))
         cur = gv.nextedge(self.parent.handle, cur)
Esempio n. 2
0
 def __iter__(self):
     """ Iterates over item attributes. """
     attr = gv.firstattr(self.handle)
     while gv.ok(attr):
         yield gv.nameof(attr), \
             decode_page(gv.getv(self.handle, attr))
         attr = gv.nextattr(self.handle, attr)
Esempio n. 3
0
 def __iter__(self):
     """ Iterate over all items, yielding Graphviz.<type> items
     """
     handle = self.parent.handle
     cur = getattr(gv, "first%s" % self.type)(handle)
     nextitem = getattr(gv, "next%s" % self.type)
     while gv.ok(cur):
         yield self.get(gv.nameof(cur))
         cur = nextitem(handle, cur)
Esempio n. 4
0
    def _iterattrs(self, handle=""):
        """ Iterate over the attributes of a graph item.

        If no handle attribute is given, iterates over the attributes
        of the root graph
        """
        if not handle:
            handle = self.handle
        attr = gv.firstattr(handle)
        while gv.ok(attr):
            yield gv.nameof(attr), decode_page(gv.getv(handle, attr))
            attr = gv.nextattr(handle, attr)
Esempio n. 5
0
 def __str__(self):
     return "(u'" + decode_page(gv.nameof(gv.tailof(self.handle))) + \
            "', u'" + decode_page(gv.nameof(gv.headof(self.handle))) + "')"
Esempio n. 6
0
 def __str__(self):
     """ Returns item name. """
     return "u'" + decode_page(gv.nameof(self.handle)) + "'"