#encoding: utf-8 import dia def test(data, flags): classes = [] layer = dia.active_display().diagram.data.layers[0] for obj in layer.objects: if obj.type.name == "UML - Class": print "\nobject", obj for attr in obj.properties['attributes'].value: # attr is a tuple, len(attr) == 9 # left_connection: attr[7] -> ConnectionPoint # right_connection: attr[8] -> ConnectionPoint if attr[7].connected: print "\t %s left: connected to %s" % (attr[0], attr[7].connected) if attr[8].connected: print "\t %s right: connected to %s" % (attr[0], attr[8].connected) classes.append(obj) dia.register_callback("Test", "/Dialogs/Test", test)