Changeset 1060

Show
Ignore:
Timestamp:
11/02/06 21:31:56 (2 years ago)
Author:
wrobell
Message:

- align activity node names using styles

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphor/branches/new-canvas/gaphor/diagram/activitynodes.py

    r1059 r1060  
    1414#from gaphor.diagram.groupable import GroupBase 
    1515from gaphor.diagram.nameditem import NamedItem 
     16from gaphor.diagram.style import ALIGN_LEFT, ALIGN_CENTER, ALIGN_TOP, \ 
     17        ALIGN_RIGHT, ALIGN_BOTTOM 
    1618 
    1719 
     
    2022    Simple activity node is not resizable. 
    2123    """ 
     24    __style__   = { 
     25        'name-outside': True, 
     26        'name-padding': (2, 2, 2, 2), 
     27    } 
    2228 
    2329    def __init__(self, id=None, width=0, height=0): 
     
    3440    """ 
    3541    __uml__     = UML.InitialNode 
     42    __style__   = { 
     43        'name-align': (ALIGN_LEFT, ALIGN_TOP), 
     44    } 
    3645     
    3746    RADIUS = 10 
    3847 
    39     def __init__(self, id=None, width=20, height=20): 
     48    def __init__(self, id = None, width = 20, height = 20): 
    4049        ActivityNodeItem.__init__(self, id, width, height) 
    4150 
     
    4857        cr.fill() 
    4958         
    50         cr.move_to(d, r) 
    51         cr.show_text(self.subject.name or '') 
     59        super(InitialNodeItem, self).draw(context) 
    5260 
    5361 
     
    5866 
    5967    __uml__ = UML.ActivityFinalNode 
     68    __style__   = { 
     69        'name-align': (ALIGN_RIGHT, ALIGN_BOTTOM), 
     70    } 
    6071 
    6172    RADIUS_1 = 10 
     
    7990        cr.stroke() 
    8091         
    81         cr.move_to(d, r) 
    82         cr.show_text(self.subject.name or '') 
     92        super(ActivityFinalNodeItem, self).draw(context) 
    8393 
    8494 
     
    90100 
    91101    __uml__ = UML.FlowFinalNode 
     102    __style__   = { 
     103        'name-align': (ALIGN_RIGHT, ALIGN_BOTTOM), 
     104    } 
    92105 
    93106    RADIUS = 10 
     
    102115        path_ellipse(cr, r, r, d, d) 
    103116        cr.stroke() 
    104  
    105         cr.move_to(d, r) 
    106         cr.show_text(self.subject.name or '') 
    107117 
    108118        dr = (1 - math.sin(math.pi / 4)) * r 
     
    113123        cr.stroke() 
    114124         
     125        super(FlowFinalNodeItem, self).draw(context) 
     126         
    115127 
    116128 
     
    150162 
    151163    __uml__   = UML.DecisionNode 
    152 #__s_align__ = H_ALIGN_LEFT 
     164    __style__   = { 
     165        'name-align': (ALIGN_LEFT, ALIGN_TOP), 
     166    } 
    153167 
    154168    RADIUS = 15 
     
    180194    Representation of fork or join node. 
    181195    """ 
    182     __uml__      = UML.ForkNode 
    183 #__s_valign__ = V_ALIGN_BOTTOM 
     196    __uml__   = UML.ForkNode 
     197    __style__ = { 
     198        'name-align': (ALIGN_CENTER, ALIGN_BOTTOM), 
     199    } 
    184200 
    185201    WIDTH  =  6.0 
  • gaphor/branches/new-canvas/gaphor/diagram/nameditem.py

    r1059 r1060  
    4949        cr = context.cairo 
    5050        text = self.subject.name 
    51         if text
     51        if text and not self.style.name_outside
    5252            width, height = text_extents(cr, text) 
    5353            self.min_width, self.min_height = get_min_size(width, height,