agw.aui - perspectives

Hi Werner,

The demo "just" saves the perspectives in memory - obviously good enough for
the demo.

I am wondering what the best/right way is to do persistent save of
perspectives.

- using wx.Config and friends, i.e. wx.FileConfig to store it in e.g.
perspectives/view.ini with a section per view
- database
- pickle

I usually do the first, i.e. using wx.Config:

sp = wx.StandardPaths.Get()
userData = sp.GetUserDataDir()

config = wx.FileConfig(localFilename=os.path.join(userData, "options"))

# LOADING
val = options.Read('perspectives')
if val:
    self._mgr.LoadPerspective(perspective)
    self._mgr.Update()

# SAVING
config.Write('perspectives', self._mgr.SavePerspective())
config.Flush()

Or something along these lines. You can save multiple perspectives by
storing them in a list and do more or less as above.

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/

···

On Thu, Apr 2, 2009 at 1:56 PM, Werner F. Bruhin wrote:

Hi Andrea,

Andrea Gavana wrote:

Hi Werner,

The demo "just" saves the perspectives in memory - obviously good enough for
the demo.

I am wondering what the best/right way is to do persistent save of
perspectives.

- using wx.Config and friends, i.e. wx.FileConfig to store it in e.g.
perspectives/view.ini with a section per view
- database
- pickle
    
I usually do the first, i.e. using wx.Config:

sp = wx.StandardPaths.Get()
userData = sp.GetUserDataDir()

config = wx.FileConfig(localFilename=os.path.join(userData, "options"))

# LOADING
val = options.Read('perspectives')
if val:
    self._mgr.LoadPerspective(perspective)
    self._mgr.Update()

# SAVING
config.Write('perspectives', self._mgr.SavePerspective())
config.Flush()

Or something along these lines. You can save multiple perspectives by
storing them in a list and do more or less as above.
  

Thanks that got me going.

It works so far fine with the exception of the notebook perspectives. I think I read here that this is not yet implemented, is this correct or am I missing something?

Werner

···

On Thu, Apr 2, 2009 at 1:56 PM, Werner F. Bruhin wrote: