Restore ViewObject implementation for all Draft objects
In my tests the code works fine. Using @AIRCAP's instructions, I have created a 'broken' file from draft_test_objects.FCStd.
This commit is contained in:
@@ -31,6 +31,7 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
|
||||
import FreeCAD as App
|
||||
from draftobjects.base import DraftObject
|
||||
from draftutils import gui_utils
|
||||
from draftutils import params
|
||||
|
||||
|
||||
@@ -38,7 +39,7 @@ class Ellipse(DraftObject):
|
||||
"""The Circle object"""
|
||||
|
||||
def __init__(self, obj):
|
||||
super(Ellipse, self).__init__(obj, "Ellipse")
|
||||
super().__init__(obj, "Ellipse")
|
||||
|
||||
_tip = QT_TRANSLATE_NOOP("App::Property","Start angle of the elliptical arc")
|
||||
obj.addProperty("App::PropertyAngle", "FirstAngle", "Draft", _tip)
|
||||
@@ -61,6 +62,10 @@ class Ellipse(DraftObject):
|
||||
|
||||
obj.MakeFace = params.get_param("fillmode")
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
super().onDocumentRestored(obj)
|
||||
gui_utils.restore_view_object(obj, vp_module="view_base", vp_class="ViewProviderDraft")
|
||||
|
||||
def execute(self, obj):
|
||||
if self.props_changed_placement_only():
|
||||
obj.positionBySupport()
|
||||
|
||||
Reference in New Issue
Block a user