We're still not free of trouble with the undo manager.
Try this: create two Class items and create an Association between them. Move one end of the association item so the relationship is removed.
Now undo:
Error while pre-updating item <gaphor.diagram.klass.ClassItem object at 0x016701
10>
Traceback (most recent call last):
File "c:\workspace\python\gaphas\gaphas\canvas.py", line 374, in _pre_update_i
tems
item.pre_update(c)
File ".\gaphor\diagram\classifier.py", line 294, in pre_update_compartment
comp.pre_update(context)
File ".\gaphor\diagram\classifier.py", line 63, in pre_update
item.pre_update(context)
File ".\gaphor\diagram\feature.py", line 118, in pre_update
self.update_size(self.subject.render(), context)
File ".\gaphor\diagram\feature.py", line 57, in update_size
self.width, self.height = text_extents(cr, text)
File "C:\workspace\python\gaphas\gaphas\util.py", line 28, in text_extents
x_bear, y_bear, width, height, x_adv, y_adv = cr.text_extents(text)
TypeError: Context.text_extents() argument must be a string or unicode object
Error while pre-updating item <gaphor.diagram.klass.ClassItem object at 0x017318
70>
In this case the problem is that one end of the association is handled by the classifier, but seen acts as an association end.
The order in which operations need to be undone is important.
Possible solution is to postpone event notification until the transaction is committed.