[Ml-yokadi] undo ;-)

Aurélien Gâteau aurelien.gateau
Mer 10 Déc 22:38:41 CET 2008


Sébastien Renard wrote:
> 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).

I must confess I am not too enthusiast at the idea of complexifying the 
code this way. I must confess Yokadi is a side project for me, so it 
needs to be easy to maintain and extend.

Aurélien


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