Hiding all/most properties that are supposed to be hidden on document restore again.
This commit is contained in:
@@ -126,6 +126,16 @@ class ObjectOp(PathOp.ObjectOp):
|
||||
|
||||
self.areaOpOnChanged(obj, prop)
|
||||
|
||||
def opOnDocumentRestored(self, obj):
|
||||
for prop in ['AreaParams', 'PathParams', 'removalshape']:
|
||||
if hasattr(obj, prop):
|
||||
obj.setEditorMode(prop, 2)
|
||||
self.areaOpOnDocumentRestored(obj)
|
||||
|
||||
def areaOpOnDocumentRestored(self, obj):
|
||||
'''areaOpOnDocumentRestored(obj) ... overwrite to fully restore receiver'''
|
||||
pass
|
||||
|
||||
def opSetDefaultValues(self, obj):
|
||||
'''opSetDefaultValues(obj) ... base implementation, do not overwrite.
|
||||
The base implementation sets the depths and heights based on the
|
||||
|
||||
@@ -72,6 +72,9 @@ class ObjectChamfer(PathEngraveBase.ObjectOp):
|
||||
obj.Join = ['Round', 'Miter']
|
||||
obj.setEditorMode('Join', 2) # hide for now
|
||||
|
||||
def opOnDocumentRestored(self, obj):
|
||||
obj.setEditorMode('Join', 2) # hide for now
|
||||
|
||||
def opExecute(self, obj):
|
||||
PathLog.track(obj.Label)
|
||||
(depth, offset) = toolDepthAndOffset(obj.Width.Value, obj.ExtraDepth.Value, self.tool)
|
||||
|
||||
@@ -392,6 +392,9 @@ class ObjectDressup:
|
||||
obj.Proxy = self
|
||||
obj.Base = base
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
obj.setEditorMode('BoneBlacklist', 2) # hide this one
|
||||
|
||||
def __getstate__(self):
|
||||
return None
|
||||
|
||||
|
||||
@@ -80,6 +80,9 @@ class ObjectDressup:
|
||||
else:
|
||||
obj.setEditorMode('CustomFeedRate', 2)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
self.setEditorProperties(obj)
|
||||
|
||||
def setup(self, obj):
|
||||
obj.Angle = 60
|
||||
obj.Method = 2
|
||||
|
||||
@@ -56,19 +56,18 @@ class ObjectEngrave(PathEngraveBase.ObjectOp):
|
||||
def setupAdditionalProperties(self, obj):
|
||||
if not hasattr(obj, 'BaseShapes'):
|
||||
obj.addProperty("App::PropertyLinkList", "BaseShapes", "Path", QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Additional base objects to be engraved"))
|
||||
obj.setEditorMode('BaseShapes', 2) # hide
|
||||
obj.setEditorMode('BaseShapes', 2) # hide
|
||||
if not hasattr(obj, 'BaseObject'):
|
||||
obj.addProperty("App::PropertyLink", "BaseObject", "Path", QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Additional base objects to be engraved"))
|
||||
obj.setEditorMode('BaseObject', 2) # hide
|
||||
obj.setEditorMode('BaseObject', 2) # hide
|
||||
|
||||
def initOperation(self, obj):
|
||||
'''initOperation(obj) ... create engraving specific properties.'''
|
||||
obj.addProperty("App::PropertyInteger", "StartVertex", "Path", QtCore.QT_TRANSLATE_NOOP("PathEngrave", "The vertex index to start the path from"))
|
||||
self.setupAdditionalProperties(obj)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
def opOnDocumentRestored(self, obj):
|
||||
# upgrade ...
|
||||
super(self.__class__, self).onDocumentRestored(obj)
|
||||
self.setupAdditionalProperties(obj)
|
||||
|
||||
def opExecute(self, obj):
|
||||
|
||||
@@ -212,6 +212,8 @@ class ObjectJob:
|
||||
self.fixupResourceClone(obj, 'Base', 'BaseGeometry')
|
||||
self.fixupOperations(obj)
|
||||
self.setupSetupSheet(obj)
|
||||
obj.setEditorMode('Operations', 2) # hide
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
def onChanged(self, obj, prop):
|
||||
if prop == "PostProcessor" and obj.PostProcessor:
|
||||
|
||||
@@ -158,6 +158,17 @@ class ObjectOp(object):
|
||||
if self.setDefaultValues(obj):
|
||||
obj.Proxy = self
|
||||
|
||||
def setEditorModes(self, obj, features):
|
||||
'''Editor modes are not preserved during document store/restore, set editor modes for all properties'''
|
||||
|
||||
for op in ['OpStartDepth', 'OpFinalDepth', 'OpToolDiameter']:
|
||||
if hasattr(obj, op):
|
||||
obj.setEditorMode(op, 1) # read-only
|
||||
|
||||
if FeatureDepths & features:
|
||||
if FeatureNoFinalDepth & features:
|
||||
obj.setEditorMode('OpFinalDepth', 2)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
features = self.opFeatures(obj)
|
||||
if FeatureBaseGeometry & features and 'App::PropertyLinkSubList' == obj.getTypeIdOfProperty('Base'):
|
||||
@@ -174,9 +185,8 @@ class ObjectOp(object):
|
||||
|
||||
if FeatureDepths & features and not hasattr(obj, 'OpStartDepth'):
|
||||
self.addOpValues(obj, ['start', 'final'])
|
||||
if FeatureNoFinalDepth & features:
|
||||
obj.setEditorMode('OpFinalDepth', 2)
|
||||
|
||||
self.setEditorModes(obj, features)
|
||||
self.opOnDocumentRestored(obj)
|
||||
|
||||
def __getstate__(self):
|
||||
|
||||
@@ -79,6 +79,10 @@ class ObjectProfile(PathAreaOp.ObjectOp):
|
||||
else:
|
||||
obj.setEditorMode('MiterLimit', 2)
|
||||
|
||||
def areaOpOnDocumentRestored(self, obj):
|
||||
for prop in ['UseComp', 'JoinType']:
|
||||
self.areaOpOnChanged(obj, prop)
|
||||
|
||||
def areaOpAreaParams(self, obj, isHole):
|
||||
'''areaOpAreaParams(obj, isHole) ... returns dictionary with area parameters.
|
||||
Do not overwrite.'''
|
||||
|
||||
@@ -70,6 +70,9 @@ class ObjectContour(PathProfileBase.ObjectProfile):
|
||||
self.baseObject().initAreaOp(obj)
|
||||
obj.setEditorMode('Side', 2) # it's always outside
|
||||
|
||||
def areaOpOnDocumentRestored(self, obj):
|
||||
obj.setEditorMode('Side', 2) # it's always outside
|
||||
|
||||
def areaOpSetDefaultValues(self, obj):
|
||||
'''areaOpSetDefaultValues(obj) ... call super's implementation and set Side="Outside".'''
|
||||
self.baseObject().areaOpSetDefaultValues(obj)
|
||||
|
||||
@@ -79,7 +79,12 @@ def shapeBoundBox(obj):
|
||||
PathLog.error(translate('PathStock', "Invalid base object %s - no shape found") % obj.Name)
|
||||
return None
|
||||
|
||||
class StockFromBase:
|
||||
class Stock(object):
|
||||
def onDocumentRestored(self, obj):
|
||||
if hasattr(obj, 'StockType'):
|
||||
obj.setEditorMode('StockType', 2) # hide
|
||||
|
||||
class StockFromBase(Stock):
|
||||
|
||||
def __init__(self, obj, base):
|
||||
"Make stock"
|
||||
@@ -130,7 +135,7 @@ class StockFromBase:
|
||||
self.execute(obj)
|
||||
|
||||
|
||||
class StockCreateBox:
|
||||
class StockCreateBox(Stock):
|
||||
MinExtent = 0.001
|
||||
|
||||
def __init__(self, obj):
|
||||
@@ -165,7 +170,7 @@ class StockCreateBox:
|
||||
if prop in ['Length', 'Width', 'Height'] and not 'Restore' in obj.State:
|
||||
self.execute(obj)
|
||||
|
||||
class StockCreateCylinder:
|
||||
class StockCreateCylinder(Stock):
|
||||
MinExtent = 0.001
|
||||
|
||||
def __init__(self, obj):
|
||||
|
||||
@@ -95,6 +95,9 @@ class ObjectSurface(PathOp.ObjectOp):
|
||||
if prop == "Algorithm":
|
||||
self.setEditorProperties(obj)
|
||||
|
||||
def opOnDocumentRestored(self, obj):
|
||||
self.setEditorProperties(obj)
|
||||
|
||||
def opExecute(self, obj):
|
||||
'''opExecute(obj) ... process surface operation'''
|
||||
PathLog.track()
|
||||
|
||||
@@ -81,8 +81,10 @@ class ToolController:
|
||||
obj.addProperty("App::PropertySpeed", "VertRapid", "Rapid", QtCore.QT_TRANSLATE_NOOP("App::Property", "Rapid rate for vertical moves in Z"))
|
||||
obj.addProperty("App::PropertySpeed", "HorizRapid", "Rapid", QtCore.QT_TRANSLATE_NOOP("App::Property", "Rapid rate for horizontal moves"))
|
||||
obj.Proxy = self
|
||||
mode = 2
|
||||
obj.setEditorMode('Placement', mode)
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
def setFromTemplate(self, obj, template):
|
||||
'''setFromTemplate(obj, xmlItem) ... extract properties from xmlItem and assign to receiver.'''
|
||||
|
||||
@@ -40,8 +40,10 @@ class ToolLenOffset:
|
||||
obj.addProperty("App::PropertyLength", "Height", "HeightOffset",QtCore.QT_TRANSLATE_NOOP("App::Property","The first height value in Z, to rapid to, before making a feed move in Z"))
|
||||
obj.addProperty("App::PropertyBool","Active","HeightOffset",QtCore.QT_TRANSLATE_NOOP("App::Property","Make False, to prevent operation from generating code"))
|
||||
obj.Proxy = self
|
||||
mode = 2
|
||||
obj.setEditorMode('Placement', mode)
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
def onDocumentRestored(self, obj):
|
||||
obj.setEditorMode('Placement', 2)
|
||||
|
||||
def execute(self, obj):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user