Changeset 1061

Show
Ignore:
Timestamp:
11/04/06 09:15:34 (2 years ago)
Author:
wrobell
Message:

- decision/merge node works again

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/branches/new-canvas/gaphor/actions/placementactions.py

    r1046 r1061  
    263263 
    264264 
    265 #class DecisionNodePlacementAction(PlacementAction): 
    266 #    id = 'InsertDecisionNode' 
    267 #    label = 'Decision/Merge Node' 
    268 #    tooltip = 'Create a new decision/merge node' 
    269 #    stock_id = 'gaphor-decision-node' 
    270 #    name = 'DecisionNode' 
    271 #    type = diagram.DecisionNodeItem 
    272 #    subject_type = UML.DecisionNode 
    273 
    274 #register_action(DecisionNodePlacementAction) 
     265class DecisionNodePlacementAction(PlacementAction): 
     266    id = 'InsertDecisionNode' 
     267    label = 'Decision/Merge Node' 
     268    tooltip = 'Create a new decision/merge node' 
     269    stock_id = 'gaphor-decision-node' 
     270    name = 'DecisionNode' 
     271    type = items.DecisionNodeItem 
     272    subject_type = UML.DecisionNode 
     273 
     274register_action(DecisionNodePlacementAction) 
    275275 
    276276 
  • gaphor/branches/new-canvas/gaphor/diagram/activitynodes.py

    r1060 r1061  
    22Activity control nodes. 
    33""" 
    4 # vim:sw=4:et 
    54 
    65import math 
    7 import itertools 
    8  
    9 from gaphas.util import path_ellipse, text_align, text_extents 
     6 
     7from gaphas.util import path_ellipse 
    108 
    119from gaphor import UML 
    1210from gaphor import resource 
    13 #from gaphor.diagram import TextElement 
    14 #from gaphor.diagram.groupable import GroupBase 
    1511from gaphor.diagram.nameditem import NamedItem 
    1612from gaphor.diagram.style import ALIGN_LEFT, ALIGN_CENTER, ALIGN_TOP, \ 
     
    134130    """ 
    135131 
    136     def __init__(self, id): 
    137         ActivityNodeItem.__init__(self, id
     132    def __init__(self, id, width, height): 
     133        ActivityNodeItem.__init__(self, id, width, height
    138134        self._combined = False 
    139135        self.set_prop_persistent('combined') 
     
    168164    RADIUS = 15 
    169165 
    170     def create_border(self): 
     166    def __init__(self, id=None, width = 20, height = 30): 
     167        FDNode.__init__(self, id, width, height) 
     168 
     169    def draw(self, context): 
     170        """ 
     171        Draw diamond shape, which represents decision and merge nodes. 
     172        """ 
     173        cr = context.cairo 
    171174        r = self.RADIUS 
    172175        r2 = r * 2/3 
    173176 
    174         diamond = diacanvas.shape.Path() 
    175         diamond.line(((r2,0), (r2*2, r), (r2, r*2), (0, r))) 
    176         diamond.set_cyclic(True) 
    177         diamond.set_line_width(2.0) 
    178  
    179         self.set(width = r2 * 2, height = r * 2) 
    180  
    181         return diamond 
    182  
    183  
    184     def draw_border(self): 
    185         """ 
    186         Draw nothing as decision node does not change. 
    187         """ 
    188         pass 
     177        cr.move_to(r2, 0) 
     178        cr.line_to(r2 * 2, r) 
     179        cr.line_to(r2, r * 2) 
     180        cr.line_to(0, r) 
     181        cr.close_path() 
     182        cr.stroke() 
     183 
     184        super(FDNode, self).draw(context) 
    189185 
    190186 
     
    268264            self._join_spec.subject = None 
    269265        self.request_update() 
     266 
     267# vim:sw=4:et 
  • gaphor/branches/new-canvas/gaphor/diagram/items.py

    r1046 r1061  
    3232from gaphor.diagram.activitynodes import InitialNodeItem, ActivityFinalNodeItem 
    3333from gaphor.diagram.activitynodes import FlowFinalNodeItem 
     34from gaphor.diagram.activitynodes import DecisionNodeItem 
    3435 
    3536# Use Cases: