Changeset 1959
- Timestamp:
- 08/18/07 06:57:22 (1 year ago)
- Files:
-
- gaphor/trunk/gaphor/diagram/lifeline.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/diagram/lifeline.py
r1950 r1959 25 25 from gaphas.solver import STRONG 26 26 from gaphas.geometry import distance_line_point, Rectangle 27 from gaphas.constraint import EqualsConstraint, CenterConstraint27 from gaphas.constraint import LessThanConstraint, EqualsConstraint, CenterConstraint 28 28 29 29 from gaphor import UML … … 42 42 def __init__(self): 43 43 super(LifetimeItem, self).__init__() 44 self._handles = [gaphas.Handle(strength=STRONG ), gaphas.Handle(strength=STRONG)]44 self._handles = [gaphas.Handle(strength=STRONG - 1), gaphas.Handle(strength=STRONG)] 45 45 46 46 self._handles[0].movable = False … … 48 48 self._messages_count = 0 49 49 self._is_destroyed = False 50 51 # create constraint to keep bottom handle below top handle 52 top, bottom = self._handles 53 self._c_length = LessThanConstraint(smaller=top.y, 54 bigger=bottom.y, 55 delta=LifetimeItem.MIN_LENGTH) 56 50 57 51 58 top = property(lambda s: s._handles[0]) … … 65 72 return bottom.y - top.y > self.MIN_LENGTH 66 73 74 67 75 def pre_update(self, context): 68 top, bottom = self._handles69 70 d = LifetimeItem.MIN_LENGTH71 72 76 # if lifetime is visible and there are messages connected, then 73 77 # disallow hiding of lifetime 74 78 if not self.is_visible() and self._messages_count > 0: 75 d *= 376 if bottom.y - top.y <= d:77 bottom.y = top.y + d79 self._c_length.delta = LifetimeItem.MIN_LENGTH * 3 80 elif self._messages_count == 0: 81 self._c_length.delta = LifetimeItem.MIN_LENGTH 78 82 79 def post_update(self, context):80 pass81 83 82 84 def draw(self, context): … … 125 127 EqualsConstraint(top.x, bottom.x), 126 128 EqualsConstraint(self._handles[SW].y, top.y), 129 self._lifetime._c_length, 127 130 ] 128 131 self._constraints.extend(constraints) … … 151 154 152 155 153 def post_update(self, context):154 super(LifelineItem, self).post_update(context)155 #self._lifetime.post_update(context)156 157 158 156 def draw(self, context): 159 157 super(LifelineItem, self).draw(context)
