Phoenix and wx.lib.agw.persist

The code below works fine in wx 2.8*, but fails to do anything with with 3*
I don’t see what the difference is in the 3* docs…
Is there a new, or better, idiom?

BTW, “Upload” feature failed on Google…

def save_state(self, path=None):
if path is not None:
self._persistMgr.SetPersistenceFile(path)
for obj in [self, self.panelEKGPlot.Tools]:
self._persistMgr.SaveAndUnregister(obj)
for key in dir(obj):
try:
val = getattr(obj, key)
except AttributeError:
continue
try:
self._persistMgr.SaveAndUnregister(val)
except (TypeError, AttributeError):
pass
except:
print(‘save err:’, key, sys.exc_info())
for obj in self.panelEKGPlot.checkBoxList:
for key in dir(obj):
try:
val = getattr(obj, key)
except AttributeError:
continue
try:
self._persistMgr.SaveAndUnregister(val)
except (TypeError, Exception, AttributeError):
pass
except:
print(‘save err:’, key, sys.exc_info())
#self._persistMgr.SaveAndUnregister(self.checkBoxRemoveOffsets)
#self._persistMgr.RegisterAndRestore(self.choiceMRUDs)
try:
self._persistMgr.RegisterAndRestore(self.choiceMRUDs)
except (TypeError, Exception, AttributeError):
pass
except:
print(‘restore err:’, key, sys.exc_info())

···

Hi Ray,

The code below works fine in wx 2.8*, but fails to do anything with with 3*
I don't see what the difference is in the 3* docs...
Is there a new, or better, idiom?

BTW, "Upload" feature failed on Google...

I do see the code in your first post, but it is kind of 'dimmed'.

I just do:

         self.persistMgr.RegisterAndRestoreAll(self.view)
         if self.persistMgr.HasRestored():
             self.viewLayout(self.view)
         else:
             self.doLayout()

and on close:
        self.persistMgr.SaveAndUnregister()

This works for me in 2.9.5 and in Phoenix, haven't tried in 3.0 classic.

Why are you doing it for each object, persist if no window is given does it for all registered windows.

Could you do a MakingSampleApps - wxPyWiki and I'll try with classic.

Werner

···

On 4/17/2015 0:31, Ray S wrote:

Thanks Werner,

I’ll try your snip, I forget why I did it that way, it was first time with the module and I mangled some example code.
The main code is Boa-generated, but I have 2 sets of on-the-fly generated checkboxes that were trouble if I recall.
I’ll see if I can jin a short sample in Boa as well…

···

On Thursday, 16 April 2015 23:19:17 UTC-7, werner wrote:

Hi Ray,

On 4/17/2015 0:31, Ray S wrote:

The code below works fine in wx 2.8*, but fails to do anything with
with 3*

I don’t see what the difference is in the 3* docs…

Is there a new, or better, idiom?

BTW, “Upload” feature failed on Google…

I do see the code in your first post, but it is kind of ‘dimmed’.

I just do:

     self.persistMgr.RegisterAndRestoreAll(self.view)

     if self.persistMgr.HasRestored():

         self.viewLayout(self.view)

     else:

         self.doLayout()

and on close:

    self.persistMgr.SaveAndUnregister()

This works for me in 2.9.5 and in Phoenix, haven’t tried in 3.0 classic.

Why are you doing it for each object, persist if no window is given does
it for all registered windows.

Could you do a http://wiki.wxpython.org/MakingSampleApps and I’ll try
with classic.