equal
deleted
inserted
replaced
644 class CWSchemaDotPropsHandler(s2d.SchemaDotPropsHandler): |
644 class CWSchemaDotPropsHandler(s2d.SchemaDotPropsHandler): |
645 def __init__(self, visitor): |
645 def __init__(self, visitor): |
646 self.visitor = visitor |
646 self.visitor = visitor |
647 self.nextcolor = cycle( ('#ff7700', '#000000', |
647 self.nextcolor = cycle( ('#ff7700', '#000000', |
648 '#ebbc69', '#888888') ).next |
648 '#ebbc69', '#888888') ).next |
|
649 self.colors = {} |
649 |
650 |
650 def node_properties(self, eschema): |
651 def node_properties(self, eschema): |
651 """return DOT drawing options for an entity schema include href""" |
652 """return DOT drawing options for an entity schema include href""" |
652 label = ['{',eschema.type,'|'] |
653 label = ['{',eschema.type,'|'] |
653 label.append(r'\l'.join('%s (%s)' % (rel.type, eschema.rdef(rel.type).object) |
654 label.append(r'\l'.join('%s (%s)' % (rel.type, eschema.rdef(rel.type).object) |
686 # UML like cardinalities notation, omitting 1..1 |
687 # UML like cardinalities notation, omitting 1..1 |
687 if rdef.cardinality[1] != '1': |
688 if rdef.cardinality[1] != '1': |
688 kwargs['taillabel'] = s2d.CARD_MAP[rdef.cardinality[1]] |
689 kwargs['taillabel'] = s2d.CARD_MAP[rdef.cardinality[1]] |
689 if rdef.cardinality[0] != '1': |
690 if rdef.cardinality[0] != '1': |
690 kwargs['headlabel'] = s2d.CARD_MAP[rdef.cardinality[0]] |
691 kwargs['headlabel'] = s2d.CARD_MAP[rdef.cardinality[0]] |
691 kwargs['color'] = self.nextcolor() |
692 try: |
|
693 kwargs['color'] = self.colors[rschema] |
|
694 except: |
|
695 kwargs['color'] = self.nextcolor() |
|
696 self.colors[rschema] = kwargs['color'] |
692 kwargs['fontcolor'] = kwargs['color'] |
697 kwargs['fontcolor'] = kwargs['color'] |
693 # dot label decoration is just awful (1 line underlining the label |
698 # dot label decoration is just awful (1 line underlining the label |
694 # + 1 line going to the closest edge spline point) |
699 # + 1 line going to the closest edge spline point) |
695 kwargs['decorate'] = 'false' |
700 kwargs['decorate'] = 'false' |
696 #kwargs['labelfloat'] = 'true' |
701 #kwargs['labelfloat'] = 'true' |