Draft: Prevent user to remove core properties

This commit is contained in:
Florian Foinant-Willig
2025-03-16 22:21:44 +01:00
committed by Kacper Donat
parent 4a61a49456
commit 19c125e898
34 changed files with 386 additions and 250 deletions

View File

@@ -97,7 +97,7 @@ class Array(DraftLink):
if "Base" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The base object that will be duplicated")
obj.addProperty("App::PropertyLink", "Base", "Objects", _tip)
obj.addProperty("App::PropertyLink", "Base", "Objects", _tip, locked=True)
obj.Base = None
if "ArrayType" not in properties:
@@ -116,7 +116,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyEnumeration",
"ArrayType",
"Objects",
_tip)
_tip,
locked=True)
obj.ArrayType = ['ortho', 'polar', 'circular']
if "Fuse" not in properties:
@@ -127,7 +128,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyBool",
"Fuse",
"Objects",
_tip)
_tip,
locked=True)
obj.Fuse = False
if "Count" not in properties:
@@ -140,7 +142,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"Count",
"Objects",
_tip)
_tip,
locked=True)
obj.Count = 0
obj.setEditorMode("Count", 1) # Read only
@@ -151,7 +154,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyPlacementList",
"PlacementList",
"Objects",
_tip)
_tip,
locked=True)
obj.PlacementList = []
def set_ortho_properties(self, obj):
@@ -164,7 +168,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"NumberX",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.NumberX = 2
if "NumberY" not in properties:
@@ -173,7 +178,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"NumberY",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.NumberY = 2
if "NumberZ" not in properties:
@@ -182,7 +188,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"NumberZ",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.NumberZ = 1
if "IntervalX" not in properties:
@@ -192,7 +199,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"IntervalX",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.IntervalX = App.Vector(50, 0, 0)
if "IntervalY" not in properties:
@@ -202,7 +210,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"IntervalY",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.IntervalY = App.Vector(0, 50, 0)
if "IntervalZ" not in properties:
@@ -212,7 +221,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"IntervalZ",
"Orthogonal array",
_tip)
_tip,
locked=True)
obj.IntervalZ = App.Vector(0, 0, 50)
def set_polar_circular_properties(self, obj):
@@ -227,7 +237,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVector",
"Axis",
"Polar/circular array",
_tip)
_tip,
locked=True)
obj.Axis = App.Vector(0, 0, 1)
if "Center" not in properties:
@@ -238,7 +249,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"Center",
"Polar/circular array",
_tip)
_tip,
locked=True)
obj.Center = App.Vector(0, 0, 0)
# The AxisReference property must be attached after Axis and Center
@@ -257,7 +269,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyLinkGlobal",
"AxisReference",
"Objects",
_tip)
_tip,
locked=True)
obj.AxisReference = None
def set_polar_properties(self, obj):
@@ -270,7 +283,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"NumberPolar",
"Polar array",
_tip)
_tip,
locked=True)
obj.NumberPolar = 5
if "IntervalAxis" not in properties:
@@ -280,7 +294,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"IntervalAxis",
"Polar array",
_tip)
_tip,
locked=True)
obj.IntervalAxis = App.Vector(0, 0, 0)
if "Angle" not in properties:
@@ -289,7 +304,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyAngle",
"Angle",
"Polar array",
_tip)
_tip,
locked=True)
obj.Angle = 360
def set_circular_properties(self, obj):
@@ -302,7 +318,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyDistance",
"RadialDistance",
"Circular array",
_tip)
_tip,
locked=True)
obj.RadialDistance = 50
if "TangentialDistance" not in properties:
@@ -312,7 +329,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyDistance",
"TangentialDistance",
"Circular array",
_tip)
_tip,
locked=True)
obj.TangentialDistance = 25
if "NumberCircles" not in properties:
@@ -322,7 +340,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"NumberCircles",
"Circular array",
_tip)
_tip,
locked=True)
obj.NumberCircles = 3
if "Symmetry" not in properties:
@@ -333,7 +352,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyInteger",
"Symmetry",
"Circular array",
_tip)
_tip,
locked=True)
obj.Symmetry = 1
def set_link_properties(self, obj):
@@ -348,7 +368,8 @@ class Array(DraftLink):
obj.addProperty("App::PropertyBool",
"ExpandArray",
"Objects",
_tip)
_tip,
locked=True)
obj.ExpandArray = False
def linkSetup(self, obj):

View File

