← Back to team overview

openshot.developers team mailing list archive

[Bug 425460] Re: Undo and Redo Support

 

The trick I was using now for triggering the history recording of
actions is based on the already existing project-is-modified
notification function:

'project.set_project_modified(is_modified=True, refresh_xml=True)'

I thought that it could carry an extra argument to be used as a "switch"
for the history system notification, and defaulting to None, like this:

'set_project_modified(self, is_modified=False, refresh_xml=False,
type=None)'

So, in case of actions that we want to record in history stack, we just
add the string describing the action as "type" argument, and the history
system is activated, the string passed becomes the first arguent of a
tuple containing also the StringIO object on which cPickle dumps the
state pf the project, and the tuple is appended to the history stack.
The first argument of the tuple is then used for describing the action
in history tree-view.

I used this approach because it took advantage of the already existing
hooks in the code, and besides this leaves us an easy way to fine-tune
the system, deciding which action should be recorded in history whenever
we want, using just one project-modified notification function.

For the tests I've made it seems that cPickle combined with cStringIO is
rather fast, but it should probably be stress-tested on some huge
project because this approach uses the project as some sort of state-
machine, recording the whole state of it for every step.

-- 
Undo and Redo Support
https://bugs.launchpad.net/bugs/425460
You received this bug notification because you are a member of OpenShot
Developers, which is subscribed to OpenShot Video Editor.

Status in OpenShot Video Editor: In Progress

Bug description:
I am using version 0.9.2 in ubuntu 9.04 32 bit.

I would like to see a multilevel "undo" feature, so If I make a mistake with something, I can go back to where I was.  I tried using a few of the tools and suddenly lost a few tracks and other items, so I looked for the undo button and tried ctrl-z, but there was no way to go back, so I had to reload the project in an earlier saved state.