Changeset 2178

Show
Ignore:
Timestamp:
01/15/08 23:42:14 (11 months ago)
Author:
arj..@yirdis.nl
Message:

Cleanup of pynsource (import) module. see #92.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/trunk/gaphor/plugins/pynsource/engineer.py

    r1996 r2178  
    101101                # Finally, create the generalization relationship 
    102102                print 'Creating Generalization for %s' % clazz, superclass 
    103                 gen = self.element_factory.create(UML.Generalization) 
    104                 gen.general = superclass 
    105                 gen.specific = clazz.gaphor_class 
     103                #gen = self.element_factory.create(UML.Generalization) 
     104                #gen.general = superclass 
     105                #gen.specific = clazz.gaphor_class 
    106106                geni = self.diagram.create(items.GeneralizationItem) 
    107                 geni.subject = gen 
     107                #geni.subject = gen 
    108108                 
    109109                adapter = component.queryMultiAdapter((superclass_item, geni), IConnect) 
     
    172172            head_type_item = clazz.gaphor_class_item 
    173173 
    174             relation = self.element_factory.create(UML.Association) 
    175             head_end = self.element_factory.create(UML.Property) 
    176             head_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 
    177             tail_end = self.element_factory.create(UML.Property) 
    178             tail_end.name = attr.attrname 
    179             tail_end.visibility = self._visibility(attr.attrname) 
    180             tail_end.aggregation = 'composite' 
    181             tail_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 
    182             relation.package = self.diagram.namespace 
    183             relation.memberEnd = head_end 
    184             relation.memberEnd = tail_end 
    185             head_end.type = head_type 
    186             tail_end.type = tail_type 
    187             head_type.ownedAttribute = tail_end 
    188             tail_type.ownedAttribute = head_end 
    189  
    190             # Now create the diagram item: 
     174            #relation = self.element_factory.create(UML.Association) 
     175            #head_end = self.element_factory.create(UML.Property) 
     176            #head_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 
     177            #tail_end = self.element_factory.create(UML.Property) 
     178            #tail_end.name = attr.attrname 
     179            #tail_end.visibility = self._visibility(attr.attrname) 
     180            #tail_end.aggregation = 'composite' 
     181            #tail_end.lowerValue = self.element_factory.create(UML.LiteralSpecification) 
     182            #relation.package = self.diagram.namespace 
     183            #relation.memberEnd = head_end 
     184            #relation.memberEnd = tail_end 
     185            #head_end.type = head_type 
     186            #tail_end.type = tail_type 
     187            #head_type.ownedAttribute = tail_end 
     188            #tail_type.ownedAttribute = head_end 
     189 
     190             
     191            # Now the subject 
     192            #association.subject = relation 
     193            #association.head_end.subject = head_end 
     194            #association.tail_end.subject = tail_end 
     195 
     196            # Create the diagram item: 
    191197            association = self.diagram.create(items.AssociationItem) 
    192198 
    193             # First connect one handle: 
    194             #head_type_item.connect_handle(association.handles[0]) 
    195199            adapter = component.queryMultiAdapter((head_type_item, association), IConnect) 
    196200            assert adapter 
     
    198202            adapter.connect(handle) 
    199203 
    200              
    201             # Now the subject 
    202             association.subject = relation 
    203             association.head_end.subject = head_end 
    204             association.tail_end.subject = tail_end 
    205  
    206             # Connecting the other handle last will avoid a lookup for 
    207             # an Association. in stead the association applied as subject 
    208             # is used. 
    209             #tail_type_item.connect_handle(association.handles[-1]) 
    210204            adapter = component.queryMultiAdapter((tail_type_item, association), IConnect) 
    211205            assert adapter 
     
    213207            adapter.connect(handle) 
    214208 
     209            # Apply attribute information to the association (ends) 
     210            association.head_end.navigability = False 
     211            tail_prop = association.tail_end.subject 
     212            tail_prop.name = attr.attrname 
     213            tail_prop.visibility = self._visibility(attr.attrname) 
     214            tail_prop.aggregation = 'composite' 
    215215        else: 
    216216            # Create a simple attribute: