Changeset 2253
- Timestamp:
- 03/04/08 23:28:14 (2 months ago)
- Files:
-
- gaphor/trunk/gaphor/UML/properties.py (modified) (5 diffs)
- gaphor/trunk/gaphor/diagram/interface.py (modified) (2 diffs)
- gaphor/trunk/gaphor/diagram/tests/test_interface.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/UML/properties.py
r2246 r2253 42 42 """ 43 43 Superclass for attribute, enumeration and association. 44 The subclasses should define a 'name' attribute that contains the name 44 45 The subclasses should define a ``name`` attribute that contains the name 45 46 of the property. Derived properties (derivedunion and redefine) can be 46 47 connected, they will be notified when the value changes. … … 139 140 class enumeration(umlproperty): 140 141 """ 141 Enumeration. 142 Element.enum = enumeration('enum', ('one', 'two', 'three'), 'one') 142 Enumeration 143 144 Element.enum = enumeration('enum', ('one', 'two', 'three'), 'one') 145 146 An enumeration is a special kind of attribute that can only hold a 147 predefined set of values. Multiplicity is always `[0..1]` 143 148 """ 144 149 … … 383 388 value.unlink() 384 389 385 # def __on_unlink(self, value, pspec, obj):386 # """387 # Disconnect when the element on the other end of the association388 # (value) sends the '__unlink__' signal. This is especially important389 # for uni-directional associations.390 # """391 # #print '__on_unlink', name, obj, value392 # if pspec == '__unlink__':393 # self.__delete__(obj, value)394 # # re-establish unlink handler:395 # value.connect('__unlink__', self.__on_unlink, obj)396 #397 390 398 391 class AssociationStubError(Exception): … … 401 394 402 395 class associationstub(umlproperty): 396 """ 397 An association stub is an internal thingy that ensures all associations 398 are always bi-directional. This helps the application when one end of 399 the association is unlinked. On unlink() of an element all `umlproperty`'s 400 are iterated and called by their unlink() method. 401 """ 403 402 404 403 def __init__(self, association): … … 569 568 """ 570 569 Redefined association 571 Element.x = redefine('x', Element, Class, Element.assoc) 570 571 Element.redefine = redefine(Element, 'redefine', Class, Element.assoc) 572 572 573 If the redefine eclipses the original property (it has the same name) 573 574 it ensures that the original values are saved and restored. gaphor/trunk/gaphor/diagram/interface.py
r2143 r2253 56 56 self.add_watch(UML.Interface.ownedAttribute, self.on_class_owned_attribute) 57 57 self.add_watch(UML.Interface.ownedOperation, self.on_class_owned_operation) 58 self.add_watch(UML.Implementation.contract, self.on_implementation_contract) 58 59 59 60 @observed … … 90 91 91 92 folded = property(is_folded, _set_folded) 93 94 def on_implementation_contract(self, event): 95 #print 'on_implementation_contract', event, event.element 96 if event is None or event.element.contract is self: 97 self.request_update() 92 98 93 99 def pre_update_icon(self, context): gaphor/trunk/gaphor/diagram/tests/test_interface.py
r1616 r2253 3 3 """ 4 4 5 import unittest 6 5 from gaphor.tests.testcase import TestCase 7 6 from gaphor import UML 8 7 from gaphor.diagram.interface import InterfaceItem … … 11 10 12 11 13 class ClassTestCase( unittest.TestCase):12 class ClassTestCase(TestCase): 14 13 15 def setUp(self): 16 self.element_factory = UML.ElementFactory() 17 18 def tearDown(self): 19 #self.element_factory.flush() 20 #assert len(self.element_factory.lselect()) == 0 21 pass 14 services = [ 'element_factory' ] 22 15 23 16 def test_interface(self):
