[Ml-yokadi] undo ;-)

Sébastien Renard Sebastien.Renard
Mer 10 Déc 18:23:54 CET 2008


Le mercredi 10 décembre 2008, Aurélien Gâteau a écrit :
> I think it would be really nice, especially for commands like t_remove
> (although it's less bad now that you get a confirmation). but I do not
> have any idea for a proper implementation.

Not so easy. I first try to sqlobject but it was no help. 

Here's the state of my thought : 
- create an Undo class that is composed of the following members : 
	o Date
	o Type of data (Task, Keyword, Project...)
	o Dict of all data attribute
... and two methods : 
	o one to create Undo object from Task/Project... object
	o one to resurect Task/Proect... from undo object
- the undo stack is a list of Undo object on the Yokadi class (self.undoStack)
- each time a function change an object, it must save its state into an Undo 
object and put it on the stack (self.undoStack.append(previousObject).

First implementation would only allow to undo actions in reverse order. A 
second release could allow to undo arbitrary item in the undo stack (with all 
the dependency problematic).

a+
-- 
Sébastien


Plus d'informations sur la liste de diffusion Ml-yokadi