Draft: fix ScaleMultiplier on annotation objects
Object auto create the property when opening an old Draft annotation .
This commit is contained in:
committed by
Yorik van Havre
parent
130d8413bf
commit
cbeca1b4a6
@@ -20,7 +20,6 @@
|
||||
# * USA *
|
||||
# * *
|
||||
# ***************************************************************************
|
||||
|
||||
"""This module provides the object code for Draft Annotation.
|
||||
"""
|
||||
## @package annotation
|
||||
@@ -32,9 +31,15 @@ from PySide.QtCore import QT_TRANSLATE_NOOP
|
||||
from draftutils import gui_utils
|
||||
|
||||
class DraftAnnotation(object):
|
||||
"""The Draft Annotation Base object
|
||||
This class is not used directly, but inherited by all annotation
|
||||
"""The Draft Annotation Base object.
|
||||
|
||||
This class is not used directly, but inherited by all Draft annotation
|
||||
objects.
|
||||
|
||||
LinearDimension through DimensionBase
|
||||
AngularDimension through DimensionBase
|
||||
Label
|
||||
Text
|
||||
"""
|
||||
def __init__(self, obj, tp="Annotation"):
|
||||
"""Add general Annotation properties to the object"""
|
||||
@@ -42,6 +47,19 @@ class DraftAnnotation(object):
|
||||
self.Type = tp
|
||||
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
'''Check if new properties are present after object is recreated.'''
|
||||
if hasattr(obj, "ViewObject") and obj.ViewObject:
|
||||
if not 'ScaleMultiplier' in obj.ViewObject.PropertiesList:
|
||||
# annotation properties
|
||||
_msg = QT_TRANSLATE_NOOP("Draft",
|
||||
"Adding property ScaleMultiplier to ")
|
||||
App.Console.PrintMessage(_msg + obj.Name + "\n")
|
||||
obj.ViewObject.addProperty("App::PropertyFloat","ScaleMultiplier",
|
||||
"Annotation",QT_TRANSLATE_NOOP("App::Property",
|
||||
"Dimension size overall multiplier"))
|
||||
obj.ViewObject.ScaleMultiplier = 1.00
|
||||
|
||||
def __getstate__(self):
|
||||
return self.Type
|
||||
|
||||
|
||||
Reference in New Issue
Block a user