Draft: gui_setstyle.py onApplyAnnot should check for doc (#8196)

This commit is contained in:
Roy-043
2023-01-15 00:20:34 +01:00
committed by GitHub
parent 0c1994e749
commit f7db685a28

View File

@@ -195,14 +195,17 @@ class Draft_SetStyle_TaskPanel:
def onApplyAnnot(self):
from draftutils import utils
objs = FreeCAD.ActiveDocument.Objects
typs = ["Dimension", "LinearDimension", "AngularDimension", "Text", "DraftText", "Label"]
for obj in objs:
if utils.get_type(obj) in typs:
self.apply_style_to_obj(obj)
if FreeCAD.ActiveDocument is not None: # Command can be called without a document.
from draftutils import utils
objs = FreeCAD.ActiveDocument.Objects
typs = ["Dimension", "LinearDimension", "AngularDimension",
"Text", "DraftText", "Label"]
for obj in objs:
if utils.get_type(obj) in typs:
self.apply_style_to_obj(obj)
def apply_style_to_obj(self, obj):
vobj = obj.ViewObject
if not vobj:
return