@@ -43,31 +43,31 @@ class BezCurve(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"The points of the Bezier curve")
obj.addProperty("App::PropertyVectorList", "Points", "Draft", _tip)
obj.addProperty("App::PropertyVectorList", "Points", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The degree of the Bezier function")
obj.addProperty("App::PropertyInteger", "Degree", "Draft", _tip)
obj.addProperty("App::PropertyInteger", "Degree", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Continuity")
obj.addProperty("App::PropertyIntegerList", "Continuity", "Draft", _tip)
obj.addProperty("App::PropertyIntegerList", "Continuity", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"If the Bezier curve should be closed or not")
obj.addProperty("App::PropertyBool", "Closed", "Draft", _tip)
obj.addProperty("App::PropertyBool", "Closed", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Create a face if this curve is closed")
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip)
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The length of this object")
obj.addProperty("App::PropertyLength", "Length", "Draft", _tip)
obj.addProperty("App::PropertyLength", "Length", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False

View File

@@ -41,7 +41,7 @@ class Block(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"The components of this block")
obj.addProperty("App::PropertyLinkList","Components", "Draft", _tip)
obj.addProperty("App::PropertyLinkList","Components", "Draft", _tip, locked=True)
def onDocumentRestored(self, obj):
super().onDocumentRestored(obj)

View File

@@ -43,18 +43,18 @@ class BSpline(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"The points of the B-spline")
obj.addProperty("App::PropertyVectorList","Points", "Draft", _tip)
obj.addProperty("App::PropertyVectorList","Points", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"If the B-spline is closed or not")
obj.addProperty("App::PropertyBool","Closed", "Draft", _tip)
obj.addProperty("App::PropertyBool","Closed", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Create a face if this spline is closed")
obj.addProperty("App::PropertyBool","MakeFace", "Draft",_tip)
obj.addProperty("App::PropertyBool","MakeFace", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object")
obj.addProperty("App::PropertyArea","Area", "Draft", _tip)
obj.addProperty("App::PropertyArea","Area", "Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False
@@ -70,7 +70,7 @@ class BSpline(DraftObject):
def assureProperties(self, obj): # for Compatibility with older versions
if not hasattr(obj, "Parameterization"):
_tip = QT_TRANSLATE_NOOP("App::Property","Parameterization factor")
obj.addProperty("App::PropertyFloat", "Parameterization", "Draft", _tip)
obj.addProperty("App::PropertyFloat", "Parameterization", "Draft", _tip, locked=True)
obj.Parameterization = 1.0
self.knotSeq = []

View File

@@ -43,24 +43,24 @@ class Circle(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property", "Start angle of the arc")
obj.addProperty("App::PropertyAngle", "FirstAngle",
"Draft", _tip)
"Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "End angle of the arc (for a full circle, \
give it same value as First Angle)")
obj.addProperty("App::PropertyAngle","LastAngle",
"Draft", _tip)
"Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Radius of the circle")
obj.addProperty("App::PropertyLength", "Radius",
"Draft", _tip)
"Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Create a face")
obj.addProperty("App::PropertyBool", "MakeFace",
"Draft", _tip)
"Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object")
obj.addProperty("App::PropertyArea", "Area",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")

View File

@@ -49,19 +49,19 @@ class Clone(DraftObject):
pl = obj.PropertiesList
if not "Objects" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property", "The objects included in this clone")
obj.addProperty("App::PropertyLinkListGlobal", "Objects", "Draft", _tip)
obj.addProperty("App::PropertyLinkListGlobal", "Objects", "Draft", _tip, locked=True)
if not "Scale" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property", "The scale factor of this clone")
obj.addProperty("App::PropertyVector", "Scale", "Draft", _tip)
obj.addProperty("App::PropertyVector", "Scale", "Draft", _tip, locked=True)
obj.Scale = App.Vector(1, 1, 1)
if not "Fuse" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"If Clones includes several objects,\n"
"set True for fusion or False for compound")
obj.addProperty("App::PropertyBool", "Fuse", "Draft", _tip)
obj.addProperty("App::PropertyBool", "Fuse", "Draft", _tip, locked=True)
if not "ForceCompound" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property", "Always create a compound")
obj.addProperty("App::PropertyBool", "ForceCompound", "Draft", _tip)
obj.addProperty("App::PropertyBool", "ForceCompound", "Draft", _tip, locked=True)
def onDocumentRestored(self, obj):
super().onDocumentRestored(obj)

View File

@@ -135,7 +135,8 @@ class DimensionBase(DraftAnnotation):
obj.addProperty("App::PropertyVector",
"Normal",
"Dimension",
_tip)
_tip,
locked=True)
obj.Normal = App.Vector(0, 0, 1)
# TODO: remove Support property as it is not used at all.
@@ -148,7 +149,8 @@ class DimensionBase(DraftAnnotation):
obj.addProperty("App::PropertyLink",
"Support",
"Dimension",
_tip)
_tip,
locked=True)
obj.Support = None
if "LinkedGeometry" not in properties:
@@ -165,7 +167,8 @@ class DimensionBase(DraftAnnotation):
obj.addProperty("App::PropertyLinkSubList",
"LinkedGeometry",
"Dimension",
_tip)
_tip,
locked=True)
obj.LinkedGeometry = []
if "Dimline" not in properties:
@@ -188,7 +191,8 @@ class DimensionBase(DraftAnnotation):
obj.addProperty("App::PropertyVectorDistance",
"Dimline",
"Dimension",
_tip)
_tip,
locked=True)
obj.Dimline = App.Vector(0, 1, 0)
def update_properties_0v21(self, obj, vobj):
@@ -234,7 +238,8 @@ class LinearDimension(DimensionBase):
obj.addProperty("App::PropertyVectorDistance",
"Start",
"Linear/radial dimension",
_tip)
_tip,
locked=True)
obj.Start = App.Vector(0, 0, 0)
if "End" not in properties:
@@ -248,7 +253,8 @@ class LinearDimension(DimensionBase):
obj.addProperty("App::PropertyVectorDistance",
"End",
"Linear/radial dimension",
_tip)
_tip,
locked=True)
obj.End = App.Vector(1, 0, 0)
if "Direction" not in properties:
@@ -260,7 +266,8 @@ class LinearDimension(DimensionBase):
obj.addProperty("App::PropertyVector",
"Direction",
"Linear/radial dimension",
_tip)
_tip,
locked=True)
if "Distance" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
@@ -277,7 +284,8 @@ class LinearDimension(DimensionBase):
obj.addProperty("App::PropertyLength",
"Distance",
"Linear/radial dimension",
_tip)
_tip,
locked=True)
obj.Distance = 0
if "Diameter" not in properties:
@@ -288,7 +296,8 @@ class LinearDimension(DimensionBase):
obj.addProperty("App::PropertyBool",
"Diameter",
"Radial dimension",
_tip)
_tip,
locked=True)
obj.Diameter = False
def onDocumentRestored(self, obj):
@@ -521,7 +530,8 @@ class AngularDimension(DimensionBase):
obj.addProperty("App::PropertyAngle",
"FirstAngle",
"Angular dimension",
_tip)
_tip,
locked=True)
obj.FirstAngle = 0
if "LastAngle" not in properties:
@@ -532,7 +542,8 @@ class AngularDimension(DimensionBase):
obj.addProperty("App::PropertyAngle",
"LastAngle",
"Angular dimension",
_tip)
_tip,
locked=True)
obj.LastAngle = 90
if "Center" not in properties:
@@ -547,7 +558,8 @@ class AngularDimension(DimensionBase):
obj.addProperty("App::PropertyVectorDistance",
"Center",
"Angular dimension",
_tip)
_tip,
locked=True)
obj.Center = App.Vector(0, 0, 0)
if "Angle" not in properties:
@@ -561,7 +573,8 @@ class AngularDimension(DimensionBase):
obj.addProperty("App::PropertyAngle",
"Angle",
"Angular dimension",
_tip)
_tip,
locked=True)
obj.Angle = 0
def onDocumentRestored(self, obj):

View File

@@ -100,7 +100,8 @@ class DraftLink(DraftObject):
obj.addProperty("App::PropertyBool",
"AlwaysSyncPlacement",
"Draft",
_tip)
_tip,
locked=True)
if hasattr(obj, 'ShowElement'):
# Rename 'ShowElement' property to 'ExpandArray' to avoid conflict
@@ -113,7 +114,8 @@ class DraftLink(DraftObject):
obj.addProperty("App::PropertyBool",
"ExpandArray",
"Draft",
_tip)
_tip,
locked=True)
obj.ExpandArray = showElement
obj.configLinkProperty(ShowElement='ExpandArray')
@@ -129,16 +131,18 @@ class DraftLink(DraftObject):
if not hasattr(obj, 'LinkTransform'):
obj.addProperty('App::PropertyBool',
'LinkTransform',
' Link')
' Link',
locked=True)
if not hasattr(obj, 'ColoredElements'):
obj.addProperty('App::PropertyLinkSubHidden',
'ColoredElements',
' Link')
' Link',
locked=True)
obj.setPropertyStatus('ColoredElements', 'Hidden')
if not hasattr(obj,'LinkCopyOnChange'):
obj.addProperty("App::PropertyEnumeration","LinkCopyOnChange"," Link")
obj.addProperty("App::PropertyEnumeration","LinkCopyOnChange"," Link",locked=True)
obj.configLinkProperty('LinkCopyOnChange','LinkTransform','ColoredElements')

View File

