Index: stm.py =================================================================== --- stm.py (revision 2595) +++ stm.py (working copy) @@ -1,6 +1,6 @@ """Software Transactional Memory and Observers""" -import weakref, sys, heapq, UserList, UserDict, sets +import weakref, sys, heapq, UserList, UserDict from peak.util.extremes import Max from peak.util import decorators try: Index: trellis.py =================================================================== --- trellis.py (revision 2595) +++ trellis.py (working copy) @@ -1,7 +1,7 @@ from thread import get_ident from weakref import ref from peak.util import addons, decorators -import sys, UserDict, UserList, sets, stm, types, new, weakref, copy +import sys, UserDict, UserList, stm, types, new, weakref, copy from peak.util.extremes import Max from peak.util.symbols import Symbol, NOT_GIVEN @@ -42,12 +42,13 @@ try: set = set except NameError: + import sets set = sets.Set frozenset = sets.ImmutableSet set_like = sets.BaseSet dictlike = dict, sets.BaseSet else: - set_like = set, frozenset, sets.BaseSet + set_like = set, frozenset dictlike = (dict,) + set_like @@ -506,7 +508,7 @@ return ReadOnlyCell(rule, None, discrete) elif rule is None: return Value(v, discrete) - return ReadOnlyCell.__new__(cls, rule, value, discrete) + return ReadOnlyCell.__new__(cls)#, rule, value, discrete) def _check_const(self): pass # we can never become Constant @@ -529,8 +531,9 @@ super(Cell, self).set_value(value) if self._needs_init: schedule(self) + else: + cancel(self) - value = property(get_value, set_value) def dirty(self): @@ -748,6 +751,8 @@ except KeyError: name = self.__name__ cell = cells.setdefault(name, self.make_cell(typ, ob, name)) + if ctrl.active: + on_undo(cells.pop, name) return cell.value def __repr__(self): @@ -1240,6 +1245,9 @@ strategy is used in each recalcultion that changes the list. If what you really want is e.g. a sorted read-only view on a set, don't use this. """ + if hasattr(UserList.UserList, '__metaclass__'): + class __metaclass__(Component.__metaclass__, UserList.UserList.__metaclass__): + pass updated = todo(lambda self: self.data[:]) future = updated.future @@ -1351,7 +1359,7 @@ -class Set(sets.Set, Component): +class Set(set, Component): """Mutable set that recalculates observers when it's changed The ``added`` and ``removed`` attributes can be watched for changes, but