Changeset 1176
- Timestamp:
- 03/27/07 13:54:18 (2 years ago)
- Files:
-
- gaphor/trunk/TODO (modified) (1 diff)
- gaphor/trunk/gaphor/UML/properties.py (modified) (1 diff)
- gaphor/trunk/gaphor/UML/tests/test_properties.py (modified) (3 diffs)
- gaphor/trunk/gaphor/misc/console.py (modified) (1 diff)
- gaphor/trunk/gaphor/ui/namespace.py (modified) (3 diffs)
- gaphor/trunk/setup.cfg (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/TODO
r1142 r1176 8 8 9 9 - Undo functionality 10 - make canvas events transactional. 10 11 11 12 - use easysetup tools, move gaphas to a separate package and use gaphor/trunk/gaphor/UML/properties.py
r1173 r1176 629 629 630 630 631 @component.adapter(AssociationDeleteEvent) 632 def undo_association_delete_event(event): 633 association = event.property 634 obj = event.element 635 value = event.old_value 636 def _undo_association_delete_event(): 637 #print 'undoing action', obj, value 638 # Tell the assoctaion it should not need to let the opposite 639 # side connect (it has it's own signal) 640 association._set(obj, value, from_opposite=True) 641 get_undo_manager().add_undo_action(_undo_association_delete_event) 642 643 component.provideHandler(undo_association_delete_event) 644 645 631 646 try: 632 647 import psyco gaphor/trunk/gaphor/UML/tests/test_properties.py
r1173 r1176 1 1 #!/usr/bin/env python 2 # vim:sw=4:et:ai3 2 4 3 import unittest … … 397 396 assert a.attr == 'five' 398 397 399 def test_undo_attribute(self): 400 import types 398 def test_undo_aassociation_1_x(self): 401 399 from gaphor.services.undomanager import get_undo_manager 402 400 undo_manager = get_undo_manager() … … 429 427 assert b.two is a 430 428 429 def test_undo_association_1_n(self): 430 from gaphor.services.undomanager import get_undo_manager 431 undo_manager = get_undo_manager() 432 433 class A(Element): pass 434 class B(Element): pass 435 436 A.one = association('one', B, lower=0, upper=1, opposite='two') 437 B.two = association('two', A, lower=0, upper='*', opposite='one') 438 439 a1 = A() 440 a2 = A() 441 b1 = B() 442 b2 = B() 443 444 445 undo_manager.begin_transaction() 446 b1.two = a1 447 448 undo_manager.commit_transaction() 449 assert a1 in b1.two 450 assert b1 is a1.one 451 452 undo_manager.undo_transaction() 453 assert len(b1.two) == 0 454 assert a1.one is None 455 456 undo_manager.redo_transaction() 457 assert a1 in b1.two 458 assert b1 is a1.one 459 460 undo_manager.begin_transaction() 461 b1.two = a2 462 463 undo_manager.commit_transaction() 464 assert a1 in b1.two 465 assert a2 in b1.two 466 assert b1 is a1.one 467 assert b1 is a2.one 468 469 470 # vim:sw=4:et:ai gaphor/trunk/gaphor/misc/console.py
r561 r1176 17 17 import __main__ 18 18 19 banner = """G TKInteractive Python Console19 banner = """Gaphor Interactive Python Console 20 20 %s 21 21 """ % sys.version gaphor/trunk/gaphor/ui/namespace.py
r1121 r1176 256 256 257 257 for t in toplevel: 258 #print 'factory::model toplevel', t, t.name259 258 self.new_node_from_element(t, self.root) 260 #print 'self.root', self.root261 259 262 260 def refresh(self): … … 277 275 278 276 def on_get_flags(self): 279 """Returns the GtkTreeModelFlags for this particular type of model. 277 """ 278 Returns the GtkTreeModelFlags for this particular type of model. 280 279 """ 281 280 return 0 282 281 283 282 def on_get_n_columns(self): 284 """Returns the number of columns in the model. 283 """ 284 Returns the number of columns in the model. 285 285 """ 286 286 return 1 287 287 288 288 def on_get_column_type(self, index): 289 """Returns the type of a column in the model. 289 """ 290 Returns the type of a column in the model. 290 291 """ 291 292 return gobject.TYPE_PYOBJECT 292 293 293 294 def on_get_path (self, node): 294 """ Returns the path for a node as a tuple (0, 1, 1).295 """296 #print 'on_get_path', node295 """ 296 Returns the path for a node as a tuple (0, 1, 1). 297 """ 297 298 return self.path_from_element(node[0]) 298 299 299 300 def on_get_iter(self, path): 300 """Returns the node corresponding to the given path. 301 """ 302 Returns the node corresponding to the given path. 301 303 The path is a tuple of values, like (0 1 1). Returns None if no 302 304 iterator can be created. 303 305 """ 304 #print 'on_get_iter', path305 306 return self.node_from_path(path) 306 307 307 308 def on_get_value(self, node, column): 308 """Returns the model element that matches 'node'. 309 """ 310 Returns the model element that matches 'node'. 309 311 """ 310 312 assert column == 0, 'column can only be 0' 311 #print 'on_get_value', node, column312 313 return node[0] 313 314 314 315 def on_iter_next(self, node): 315 """Returns the next node at this level of the tree (None if no 316 """ 317 Returns the next node at this level of the tree (None if no 316 318 next element). 317 319 """ 318 #print 'on_iter_next:', node319 320 try: 320 321 parent = self.node_from_element(node[0].namespace) … … 329 330 330 331 def on_iter_has_child(self, node): 331 """ Returns true if this node has children, or None.332 """333 #print 'on_iter_has_child', node332 """ 333 Returns true if this node has children, or None. 334 """ 334 335 return len(node[1]) > 0 335 336 336 337 def on_iter_children(self, node): 337 """ Returns the first child of this node, or None.338 """339 #print 'on_iter_children'338 """ 339 Returns the first child of this node, or None. 340 """ 340 341 return node[1][0] 341 342 342 343 def on_iter_n_children(self, node): 343 """ Returns the number of children of this node.344 """345 #print 'on_iter_n_children'344 """ 345 Returns the number of children of this node. 346 """ 346 347 return len (node[1]) 347 348 348 349 def on_iter_nth_child(self, node, n): 349 """ Returns the nth child of this node.350 """351 #print "on_iter_nth_child", node, n350 """ 351 Returns the nth child of this node. 352 """ 352 353 try: 353 354 if node is None: gaphor/trunk/setup.cfg
r191 r1176 1 2 [egg_info] 3 # Point egg_base to compiled sources, cause some sources have to be generated 4 egg_base=build/lib 5 1 6 [install] 2 7 install_data=$base/share/gaphor