@@ -42,23 +42,23 @@ class Ellipse(DraftObject):
super().__init__(obj, "Ellipse")
_tip = QT_TRANSLATE_NOOP("App::Property","Start angle of the elliptical arc")
obj.addProperty("App::PropertyAngle", "FirstAngle", "Draft", _tip)
obj.addProperty("App::PropertyAngle", "FirstAngle", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","End angle of the elliptical arc \n\
(for a full circle, give it same value as First Angle)")
obj.addProperty("App::PropertyAngle", "LastAngle", "Draft", _tip)
obj.addProperty("App::PropertyAngle", "LastAngle", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","Minor radius of the ellipse")
obj.addProperty("App::PropertyLength", "MinorRadius", "Draft", _tip)
obj.addProperty("App::PropertyLength", "MinorRadius", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","Major radius of the ellipse")
obj.addProperty("App::PropertyLength", "MajorRadius", "Draft", _tip)
obj.addProperty("App::PropertyLength", "MajorRadius", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","Create a face")
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip)
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","Area of this object")
obj.addProperty("App::PropertyArea", "Area","Draft", _tip)
obj.addProperty("App::PropertyArea", "Area","Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")

View File

@@ -44,22 +44,22 @@ class Facebinder(DraftObject):
super().__init__(obj, "Facebinder")
_tip = QT_TRANSLATE_NOOP("App::Property","Linked faces")
obj.addProperty("App::PropertyLinkSubList", "Faces", "Draft", _tip)
obj.addProperty("App::PropertyLinkSubList", "Faces", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","Specifies if splitter lines must be removed")
obj.addProperty("App::PropertyBool","RemoveSplitter", "Draft", _tip)
obj.addProperty("App::PropertyBool","RemoveSplitter", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","An optional extrusion value to be applied to all faces")
obj.addProperty("App::PropertyDistance","Extrusion", "Draft" , _tip)
obj.addProperty("App::PropertyDistance","Extrusion", "Draft" , _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","An optional offset value to be applied to all faces")
obj.addProperty("App::PropertyDistance","Offset", "Draft" , _tip)
obj.addProperty("App::PropertyDistance","Offset", "Draft" , _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","This specifies if the shapes sew")
obj.addProperty("App::PropertyBool","Sew", "Draft", _tip)
obj.addProperty("App::PropertyBool","Sew", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property","The area of the faces of this Facebinder")
obj.addProperty("App::PropertyArea","Area", "Draft", _tip)
obj.addProperty("App::PropertyArea","Area", "Draft", _tip, locked=True)
obj.setEditorMode("Area", 1)
def onDocumentRestored(self, obj):

View File

@@ -50,7 +50,8 @@ class Fillet(DraftObject):
obj.addProperty("App::PropertyVectorDistance",
"Start",
"Draft",
_tip)
_tip,
locked=True)
obj.Start = App.Vector(0, 0, 0)
if not hasattr(obj, "End"):
@@ -58,7 +59,8 @@ class Fillet(DraftObject):
obj.addProperty("App::PropertyVectorDistance",
"End",
"Draft",
_tip)
_tip,
locked=True)
obj.End = App.Vector(0, 0, 0)
if not hasattr(obj, "Length"):
@@ -66,7 +68,8 @@ class Fillet(DraftObject):
obj.addProperty("App::PropertyLength",
"Length",
"Draft",
_tip)
_tip,
locked=True)
obj.Length = 0
if not hasattr(obj, "FilletRadius"):
@@ -74,7 +77,8 @@ class Fillet(DraftObject):
obj.addProperty("App::PropertyLength",
"FilletRadius",
"Draft",
_tip)
_tip,
locked=True)
obj.FilletRadius = 0
# TODO: these two properties should link two straight lines

View File

@@ -46,22 +46,22 @@ class Hatch(DraftObject):
pl = obj.PropertiesList
if not "Base" in pl:
obj.addProperty("App::PropertyLink","Base","Hatch",
QT_TRANSLATE_NOOP("App::Property","The base object used by this object"))
QT_TRANSLATE_NOOP("App::Property","The base object used by this object"), locked=True)
if not "File" in pl:
obj.addProperty("App::PropertyFile","File","Hatch",
QT_TRANSLATE_NOOP("App::Property","The PAT file used by this object"))
QT_TRANSLATE_NOOP("App::Property","The PAT file used by this object"), locked=True)
if not "Pattern" in pl:
obj.addProperty("App::PropertyString","Pattern","Hatch",
QT_TRANSLATE_NOOP("App::Property","The pattern name used by this object"))
QT_TRANSLATE_NOOP("App::Property","The pattern name used by this object"), locked=True)
if not "Scale" in pl:
obj.addProperty("App::PropertyFloat","Scale","Hatch",
QT_TRANSLATE_NOOP("App::Property","The pattern scale used by this object"))
QT_TRANSLATE_NOOP("App::Property","The pattern scale used by this object"), locked=True)
if not "Rotation" in pl:
obj.addProperty("App::PropertyAngle","Rotation","Hatch",
QT_TRANSLATE_NOOP("App::Property","The pattern rotation used by this object"))
QT_TRANSLATE_NOOP("App::Property","The pattern rotation used by this object"), locked=True)
if not "Translate" in pl:
obj.addProperty("App::PropertyBool","Translate","Hatch",
QT_TRANSLATE_NOOP("App::Property","If set to False, hatch is applied as is to the faces, without translation (this might give wrong results for non-XY faces)"))
QT_TRANSLATE_NOOP("App::Property","If set to False, hatch is applied as is to the faces, without translation (this might give wrong results for non-XY faces)"), locked=True)
obj.Translate = True
self.Type = "Hatch"

View File

@@ -67,7 +67,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyVector",
"TargetPoint",
"Target",
_tip)
_tip,
locked=True)
obj.TargetPoint = App.Vector(2, -1, 0)
if "Target" not in properties:
@@ -81,7 +82,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyLinkSub",
"Target",
"Target",
_tip)
_tip,
locked=True)
obj.Target = None
def set_leader_properties(self, obj):
@@ -111,7 +113,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyVectorList",
"Points",
"Leader",
_tip)
_tip,
locked=True)
obj.Points = []
if "StraightDirection" not in properties:
@@ -126,7 +129,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyEnumeration",
"StraightDirection",
"Leader",
_tip)
_tip,
locked=True)
obj.StraightDirection = ["Horizontal", "Vertical", "Custom"]
if "StraightDistance" not in properties:
@@ -144,7 +148,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyDistance",
"StraightDistance",
"Leader",
_tip)
_tip,
locked=True)
obj.StraightDistance = 1
def set_label_properties(self, obj):
@@ -158,7 +163,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyPlacement",
"Placement",
"Label",
_tip)
_tip,
locked=True)
obj.Placement = App.Placement()
if "CustomText" not in properties:
@@ -168,7 +174,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyStringList",
"CustomText",
"Label",
_tip)
_tip,
locked=True)
obj.CustomText = "Label"
if "Text" not in properties:
@@ -183,7 +190,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyStringList",
"Text",
"Label",
_tip)
_tip,
locked=True)
obj.setEditorMode("Text", 1) # Read only
# TODO: maybe here we can define a second and third 'label type'
@@ -218,7 +226,8 @@ class Label(DraftAnnotation):
obj.addProperty("App::PropertyEnumeration",
"LabelType",
"Label",
_tip)
_tip,
locked=True)
obj.LabelType = get_label_types()
def onDocumentRestored(self, obj):

