From: Robin Dunn Date: Wed, 10 Nov 2004 18:16:31 +0000 (+0000) Subject: Fixed GetSaveData and SetSaveData in wx.lib.multisash to not depend on X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2268569346a39bcff9b7ba734f85652a7bf4c2d9 Fixed GetSaveData and SetSaveData in wx.lib.multisash to not depend on the default way that class objectss are converted to strings. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/wxPython/docs/CHANGES.txt b/wxPython/docs/CHANGES.txt index c91b8b2016..ba86f7459f 100644 --- a/wxPython/docs/CHANGES.txt +++ b/wxPython/docs/CHANGES.txt @@ -24,7 +24,8 @@ OGL patch from Shane Holloway: that the child is in both self._children and self._divisions. Causes many problems when it's not. ;) - +Fixed GetSaveData and SetSaveData in wx.lib.multisash to not depend on +the default way that class objectss are converted to strings. diff --git a/wxPython/wx/lib/multisash.py b/wxPython/wx/lib/multisash.py index 34ed2599a4..fbf7217816 100644 --- a/wxPython/wx/lib/multisash.py +++ b/wxPython/wx/lib/multisash.py @@ -55,17 +55,18 @@ class MultiSash(wx.Window): def GetSaveData(self): saveData = {} - saveData['_defChild'] = str(self._defChild) + saveData['_defChild_class'] = self._defChild.__name__ + saveData['_defChild_mod'] = self._defChild.__module__ saveData['child'] = self.child.GetSaveData() return saveData def SetSaveData(self,data): - dChild = data['_defChild'] - mod = dChild.split('.')[0] + mod = data['_defChild_mod'] + dChild = mod + '.' + data['_defChild_class'] exec 'import %s' % mod self._defChild = eval(dChild) old = self.child - self.child = MultiSplit(self,self,wxPoint(0,0),self.GetSize()) + self.child = MultiSplit(self,self,wx.Point(0,0),self.GetSize()) self.child.SetSaveData(data['child']) old.Destroy() self.OnMultiSize(None) @@ -307,7 +308,8 @@ class MultiViewLeaf(wx.Window): def GetSaveData(self): saveData = {} - saveData['detailClass'] = str(self.detail.child.__class__) + saveData['detailClass_class'] = self.detail.child.__class__.__name__ + saveData['detailClass_mod'] = self.detail.child.__module__ if hasattr(self.detail.child,'GetSaveData'): attr = getattr(self.detail.child,'GetSaveData') if callable(attr): @@ -323,8 +325,8 @@ class MultiViewLeaf(wx.Window): return saveData def SetSaveData(self,data): - dChild = data['detailClass'] - mod = dChild.split('.')[0] + mod = data['detailClass_mod'] + dChild = mod + '.' + data['detailClass_class'] exec 'import %s' % mod detClass = eval(dChild) self.SetDimensions(data['x'],data['y'],data['w'],data['h'])