Draft: fix issue with undo (#8267)

This commit is contained in:
Roy-043
2023-01-31 21:38:19 +01:00
committed by GitHub
parent 28df3265cc
commit f9cdaaf3d9
25 changed files with 249 additions and 117 deletions

View File

@@ -120,31 +120,20 @@ class PathTwistedArray(DraftLink):
super(PathTwistedArray, self).linkSetup(obj)
obj.configLinkProperty(ElementCount='Count')
def onChanged(self, obj, prop):
"""Execute when a property is changed."""
super(PathTwistedArray, self).onChanged(obj, prop)
def onDocumentRestored(self, obj):
"""Execute code when the document is restored.
Add properties that don't exist.
"""
self.set_properties(obj)
if self.use_link:
self.linkSetup(obj)
else:
obj.setPropertyStatus('Shape', '-Transient')
if obj.Shape.isNull():
if getattr(obj, 'PlacementList', None):
self.buildShape(obj, obj.Placement, obj.PlacementList)
else:
self.execute(obj)
super(PathTwistedArray, self).onDocumentRestored(obj)
def execute(self, obj):
"""Execute when the object is created or recomputed."""
if not obj.Base or not obj.PathObject:
if self.props_changed_placement_only() \
or not obj.Base \
or not obj.PathObject:
self.props_changed_clear()
return
# placement of entire PathArray object
@@ -158,8 +147,8 @@ class PathTwistedArray(DraftLink):
count=count,
rot_factor=rot_factor)
return super(PathTwistedArray, self).buildShape(obj,
array_placement,
copy_placements)
self.buildShape(obj, array_placement, copy_placements)
self.props_changed_clear()
return (not self.use_link)
## @}