View File

@@ -61,7 +61,8 @@ class Layer:
obj.addProperty("App::PropertyLinkListHidden",
"Group",
"Layer",
_tip)
_tip,
locked=True)
def onDocumentRestored(self, obj):
"""Execute code when the document is restored."""

View File

@@ -216,7 +216,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLinkGlobal",
"Base",
"Objects",
_tip)
_tip,
locked=True)
obj.Base = None
if "PathObject" not in properties:
@@ -224,7 +225,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLinkGlobal",
"PathObject",
"Objects",
_tip)
_tip,
locked=True)
obj.PathObject = None
# TODO: the 'PathSubelements' property must be changed,
@@ -239,7 +241,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLinkSubListGlobal",
"PathSubelements",
"Objects",
_tip)
_tip,
locked=True)
obj.PathSubelements = []
if "Fuse" not in properties:
@@ -250,7 +253,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"Fuse",
"Objects",
_tip)
_tip,
locked=True)
obj.Fuse = False
if self.use_link and "ExpandArray" not in properties:
@@ -258,7 +262,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"ExpandArray",
"Objects",
_tip)
_tip,
locked=True)
obj.ExpandArray = False
obj.setPropertyStatus('Shape', 'Transient')
@@ -269,7 +274,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyPlacementList",
"PlacementList",
"Objects",
_tip)
_tip,
locked=True)
obj.PlacementList = []
def set_align_properties(self, obj, properties):
@@ -279,7 +285,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyVectorDistance",
"ExtraTranslation",
"Alignment",
_tip)
_tip,
locked=True)
obj.ExtraTranslation = App.Vector(0, 0, 0)
if "TangentVector" not in properties:
@@ -287,7 +294,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyVector",
"TangentVector",
"Alignment",
_tip)
_tip,
locked=True)
obj.TangentVector = App.Vector(1, 0, 0)
if "ForceVertical" not in properties:
@@ -295,7 +303,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"ForceVertical",
"Alignment",
_tip)
_tip,
locked=True)
obj.ForceVertical = False
if "VerticalVector" not in properties:
@@ -303,7 +312,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyVector",
"VerticalVector",
"Alignment",
_tip)
_tip,
locked=True)
obj.VerticalVector = App.Vector(0, 0, 1)
if "AlignMode" not in properties:
@@ -311,7 +321,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyEnumeration",
"AlignMode",
"Alignment",
_tip)
_tip,
locked=True)
obj.AlignMode = ["Original", "Frenet", "Tangent"]
obj.AlignMode = "Original"
@@ -320,7 +331,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"ReversePath",
"Alignment",
_tip)
_tip,
locked=True)
obj.ReversePath = False
# The Align property must be attached after other align properties
@@ -330,7 +342,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"Align",
"Alignment",
_tip)
_tip,
locked=True)
obj.Align = False
def set_spacing_properties(self, obj, properties):
@@ -340,7 +353,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyInteger",
"Count",
"Spacing",
_tip)
_tip,
locked=True)
obj.Count = 4
if "SpacingMode" not in properties:
@@ -354,7 +368,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyEnumeration",
"SpacingMode",
"Spacing",
_tip)
_tip,
locked=True)
obj.SpacingMode = ["Fixed count", "Fixed spacing", "Fixed count and spacing"]
obj.SpacingMode = "Fixed count"
@@ -363,7 +378,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLength",
"SpacingUnit",
"Spacing",
_tip)
_tip,
locked=True)
obj.SpacingUnit = 20.0
obj.setPropertyStatus("SpacingUnit", "Hidden")
@@ -372,7 +388,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyBool",
"UseSpacingPattern",
"Spacing",
_tip)
_tip,
locked=True)
obj.UseSpacingPattern = False
if "SpacingPattern" not in properties:
@@ -380,7 +397,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyFloatList",
"SpacingPattern",
"Spacing",
_tip)
_tip,
locked=True)
obj.SpacingPattern = [1, 2]
obj.setPropertyStatus("SpacingPattern", "Hidden")
@@ -389,7 +407,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLength",
"StartOffset",
"Spacing",
_tip)
_tip,
locked=True)
obj.StartOffset = 0.0
if "EndOffset" not in properties:
@@ -397,7 +416,8 @@ class PathArray(DraftLink):
obj.addProperty("App::PropertyLength",
"EndOffset",
"Spacing",
_tip)
_tip,
locked=True)
obj.EndOffset = 0.0
def linkSetup(self, obj):

View File

@@ -84,14 +84,16 @@ class PathTwistedArray(DraftLink):
obj.addProperty("App::PropertyLink",
"Base",
"Objects",
QT_TRANSLATE_NOOP("App::Property","The base object that will be duplicated."))
QT_TRANSLATE_NOOP("App::Property","The base object that will be duplicated."),
locked=True)
obj.Base = None
if "PathObject" not in properties:
obj.addProperty("App::PropertyLink",
"PathObject",
"Objects",
QT_TRANSLATE_NOOP("App::Property","The object along which the copies will be distributed. It must contain 'Edges'."))
QT_TRANSLATE_NOOP("App::Property","The object along which the copies will be distributed. It must contain 'Edges'."),
locked=True)
obj.PathObject = None
if "Fuse" not in properties:
@@ -102,28 +104,32 @@ class PathTwistedArray(DraftLink):
obj.addProperty("App::PropertyBool",
"Fuse",
"Objects",
_tip)
_tip,
locked=True)
obj.Fuse = False
if "Count" not in properties:
obj.addProperty("App::PropertyInteger",
"Count",
"Objects",
QT_TRANSLATE_NOOP("App::Property","Number of copies to create."))
QT_TRANSLATE_NOOP("App::Property","Number of copies to create."),
locked=True)
obj.Count = 15
if "RotationFactor" not in properties:
obj.addProperty("App::PropertyFloat",
"RotationFactor",
"Objects",
QT_TRANSLATE_NOOP("App::Property","Rotation factor of the twisted array."))
QT_TRANSLATE_NOOP("App::Property","Rotation factor of the twisted array."),
locked=True)
obj.RotationFactor = 0.25
if self.use_link and "ExpandArray" not in properties:
obj.addProperty("App::PropertyBool",
"ExpandArray",
"Objects",
QT_TRANSLATE_NOOP("App::Property","Show the individual array elements (only for Link arrays)"))
QT_TRANSLATE_NOOP("App::Property","Show the individual array elements (only for Link arrays)"),
locked=True)
obj.ExpandArray = False
obj.setPropertyStatus('Shape', 'Transient')
@@ -134,7 +140,8 @@ class PathTwistedArray(DraftLink):
obj.addProperty("App::PropertyPlacementList",
"PlacementList",
"Objects",
_tip)
_tip,
locked=True)
obj.PlacementList = []
def linkSetup(self, obj):

