Example #1
0
	def stacked(self, *data, **kwdata):
		with undoContext():
			ret = None
			self.stack.depth += 1
			ret = method(self, *data, **kwdata)
			self.stack.depth -= 1

			if self.stack.depth == 0:
				# Top Level of the stack
				srevision = self.incrementRevision()
				scopy = copy.deepcopy(self.simplex)
				self.stack[srevision] = (scopy, self, method.__name__, data, kwdata)
			return ret
Example #2
0
    def live(self, value):
        if self._live == value:
            return  #short circuit on no-change
        self._live = value
        if self._live:  # if we switch from dead to live
            # Get all the things we need to do in this live/dead flip
            doitStack = []
            for k in reversed(self._stack):  #pylint: disable=bad-reversed-sequence
                live, data = self._stack[k]
                if not live:
                    doitStack.append(data)
                else:
                    # get everything from the end until we're back in live action
                    break

            # Do the things that were recorded as one big undoable block
            doitStack.reverse()  # because I looped over reversed(self._stack)
            with undoContext():
                for simp, inst, name, data, kwdata in doitStack:
                    if name is not None:  # Name is None if ui-level stack
                        getattr(inst, name)(*data, **kwdata)
                        inst.simplex = simp