From: King on
I am developing an app using wxPython.
The Undo-Redo implementation is based on storing pre & post state of
an attribute.
You store the instance before changing the value and store the
instance after changing the values.
While undoing or redoing, you copy/replace the current state with
stored once.

For color attribute as soon as you choose a color, here is the code:

# Custom Event
evt = ValueChangeEvent(EVT_COLOR_CHANGED.typeId, self.GetId())
# Store Pre State
# Change the newly selected color
# Store Post State
# Throw Custom Event

Both states are copied as new instance with correct values.
The problem is when this event is getting fired.

evt.GetPreState().GetValue() is showing the post color value. Although
GetPreState() & GetPostState()
are showing two different instances but I have no idea why values are
not coming/stored correctly. Some where
in between is messed up and post-state values are copied in pre-state.

On a side note, self.attribute.setValue takes three floating values
for R,G & B colors but stored them
as a text. Similarly self.attribute.getValue() converts text into
float and returns.

Is there anything related to scope or something?