View File

@@ -42,13 +42,13 @@ class Point(DraftObject):
super().__init__(obj, "Point")
_tip = QT_TRANSLATE_NOOP("App::Property", "X Location")
obj.addProperty("App::PropertyDistance", "X", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "X", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Y Location")
obj.addProperty("App::PropertyDistance", "Y", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "Y", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Z Location")
obj.addProperty("App::PropertyDistance", "Z", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "Z", "Draft", _tip, locked=True)
obj.X = x
obj.Y = y

View File

@@ -67,7 +67,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyLink",
"Base",
"Objects",
_tip)
_tip,
locked=True)
obj.Base = None
if "PointObject" not in properties:
@@ -75,7 +76,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyLink",
"PointObject",
"Objects",
_tip)
_tip,
locked=True)
obj.PointObject = None
if "Fuse" not in properties:
@@ -86,7 +88,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyBool",
"Fuse",
"Objects",
_tip)
_tip,
locked=True)
obj.Fuse = False
if "Count" not in properties:
@@ -94,7 +97,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyInteger",
"Count",
"Objects",
_tip)
_tip,
locked=True)
obj.Count = 0
obj.setEditorMode("Count", 1) # Read only
@@ -103,7 +107,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyPlacement",
"ExtraPlacement",
"Objects",
_tip)
_tip,
locked=True)
obj.ExtraPlacement = App.Placement()
if self.use_link and "ExpandArray" not in properties:
@@ -111,7 +116,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyBool",
"ExpandArray",
"Objects",
_tip)
_tip,
locked=True)
obj.setPropertyStatus('Shape', 'Transient')
if not self.use_link:
@@ -121,7 +127,8 @@ class PointArray(DraftLink):
obj.addProperty("App::PropertyPlacementList",
"PlacementList",
"Objects",
_tip)
_tip,
locked=True)
obj.PlacementList = []
def execute(self, obj):

View File

@@ -45,31 +45,31 @@ class Polygon(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"Number of faces")
obj.addProperty("App::PropertyInteger", "FacesNumber", "Draft", _tip)
obj.addProperty("App::PropertyInteger", "FacesNumber", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Radius of the control circle")
obj.addProperty("App::PropertyLength", "Radius", "Draft", _tip)
obj.addProperty("App::PropertyLength", "Radius", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"How the polygon must be drawn from the control circle")
obj.addProperty("App::PropertyEnumeration", "DrawMode", "Draft", _tip)
obj.addProperty("App::PropertyEnumeration", "DrawMode", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Radius to use to fillet the corners")
obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip)
obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Size of the chamfer to give to the corners")
obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip)
obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Create a face")
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip)
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")
obj.DrawMode = ['inscribed','circumscribed']

View File

@@ -43,28 +43,28 @@ class Rectangle(DraftObject):
super().__init__(obj, "Rectangle")
_tip = QT_TRANSLATE_NOOP("App::Property", "Length of the rectangle")
obj.addProperty("App::PropertyDistance", "Length", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "Length", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Height of the rectangle")
obj.addProperty("App::PropertyDistance", "Height", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "Height", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Radius to use to fillet the corners")
obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip)
obj.addProperty("App::PropertyLength", "FilletRadius", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Size of the chamfer to give to the corners")
obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip)
obj.addProperty("App::PropertyLength", "ChamferSize", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Create a face")
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip)
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Horizontal subdivisions of this rectangle")
obj.addProperty("App::PropertyInteger", "Rows", "Draft", _tip)
obj.addProperty("App::PropertyInteger", "Rows", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "Vertical subdivisions of this rectangle")
obj.addProperty("App::PropertyInteger", "Columns", "Draft", _tip)
obj.addProperty("App::PropertyInteger", "Columns", "Draft", _tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property", "The area of this object")
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip)
obj.addProperty("App::PropertyArea", "Area", "Draft", _tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Length=1

View File

@@ -61,85 +61,85 @@ class Shape2DView(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"The base object this 2D view must represent")
obj.addProperty("App::PropertyLink", "Base",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "Projection" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The projection vector of this object")
obj.addProperty("App::PropertyVector", "Projection",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.Projection = App.Vector(0,0,1)
if not "ProjectionMode" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The way the viewed object must be projected")
obj.addProperty("App::PropertyEnumeration", "ProjectionMode",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.ProjectionMode = ["Solid", "Individual Faces",
"Cutlines", "Cutfaces","Solid faces"]
if not "FaceNumbers" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"The indices of the faces to be projected in Individual Faces mode")
obj.addProperty("App::PropertyIntegerList", "FaceNumbers",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "HiddenLines" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"Show hidden lines")
obj.addProperty("App::PropertyBool", "HiddenLines",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.HiddenLines = False
if not "FuseArch" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"Fuse wall and structure objects of same type and material")
obj.addProperty("App::PropertyBool", "FuseArch",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "Tessellation" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"Tessellate Ellipses and B-splines into line segments")
obj.addProperty("App::PropertyBool", "Tessellation",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.Tessellation = False
if not "InPlace" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"For Cutlines and Cutfaces modes, this leaves the faces at the cut location")
obj.addProperty("App::PropertyBool", "InPlace",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.InPlace = True
if not "SegmentLength" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"Length of line segments if tessellating Ellipses or B-splines into line segments")
obj.addProperty("App::PropertyFloat", "SegmentLength",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.SegmentLength = .05
if not "VisibleOnly" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"If this is True, this object will include only visible objects")
obj.addProperty("App::PropertyBool", "VisibleOnly",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.VisibleOnly = False
if not "ExclusionPoints" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"A list of exclusion points. Any edge touching any of those points will not be drawn.")
obj.addProperty("App::PropertyVectorList", "ExclusionPoints",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "ExclusionNames" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"A list of exclusion object names. Any object viewed that matches a name from the list will not be drawn.")
obj.addProperty("App::PropertyStringList", "ExclusionNames",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "OnlySolids" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"If this is True, only solid geometry is handled. This overrides the base object's Only Solids property")
obj.addProperty("App::PropertyBool", "OnlySolids",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "Clip" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"If this is True, the contents are clipped to the borders of the section plane, if applicable. This overrides the base object's Clip property")
obj.addProperty("App::PropertyBool", "Clip",
"Draft", _tip)
"Draft", _tip, locked=True)
if not "AutoUpdate" in pl:
_tip = QT_TRANSLATE_NOOP("App::Property",
"This object will be recomputed only if this is True.")
obj.addProperty("App::PropertyBool", "AutoUpdate",
"Draft", _tip)
"Draft", _tip, locked=True)
obj.AutoUpdate = True
def getProjected(self,obj,shape,direction):

View File

@@ -53,19 +53,19 @@ class ShapeString(DraftObject):
if "String" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Text string")
obj.addProperty("App::PropertyString", "String", "Draft", _tip)
obj.addProperty("App::PropertyString", "String", "Draft", _tip, locked=True)
if "FontFile" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Font file name")
obj.addProperty("App::PropertyFile", "FontFile", "Draft", _tip)
obj.addProperty("App::PropertyFile", "FontFile", "Draft", _tip, locked=True)
if "Size" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Height of text")
obj.addProperty("App::PropertyLength", "Size", "Draft", _tip)
obj.addProperty("App::PropertyLength", "Size", "Draft", _tip, locked=True)
if "Justification" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Horizontal and vertical alignment")
obj.addProperty("App::PropertyEnumeration", "Justification", "Draft", _tip)
obj.addProperty("App::PropertyEnumeration", "Justification", "Draft", _tip, locked=True)
obj.Justification = ["Top-Left", "Top-Center", "Top-Right",
"Middle-Left", "Middle-Center", "Middle-Right",
"Bottom-Left", "Bottom-Center", "Bottom-Right"]
@@ -73,33 +73,33 @@ class ShapeString(DraftObject):
if "JustificationReference" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Height reference used for justification")
obj.addProperty("App::PropertyEnumeration", "JustificationReference", "Draft", _tip)
obj.addProperty("App::PropertyEnumeration", "JustificationReference", "Draft", _tip, locked=True)
obj.JustificationReference = ["Cap Height", "Shape Height"]
obj.JustificationReference = "Cap Height"
if "KeepLeftMargin" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Keep left margin and leading white space when justification is left")
obj.addProperty("App::PropertyBool", "KeepLeftMargin", "Draft", _tip).KeepLeftMargin = False
obj.addProperty("App::PropertyBool", "KeepLeftMargin", "Draft", _tip, locked=True).KeepLeftMargin = False
if "ScaleToSize" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Scale to ensure cap height is equal to size")
obj.addProperty("App::PropertyBool", "ScaleToSize", "Draft", _tip).ScaleToSize = True
obj.addProperty("App::PropertyBool", "ScaleToSize", "Draft", _tip, locked=True).ScaleToSize = True
if "Tracking" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Inter-character spacing")
obj.addProperty("App::PropertyDistance", "Tracking", "Draft", _tip)
obj.addProperty("App::PropertyDistance", "Tracking", "Draft", _tip, locked=True)
if "ObliqueAngle" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Oblique (slant) angle")
obj.addProperty("App::PropertyAngle", "ObliqueAngle", "Draft", _tip)
obj.addProperty("App::PropertyAngle", "ObliqueAngle", "Draft", _tip, locked=True)
if "MakeFace" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Fill letters with faces")
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip).MakeFace = True
obj.addProperty("App::PropertyBool", "MakeFace", "Draft", _tip, locked=True).MakeFace = True
if "Fuse" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property", "Fuse faces if faces overlap, usually not required (can be very slow)")
obj.addProperty("App::PropertyBool", "Fuse", "Draft", _tip).Fuse = False
obj.addProperty("App::PropertyBool", "Fuse", "Draft", _tip, locked=True).Fuse = False
def onDocumentRestored(self, obj):
super().onDocumentRestored(obj)

View File

@@ -56,7 +56,8 @@ class Text(DraftAnnotation):
obj.addProperty("App::PropertyPlacement",
"Placement",
"Base",
_tip)
_tip,
locked=True)
obj.Placement = App.Placement()
if "Text" not in properties:
@@ -68,7 +69,8 @@ class Text(DraftAnnotation):
obj.addProperty("App::PropertyStringList",
"Text",
"Base",
_tip)
_tip,
locked=True)
obj.Text = []
def onDocumentRestored(self,obj):

