Does anyone has a procedure to save / restore wx settings ?

hello,

Does anyone has a procedure to save / restore wx settings ?
I mean all settings that can be changed by the user, like which radioitem is selected, what the sash position of a splitter is etc.

I thought I would create such a procedure easily,
but it seems quit complex.
I already have troubles finding all visual wx items.

thanks,
Stef Mientki

Hello Stef,
I need that too.
My idea is to use an xrc file or other xml file.
But I am a begginer in wxPython so I search.
Christophe

···

2008/10/16 Stef Mientki s.mientki@ru.nl

hello,

Does anyone has a procedure to save / restore wx settings ?

I mean all settings that can be changed by the user, like which radioitem is selected, what the sash position of a splitter is etc.

I thought I would create such a procedure easily,

but it seems quit complex.

I already have troubles finding all visual wx items.

thanks,

Stef Mientki


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Stef,

hello,

Does anyone has a procedure to save / restore wx settings ?
I mean all settings that can be changed by the user, like which radioitem is selected, what the sash position of a splitter is etc.

I thought I would create such a procedure easily,
but it seems quit complex.
I already have troubles finding all visual wx items.

thanks,
Stef Mientki

If I need to save something, I create a handler that gets all the info I need. Something like this psuedo-code:

<code>

def onSavePrefs(self, event):
    radioSetting = self.radioBtn.GetValue()
    checkboxSetting = self.checkBox.GetValue()
    # etc, etc

    # now we need to save them
    # I've used ConfigParser before to create an INI-type file
    # but ConfigObj sounds like it might be better

</code>

Here's some links:

http://www.voidspace.org.uk/python/modules.shtml#configobj
http://www.python.org/doc/2.5.2/lib/module-ConfigParser.html

I was going to give some sample code using ConfigParser, but I have an emergency app to write, so you'll have to make due with the samples on the sites above.

Mike

Christophe Gengembre wrote:

Hello Stef,
I need that too.
My idea is to use an xrc file or other xml file.

Hi Cristophe,
you triggered an idea with me,
I use something similar as XRC, but more simpler,
That method can at least generate a list of wx items for me.

But lets wait for some other ideas,
this is a so common problem,
I can't imagine someone hasn't done it already .
(For aui it already exists)

cheers
Stef

···

But I am a begginer in wxPython so I search.
Christophe

2008/10/16 Stef Mientki <s.mientki@ru.nl <mailto:s.mientki@ru.nl>>

    hello,

    Does anyone has a procedure to save / restore wx settings ?
    I mean all settings that can be changed by the user, like which
    radioitem is selected, what the sash position of a splitter is etc.

    I thought I would create such a procedure easily,
    but it seems quit complex.
    I already have troubles finding all visual wx items.

    thanks,
    Stef Mientki
    _______________________________________________
    wxpython-users mailing list
    wxpython-users@lists.wxwidgets.org
    <mailto:wxpython-users@lists.wxwidgets.org>
    http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

------------------------------------------------------------------------

_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Mike Driscoll wrote:

Stef,

hello,

Does anyone has a procedure to save / restore wx settings ?
I mean all settings that can be changed by the user, like which radioitem is selected, what the sash position of a splitter is etc.

I thought I would create such a procedure easily,
but it seems quit complex.
I already have troubles finding all visual wx items.

thanks,
Stef Mientki

If I need to save something, I create a handler that gets all the info I need. Something like this psuedo-code:

<code>

def onSavePrefs(self, event):
   radioSetting = self.radioBtn.GetValue()
   checkboxSetting = self.checkBox.GetValue()
   # etc, etc

thanks Mike,
but why not let the code above be generated automatically ?
cheers,
Stef

···

   # now we need to save them
   # I've used ConfigParser before to create an INI-type file
   # but ConfigObj sounds like it might be better

</code>

Here's some links:

http://www.voidspace.org.uk/python/modules.shtml#configobj
http://www.python.org/doc/2.5.2/lib/module-ConfigParser.html

I was going to give some sample code using ConfigParser, but I have an emergency app to write, so you'll have to make due with the samples on the sites above.

Mike
_______________________________________________
wxpython-users mailing list
wxpython-users@lists.wxwidgets.org
http://lists.wxwidgets.org/mailman/listinfo/wxpython-users

Stef Mientki wrote:

Christophe Gengembre wrote:

Hello Stef,
I need that too.
My idea is to use an xrc file or other xml file.

Hi Cristophe,
you triggered an idea with me,
I use something similar as XRC, but more simpler,
That method can at least generate a list of wx items for me.

But lets wait for some other ideas,
this is a so common problem,
I can't imagine someone hasn't done it already .
(For aui it already exists)

Waiting always seems to last so long,
and after the idea was born,
I just had to add about 15..20 lines of code to realize it.
The attached image of a demo application,
including save/restore settings and toggle buttons,
just took 45 lines of code.
If anyone is interested I'll make a webpage and publish the code separately (the code is integral part of PyLab_Works).

cheers,
Stef

Stef Mientki wrote:

I just had to add about 15..20 lines of code to realize it.
The attached image of a demo application,
including save/restore settings and toggle buttons,
just took 45 lines of code.
If anyone is interested I'll make a webpage and publish the code
separately (the code is integral part of PyLab_Works).

cheers,
Stef

I vote for that
Keith