Changeset 1201
- Timestamp:
- 04/09/07 23:14:40 (2 years ago)
- Files:
-
- gaphor/trunk/gaphor/actions/itemactions.py (modified) (3 diffs)
- gaphor/trunk/gaphor/diagram/action.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/activitynodes.py (modified) (1 diff)
- gaphor/trunk/gaphor/diagram/classifier.py (modified) (1 diff)
- gaphor/trunk/gaphor/diagram/comment.py (modified) (1 diff)
- gaphor/trunk/gaphor/diagram/elementitem.py (modified) (1 diff)
- gaphor/trunk/gaphor/diagram/extension.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/nameditem.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/objectnode.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/package.py (modified) (2 diffs)
- gaphor/trunk/gaphor/event.py (modified) (1 diff)
- gaphor/trunk/gaphor/interfaces.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/actions/itemactions.py
r1132 r1201 1078 1078 item = get_parent_focus_item(self._window) 1079 1079 if isinstance(item, items.ObjectNodeItem): 1080 self.active = (item. get_ordering()== self.ordering)1080 self.active = (item.ordering == self.ordering) 1081 1081 except NoFocusItemError: 1082 1082 pass … … 1086 1086 if self.active: 1087 1087 item = get_parent_focus_item(self._window) 1088 item. set_ordering(self.ordering)1088 item.ordering = self.ordering 1089 1089 1090 1090 … … 1140 1140 else: 1141 1141 if isinstance(item, items.ObjectNodeItem): 1142 self.active = item. props.show_ordering1142 self.active = item.show_ordering 1143 1143 1144 1144 @transactional 1145 1145 def execute(self): 1146 1146 item = get_parent_focus_item(self._window) 1147 item. props.show_ordering = self.active1147 item.show_ordering = self.active 1148 1148 1149 1149 register_action(ObjectNodeOrderingVisibiltyAction, 'ItemFocus') gaphor/trunk/gaphor/diagram/action.py
r1121 r1201 16 16 'name-align': (ALIGN_CENTER, ALIGN_MIDDLE), 17 17 } 18 19 def pre_update(self, context): 20 self.update_name_size(context) 21 self.min_width, self.min_height = self.get_name_size() 22 super(ActionItem, self).pre_update(context) 18 23 19 24 def draw(self, context): … … 40 45 41 46 42 43 47 # vim:sw=4:et gaphor/trunk/gaphor/diagram/activitynodes.py
r1193 r1201 131 131 ActivityNodeItem.__init__(self, id) 132 132 self._combined = None 133 self.set_prop_persistent('combined') 133 #self.set_prop_persistent('combined') 134 135 def save(self, save_func): 136 if self._combined: 137 save_func('combined', self._combined, reference=True) 138 super(ForkDecisionNodeItem, self).save(save_func) 139 140 def load(self, name, value): 141 if name == 'combined': 142 self._combined = value 143 else: 144 super(ForkDecisionNodeItem, self).load(name, value) 134 145 135 146 @observed gaphor/trunk/gaphor/diagram/classifier.py
r1193 r1201 339 339 340 340 def draw_compartment(self, context): 341 #if not self.subject: return342 341 cr = context.cairo 343 342 cr.rectangle(0, 0, self.width, self.height) gaphor/trunk/gaphor/diagram/comment.py
r1193 r1201 79 79 if self.subject.body: 80 80 # Do not print empty string, since cairo-win32 can't handle it. 81 text_multiline(c, 5, 15, self.subject.body, padding=2)81 text_multiline(c, 5, 5, self.subject.body, padding=2) 82 82 #c.move_to(10, 15) 83 83 #c.show_text(self.subject.body) gaphor/trunk/gaphor/diagram/elementitem.py
r1121 r1201 41 41 self.update_stereotype() 42 42 43 43 44 # vim:sw=4 gaphor/trunk/gaphor/diagram/extension.py
r1121 r1201 15 15 16 16 class ExtensionItem(DiagramLine): 17 """ExtensionItem represents associations. 17 """ 18 ExtensionItem represents associations. 18 19 An ExtensionItem has two ExtensionEnd items. Each ExtensionEnd item 19 20 represents a Property (with Property.association == my association). … … 24 25 def __init__(self, id=None): 25 26 DiagramLine.__init__(self, id) 26 27 def save (self, save_func):28 DiagramLine.save(self, save_func)29 if self._head_end.subject:30 save_func('head_subject', self._head_end.subject)31 if self._tail_end.subject:32 save_func('tail_subject', self._tail_end.subject)33 34 def load (self, name, value):35 # end_head and end_tail were used in an older Gaphor version36 if name in ( 'head_end', 'head_subject' ):37 #type(self._head_end).subject.load(self._head_end, value)38 self._head_end.load('subject', value)39 elif name in ( 'tail_end', 'tail_subject' ):40 #type(self._tail_end).subject.load(self._tail_end, value)41 self._tail_end.load('subject', value)42 else:43 DiagramLine.load(self, name, value)44 45 def postload(self):46 DiagramLine.postload(self)47 self._head_end.postload()48 self._tail_end.postload()49 27 50 28 def on_subject_notify(self, pspec, notifiers=()): gaphor/trunk/gaphor/diagram/nameditem.py
r1193 r1201 56 56 padding = self.style.name_padding 57 57 self._name_size = width + padding[0] + padding[2], height + padding[1] + padding[3] 58 # if self.min_width < self._name_size[0]:59 # self.min_width = self._name_size[0]60 # if self.min_height < self._name_size[1]:61 # self.min_height = self._name_size[1]62 # self.min_width, self.min_height = get_min_size(width, height,63 # self.style.min_size,64 # self.style.name_padding)65 #66 # super(NamedItem, self).pre_update(context)67 68 58 69 59 def update(self, context): … … 93 83 #cr.move_to(self.name_x, self.name_y) 94 84 #cr.show_text(text) 95 text_align(cr, self.name_x, self.name_y, text, *self.style.name_align)85 text_align(cr, self.name_x, self.name_y, text, 1, -1) 96 86 super(NamedItem, self).draw(context) gaphor/trunk/gaphor/diagram/objectnode.py
r1178 r1201 81 81 """ 82 82 NamedItem.on_subject_notify(self, pspec, notifiers) 83 if self.subject: 84 if not self.subject.upperBound: 85 self.subject.upperBound = UML.create(UML.LiteralSpecification) 86 self.subject.upperBound.value = '*' 87 #self._upper_bound.subject = self.subject.upperBound 88 #else: 89 # self._upper_bound.subject = None 83 if self.subject and not self.subject.upperBound: 84 self.subject.upperBound = UML.create(UML.LiteralSpecification) 85 self.subject.upperBound.value = '*' 90 86 self.request_update() 91 87 … … 94 90 Update object node, its ordering and upper bound specification. 95 91 """ 96 NamedItem. update(self, context)92 NamedItem.pre_update(self, context) 97 93 98 # TODO: format tag properly:99 94 if self.subject.upperBound: 100 95 self._tag = '{ upperBound = %s }\n' % self.subject.upperBound.value gaphor/trunk/gaphor/diagram/package.py
r1193 r1201 32 32 super(PackageItem, self).pre_update(context) 33 33 34 35 34 def draw(self, context): 36 35 cr = context.cairo … … 49 48 cr.stroke() 50 49 if self.stereotype: 51 text_align(cr, w / 2, y + 10, self.stereotype) 50 y += 10 51 text_align(cr, w / 2, y, self.stereotype) 52 y += 10 52 53 53 super(PackageItem, self).draw(context) 54 if self.subject and self.subject.name: 55 text_align(cr, w / 2, y + 10, self.subject.name) 54 56 55 57 gaphor/trunk/gaphor/event.py
r1170 r1201 1 """ 2 Application wide events are managed here. 3 """ 4 1 5 from zope import interface 2 6 from gaphor.interfaces import * 3 7 8 class TransactionBegin(object): 9 """ 10 This event denotes the beginning of an transaction. 11 Nested (sub-) transactions should not emit this signal. 12 """ 13 interface.implements(ITransactionEvent) 14 15 16 class TransactionCommit(object): 17 """ 18 This event is emitted when a transaction (toplevel) is successfully 19 commited. 20 """ 21 interface.implements(ITransactionEvent) 22 23 class TransactionRollback(object): 24 """ 25 If a set of operations fail (e.i. due to an exception) the transaction 26 should be marked for rollback. This event is emitted to tell the operation 27 has failed. 28 """ 29 interface.implements(ITransactionEvent) 30 31 32 # vim:sw=4:et:ai 33 gaphor/trunk/gaphor/interfaces.py
r1170 r1201 25 25 26 26 27 class ITransaction(interface.Interface): 28 """ 29 The methods each transaction should adhere. 30 """ 31 32 def commit(self): 33 """ 34 Commit the transaction. 35 """ 36 37 def rollback(self): 38 """ 39 Roll back the transaction. 40 """ 41 42 43 class ITransactionEvent(interface.Interface): 44 """ 45 Events related to transaction workflow (begin/commit/rollback) implements 46 this interface. 47 """ 48 49 27 50 # vim:sw=4:et