View File

@@ -46,51 +46,51 @@ class Wire(DraftObject):
_tip = QT_TRANSLATE_NOOP("App::Property",
"The vertices of the wire")
obj.addProperty("App::PropertyVectorList","Points", "Draft",_tip)
obj.addProperty("App::PropertyVectorList","Points", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"If the wire is closed or not")
obj.addProperty("App::PropertyBool","Closed", "Draft",_tip)
obj.addProperty("App::PropertyBool","Closed", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The base object is the wire, it's formed from 2 objects")
obj.addProperty("App::PropertyLink","Base", "Draft",_tip)
obj.addProperty("App::PropertyLink","Base", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The tool object is the wire, it's formed from 2 objects")
obj.addProperty("App::PropertyLink","Tool", "Draft",_tip)
obj.addProperty("App::PropertyLink","Tool", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The start point of this line")
obj.addProperty("App::PropertyVectorDistance","Start", "Draft",_tip)
obj.addProperty("App::PropertyVectorDistance","Start", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The end point of this line")
obj.addProperty("App::PropertyVectorDistance","End", "Draft",_tip)
obj.addProperty("App::PropertyVectorDistance","End", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The length of this line")
obj.addProperty("App::PropertyLength","Length", "Draft",_tip)
obj.addProperty("App::PropertyLength","Length", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Radius to use to fillet the corners")
obj.addProperty("App::PropertyLength","FilletRadius", "Draft",_tip)
obj.addProperty("App::PropertyLength","FilletRadius", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Size of the chamfer to give to the corners")
obj.addProperty("App::PropertyLength","ChamferSize", "Draft",_tip)
obj.addProperty("App::PropertyLength","ChamferSize", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"Create a face if this object is closed")
obj.addProperty("App::PropertyBool","MakeFace", "Draft",_tip)
obj.addProperty("App::PropertyBool","MakeFace", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The number of subdivisions of each edge")
obj.addProperty("App::PropertyInteger","Subdivisions", "Draft",_tip)
obj.addProperty("App::PropertyInteger","Subdivisions", "Draft",_tip, locked=True)
_tip = QT_TRANSLATE_NOOP("App::Property",
"The area of this object")
obj.addProperty("App::PropertyArea","Area", "Draft",_tip)
obj.addProperty("App::PropertyArea","Area", "Draft",_tip, locked=True)
obj.MakeFace = params.get_param("MakeFaceMode")
obj.Closed = False

View File

@@ -40,9 +40,9 @@ class WorkingPlaneProxy:
obj.Proxy = self
_tip = QT_TRANSLATE_NOOP("App::Property", "The placement of this object")
obj.addProperty("App::PropertyPlacement", "Placement", "Base", _tip)
obj.addProperty("App::PropertyPlacement", "Placement", "Base", _tip, locked=True)
obj.addProperty("Part::PropertyPartShape","Shape","Base","")
obj.addProperty("Part::PropertyPartShape","Shape","Base","", locked=True)
obj.addExtension("Part::AttachExtensionPython")
obj.changeAttacherType("Attacher::AttachEnginePlane")

View File

@@ -106,7 +106,8 @@ class ViewProviderDraft(object):
"Pattern",
"Draft",
QT_TRANSLATE_NOOP("App::Property",
"Defines an SVG pattern."))
"Defines an SVG pattern."),
locked=True)
patterns = list(utils.svg_patterns())
patterns.sort()
vobj.Pattern = ["None"] + patterns
@@ -116,7 +117,8 @@ class ViewProviderDraft(object):
"PatternSize",
"Draft",
QT_TRANSLATE_NOOP("App::Property",
"Defines the size of the SVG pattern."))
"Defines the size of the SVG pattern."),
locked=True)
vobj.PatternSize = params.get_param("HatchPatternSize")
def dumps(self):

View File

@@ -124,7 +124,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyLength",
"TextSpacing",
"Text",
_tip)
_tip,
locked=True)
vobj.TextSpacing = params.get_param("dimspacing")
if "FlipText" not in properties:
@@ -133,7 +134,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyBool",
"FlipText",
"Text",
_tip)
_tip,
locked=True)
vobj.FlipText = False
if "TextPosition" not in properties:
@@ -143,7 +145,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyVectorDistance",
"TextPosition",
"Text",
_tip)
_tip,
locked=True)
vobj.TextPosition = App.Vector(0, 0, 0)
if "Override" not in properties:
@@ -154,7 +157,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyString",
"Override",
"Text",
_tip)
_tip,
locked=True)
vobj.Override = ''
def set_units_properties(self, vobj, properties):
@@ -167,7 +171,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyInteger",
"Decimals",
"Units",
_tip)
_tip,
locked=True)
vobj.Decimals = params.get_param("dimPrecision")
if "ShowUnit" not in properties:
@@ -176,7 +181,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyBool",
"ShowUnit",
"Units",
_tip)
_tip,
locked=True)
vobj.ShowUnit = params.get_param("showUnit")
if "UnitOverride" not in properties:
@@ -187,7 +193,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyString",
"UnitOverride",
"Units",
_tip)
_tip,
locked=True)
vobj.UnitOverride = params.get_param("overrideUnit")
def set_graphics_properties(self, vobj, properties):
@@ -200,7 +207,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyLength",
"ArrowSize",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ArrowSize = params.get_param("arrowsize")
if "ArrowType" not in properties:
@@ -209,7 +217,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"ArrowType",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ArrowType = utils.ARROW_TYPES
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]
@@ -219,7 +228,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyBool",
"FlipArrows",
"Graphics",
_tip)
_tip,
locked=True)
vobj.FlipArrows = False
if "DimOvershoot" not in properties:
@@ -230,7 +240,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyDistance",
"DimOvershoot",
"Graphics",
_tip)
_tip,
locked=True)
vobj.DimOvershoot = params.get_param("dimovershoot")
if "ExtLines" not in properties:
@@ -239,7 +250,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyDistance",
"ExtLines",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ExtLines = params.get_param("extlines")
if "ExtOvershoot" not in properties:
@@ -249,7 +261,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyDistance",
"ExtOvershoot",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ExtOvershoot = params.get_param("extovershoot")
if "ShowLine" not in properties:
@@ -258,7 +271,8 @@ class ViewProviderDimensionBase(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyBool",
"ShowLine",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ShowLine = params.get_param("DimShowLine")
def getIcon(self):

View File

@@ -85,7 +85,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyFloat",
"ScaleMultiplier",
"Annotation",
_tip)
_tip,
locked=True)
vobj.ScaleMultiplier = params.get_param("DefaultAnnoScaleMultiplier")
if "AnnotationStyle" not in properties:
@@ -101,7 +102,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyEnumeration",
"AnnotationStyle",
"Annotation",
_tip)
_tip,
locked=True)
styles = []
for key in vobj.Object.Document.Meta.keys():
if key.startswith("Draft_Style_"):
@@ -117,7 +119,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyFont",
"FontName",
"Text",
_tip)
_tip,
locked=True)
vobj.FontName = params.get_param("textfont")
if "FontSize" not in properties:
@@ -126,7 +129,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyLength",
"FontSize",
"Text",
_tip)
_tip,
locked=True)
vobj.FontSize = params.get_param("textheight")
if "TextColor" not in properties:
@@ -135,7 +139,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyColor",
"TextColor",
"Text",
_tip)
_tip,
locked=True)
vobj.TextColor = params.get_param("DefaultTextColor") | 0x000000FF
def set_units_properties(self, vobj, properties):
@@ -148,7 +153,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyFloat",
"LineWidth",
"Graphics",
_tip)
_tip,
locked=True)
vobj.LineWidth = params.get_param("DefaultAnnoLineWidth")
if "LineColor" not in properties:
@@ -156,7 +162,8 @@ class ViewProviderDraftAnnotation(object):
vobj.addProperty("App::PropertyColor",
"LineColor",
"Graphics",
_tip)
_tip,
locked=True)
vobj.LineColor = params.get_param("DefaultAnnoLineColor") | 0x000000FF
def dumps(self):

