saving/loading an ogl diagram and shapes

Hi
I want to be able to save a user created ogl diagram containing shapes. Unfortunately, because of the use of SWIG I can't just use pickle. Does anyone have any suggestions on what would be the simplest way to do this?

Mathew

Hi Mathew,

Mathew Yeates wrote:

Hi
I want to be able to save a user created ogl diagram containing shapes. Unfortunately, because of the use of SWIG I can't just use pickle. Does anyone have any suggestions on what would be the simplest way to do this?

I saved it into an XML format which I then store in a database.

Could send you some code if it would be useful.

Werner

Hi Werner
Thanks. I'd appreciate it if I could see some of your code. I'm still hoping I can "cheat" and modify the swig wrappers to enable pickling. But it would help to see what info you are saving.

Mathew

Werner F. Bruhin wrote:

···

Hi Mathew,

Mathew Yeates wrote:

Hi
I want to be able to save a user created ogl diagram containing shapes. Unfortunately, because of the use of SWIG I can't just use pickle. Does anyone have any suggestions on what would be the simplest way to do this?

I saved it into an XML format which I then store in a database.

Could send you some code if it would be useful.

Werner

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

Mathew Yeates wrote:

Hi
I want to be able to save a user created ogl diagram containing shapes. Unfortunately, because of the use of SWIG I can't just use pickle. Does anyone have any suggestions on what would be the simplest way to do this?

Something that could be done is to modify the shape classes to be pickle friendly. Basically you just need to add some methods that specify what data should be pickled and how to take that data and construct a new instance. If the data doesn't include any SWIG generated classes (that haven't already been made pickle-friendly themselves) then it should pickle just fine.

BTW, it's not clear from your later message whether you know that the OGL shape classes are not generated by SWIG anymore. They're all written in Python now, but they may have references to some classes (such as the OGL Canvas class) that do derive from SWIGged classes.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!