App: fixes #10460: App::PropertyPythonObject is not saving data

Since Py3.11 the methods names __setstate__ and __getstate__ conflict with the method names added to the object class.
Thus rename them to 'loads' and 'dumps'
This commit is contained in:
wmayer
2023-09-22 16:06:21 +02:00
committed by Chris Hennes
parent 97d84ec184
commit 83d4080fe8
75 changed files with 227 additions and 227 deletions

View File

@@ -118,7 +118,7 @@ class ViewProviderDraft(object):
"Defines the size of the SVG pattern."))
vobj.PatternSize = utils.get_param("HatchPatternSize", 1)
def __getstate__(self):
def dumps(self):
"""Return a tuple of all serializable objects or None.
When saving the document this view provider object gets stored
@@ -138,7 +138,7 @@ class ViewProviderDraft(object):
"""
return None
def __setstate__(self, state):
def loads(self, state):
"""Set some internal properties for all restored objects.
When a document is restored this method is used to set some properties
@@ -147,7 +147,7 @@ class ViewProviderDraft(object):
Override this method to define the properties to change for the
restored serialized objects.
By default no objects were serialized with `__getstate__`,
By default no objects were serialized with `dumps`,
so nothing needs to be done here, and it returns `None`.
Parameters

View File

@@ -38,10 +38,10 @@ class ViewProviderClone:
def getIcon(self):
return ":/icons/Draft_Clone.svg"
def __getstate__(self):
def dumps(self):
return None
def __setstate__(self, state):
def loads(self, state):
return None
def getDisplayModes(self, vobj):

View File

@@ -162,11 +162,11 @@ class ViewProviderDraftAnnotation(object):
"Graphics",
_tip)
def __getstate__(self):
def dumps(self):
"""Return a tuple of objects to save or None."""
return None
def __setstate__(self, state):
def loads(self, state):
"""Set the internal properties from the restored state."""
return None

View File

@@ -41,11 +41,11 @@ class ViewProviderDraftHatch:
return ":/icons/Draft_Hatch.svg"
def __getstate__(self):
def dumps(self):
return None
def __setstate__(self, state):
def loads(self, state):
return None

View File

@@ -204,11 +204,11 @@ class ViewProviderLayer:
"""Return the saved display mode."""
return mode
def __getstate__(self):
def dumps(self):
"""Return a tuple of objects to save or None."""
return None
def __setstate__(self, state):
def loads(self, state):
"""Set the internal properties from the restored state."""
return None
@@ -574,11 +574,11 @@ class ViewProviderLayerContainer:
doc.recompute()
doc.commitTransaction()
def __getstate__(self):
def dumps(self):
"""Return a tuple of objects to save or None."""
return None
def __setstate__(self, state):
def loads(self, state):
"""Set the internal properties from the restored state."""
return None

View File

@@ -227,10 +227,10 @@ class ViewProviderWorkingPlaneProxy:
self.drawstyle.lineWidth = vobj.LineWidth
return
def __getstate__(self):
def dumps(self):
return None
def __setstate__(self,state):
def loads(self,state):
return None
## @}