View File

@@ -58,7 +58,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"TextAlignment",
"Text",
_tip)
_tip,
locked=True)
vobj.TextAlignment = ["Top", "Middle", "Bottom"]
vobj.TextAlignment = "Bottom"
@@ -69,7 +70,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyInteger",
"MaxChars",
"Text",
_tip)
_tip,
locked=True)
if "Justification" not in properties:
_tip = QT_TRANSLATE_NOOP("App::Property",
@@ -77,7 +79,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"Justification",
"Text",
_tip)
_tip,
locked=True)
vobj.Justification = ["Left", "Center", "Right"]
if "LineSpacing" not in properties:
@@ -86,7 +89,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyFloat",
"LineSpacing",
"Text",
_tip)
_tip,
locked=True)
vobj.LineSpacing = params.get_param("LineSpacing")
def set_graphics_properties(self, vobj, properties):
@@ -99,7 +103,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyLength",
"ArrowSize",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ArrowSize = params.get_param("arrowsize")
if "ArrowType" not in properties:
@@ -108,7 +113,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"ArrowType",
"Graphics",
_tip)
_tip,
locked=True)
vobj.ArrowType = utils.ARROW_TYPES
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]
@@ -119,7 +125,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"Frame",
"Graphics",
_tip)
_tip,
locked=True)
vobj.Frame = ["None", "Rectangle"]
if "Line" not in properties:
@@ -128,7 +135,8 @@ class ViewProviderLabel(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyBool",
"Line",
"Graphics",
_tip)
_tip,
locked=True)
vobj.Line = True
def getIcon(self):

View File

