17 Jul 18:49
problem with undo on delegated lists
From: Danny Shevitz <shevitz@...>
Subject: problem with undo on delegated lists
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-17 16:50:21 GMT
Subject: problem with undo on delegated lists
Newsgroups: gmane.comp.python.enthought.devel
Date: 2008-07-17 16:50:21 GMT
howdy, Another problem with delegation here. I believe it's a bug, but I always do and I'm usually wrong(Continue reading). If a list is delegated as in class A sub_nodes = List class B a = Instance(A) sub_nodes = Delegate('a', modify=True) Now imagine two instances of B share the same a a = A() b1 = B(a=a) b2 = B(a=a) so the b's are different but b1.a = b2.a = a. Now the problem. If I change "a" (via "b", in a gui so we have an undo history), then the undo history is appended with an undo item containing two changes, one for b1 and one for b2. In fact there was only one change to the delegatee, "a". If I do an undo/redo operation on the tree (via the default buttons) then changes are made to both b1 and b2 resulting in twice as many changes to a. So if I append to b1 and do an undo/redo I now end with two children under both b1 and b2, when I should only have one.
.
If a list is delegated as in
class A
sub_nodes = List
class B
a = Instance(A)
sub_nodes = Delegate('a', modify=True)
Now imagine two instances of B share the same a
a = A()
b1 = B(a=a)
b2 = B(a=a)
so the b's are different but b1.a = b2.a = a.
Now the problem. If I change "a" (via "b", in a gui so we have an undo history),
then the undo history is appended with an undo item containing two changes, one
for b1 and one for b2. In fact there was only one change to the delegatee, "a".
If I do an undo/redo operation on the tree (via the default buttons) then
changes are made to both b1 and b2 resulting in twice as many changes to a.
So if I append to b1 and do an undo/redo I now end with two children under
both b1 and b2, when I should only have one.
RSS Feed