@@ -67,7 +67,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyBool",
"OverrideLineColorChildren",
"Layer",
_tip)
_tip,
locked=True)
vobj.OverrideLineColorChildren = True
if "OverrideShapeAppearanceChildren" not in properties:
@@ -78,7 +79,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyBool",
"OverrideShapeAppearanceChildren",
"Layer",
_tip)
_tip,
locked=True)
vobj.OverrideShapeAppearanceChildren = True
if "UsePrintColor" not in properties:
@@ -89,7 +91,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyBool",
"UsePrintColor",
"Print",
_tip)
_tip,
locked=True)
def set_visual_properties(self, vobj, properties):
"""Set visual properties only if they don't already exist."""
@@ -100,7 +103,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyColor",
"LineColor",
"Layer",
_tip)
_tip,
locked=True)
vobj.LineColor = params.get_param_view("DefaultShapeLineColor") | 0x000000FF
if "ShapeColor" not in properties:
@@ -111,7 +115,8 @@ class ViewProviderLayer:
"ShapeColor",
"Layer",
_tip,
4) # Hidden
4,
locked=True) # Hidden
vobj.ShapeColor = params.get_param_view("DefaultShapeColor") | 0x000000FF
if "ShapeAppearance" not in properties:
@@ -121,7 +126,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyMaterialList",
"ShapeAppearance",
"Layer",
_tip)
_tip,
locked=True)
material = App.Material()
material.DiffuseColor = params.get_param_view("DefaultShapeColor") | 0x000000FF
vobj.ShapeAppearance = (material, )
@@ -133,7 +139,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyFloat",
"LineWidth",
"Layer",
_tip)
_tip,
locked=True)
vobj.LineWidth = params.get_param_view("DefaultShapeLineWidth")
if "DrawStyle" not in properties:
@@ -143,7 +150,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyEnumeration",
"DrawStyle",
"Layer",
_tip)
_tip,
locked=True)
vobj.DrawStyle = utils.DRAW_STYLES
vobj.DrawStyle = params.get_param("DefaultDrawStyle")
@@ -154,7 +162,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyPercent",
"Transparency",
"Layer",
_tip)
_tip,
locked=True)
vobj.Transparency = params.get_param_view("DefaultShapeTransparency")
if "LinePrintColor" not in properties:
@@ -165,7 +174,8 @@ class ViewProviderLayer:
vobj.addProperty("App::PropertyColor",
"LinePrintColor",
"Print",
_tip)
_tip,
locked=True)
vobj.LinePrintColor = params.get_param("DefaultPrintColor")
def getIcon(self):

View File

@@ -37,9 +37,9 @@ class ViewProviderRectangle(ViewProviderDraft):
def __init__(self,vobj):
super(ViewProviderRectangle, self).__init__(vobj)
_tip = "Defines a texture image (overrides hatch patterns)"
_tip = QT_TRANSLATE_NOOP("App::Property","Defines a texture image (overrides hatch patterns)")
vobj.addProperty("App::PropertyFile","TextureImage",
"Draft", QT_TRANSLATE_NOOP("App::Property", _tip))
"Draft", _tip, locked=True)
# Alias for compatibility with v0.18 and earlier

View File

@@ -54,7 +54,8 @@ class ViewProviderText(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyEnumeration",
"Justification",
"Text",
_tip)
_tip,
locked=True)
vobj.Justification = ["Left", "Center", "Right"]
if "LineSpacing" not in properties:
@@ -63,7 +64,8 @@ class ViewProviderText(ViewProviderDraftAnnotation):
vobj.addProperty("App::PropertyFloat",
"LineSpacing",
"Text",
_tip)
_tip,
locked=True)
vobj.LineSpacing = params.get_param("LineSpacing")
def getIcon(self):

View File

@@ -60,27 +60,30 @@ class ViewProviderWire(ViewProviderDraft):
super(ViewProviderWire, self)._set_properties(vobj)
if not hasattr(vobj, "EndArrow"):
_tip = "Displays a Dimension symbol at the end of the wire."
_tip = QT_TRANSLATE_NOOP("App::Property", "Displays a Dimension symbol at the end of the wire.")
vobj.addProperty("App::PropertyBool",
"EndArrow",
"Draft",
QT_TRANSLATE_NOOP("App::Property", _tip))
_tip,
locked=True)
vobj.EndArrow = False
if not hasattr(vobj, "ArrowSize"):
_tip = "Arrow size"
_tip = QT_TRANSLATE_NOOP("App::Property", "Arrow size")
vobj.addProperty("App::PropertyLength",
"ArrowSize",
"Draft",
QT_TRANSLATE_NOOP("App::Property", _tip))
_tip,
locked=True)
vobj.ArrowSize = params.get_param("arrowsize")
if not hasattr(vobj, "ArrowType"):
_tip = "Arrow type"
_tip = QT_TRANSLATE_NOOP("App::Property", "Arrow type")
vobj.addProperty("App::PropertyEnumeration",
"ArrowType",
"Draft",
QT_TRANSLATE_NOOP("App::Property", _tip))
_tip,
locked=True)
vobj.ArrowType = utils.ARROW_TYPES
vobj.ArrowType = utils.ARROW_TYPES[params.get_param("dimsymbol")]

View File

@@ -44,27 +44,29 @@ class ViewProviderWorkingPlaneProxy:
# ViewData: 0,1,2: position; 3,4,5,6: rotation; 7: near dist; 8: far dist, 9:aspect ratio;
# 10: focal dist; 11: height (ortho) or height angle (persp); 12: ortho (0) or persp (1)
_tip = "The display length of this section plane"
_tip = QT_TRANSLATE_NOOP("App::Property", "The display length of this section plane")
vobj.addProperty("App::PropertyLength", "DisplaySize",
"Draft", QT_TRANSLATE_NOOP("App::Property", _tip))
"Draft", _tip,
locked=True)
_tip = "The size of the arrows of this section plane"
_tip = QT_TRANSLATE_NOOP("App::Property", "The size of the arrows of this section plane")
vobj.addProperty("App::PropertyLength", "ArrowSize",
"Draft", QT_TRANSLATE_NOOP("App::Property", _tip))
"Draft", _tip,
locked=True)
vobj.addProperty("App::PropertyPercent","Transparency","Base","")
vobj.addProperty("App::PropertyPercent","Transparency","Base","",locked=True)
vobj.addProperty("App::PropertyFloat","LineWidth","Base","")
vobj.addProperty("App::PropertyFloat","LineWidth","Base","",locked=True)
vobj.addProperty("App::PropertyColor","LineColor","Base","")
vobj.addProperty("App::PropertyColor","LineColor","Base","",locked=True)
vobj.addProperty("App::PropertyFloatList","ViewData","Base","")
vobj.addProperty("App::PropertyFloatList","ViewData","Base","",locked=True)
vobj.addProperty("App::PropertyBool","RestoreView","Base","")
vobj.addProperty("App::PropertyBool","RestoreView","Base","",locked=True)
vobj.addProperty("App::PropertyMap","VisibilityMap","Base","")
vobj.addProperty("App::PropertyMap","VisibilityMap","Base","",locked=True)
vobj.addProperty("App::PropertyBool","RestoreState","Base","")
vobj.addProperty("App::PropertyBool","RestoreState","Base","",locked=True)
vobj.DisplaySize = 100
vobj.ArrowSize = 5