PEP8 cleanup

This commit is contained in:
sliptonic
2018-07-16 19:39:26 -05:00
committed by Yorik van Havre
parent 024ce84da3
commit e92d1018be

View File

@@ -44,6 +44,7 @@ if False:
else:
PathLog.setLevel(PathLog.Level.INFO, PathLog.thisModule())
# Qt tanslation handling
def translate(context, text, disambig=None):
return QtCore.QCoreApplication.translate(context, text, disambig)
@@ -63,6 +64,7 @@ FeatureLocations = 0x1000 # Locations
FeatureBaseGeometry = FeatureBaseVertexes | FeatureBaseFaces | FeatureBaseEdges | FeatureBasePanels
class ObjectOp(object):
'''
Base class for proxy objects of all Path operations.
@@ -99,13 +101,13 @@ class ObjectOp(object):
def addOpValues(self, obj, values):
if 'start' in values:
obj.addProperty("App::PropertyDistance", "OpStartDepth", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the calculated value for the StartDepth"))
obj.setEditorMode('OpStartDepth', 1) # read-only
obj.setEditorMode('OpStartDepth', 1) # read-only
if 'final' in values:
obj.addProperty("App::PropertyDistance", "OpFinalDepth", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the calculated value for the FinalDepth"))
obj.setEditorMode('OpFinalDepth', 1) # read-only
obj.setEditorMode('OpFinalDepth', 1) # read-only
if 'tooldia' in values:
obj.addProperty("App::PropertyDistance", "OpToolDiameter", "Op Values", QtCore.QT_TRANSLATE_NOOP("PathOp", "Holds the diameter of the tool"))
obj.setEditorMode('OpToolDiameter', 1) # read-only
obj.setEditorMode('OpToolDiameter', 1) # read-only
def __init__(self, obj):
PathLog.track()
@@ -130,12 +132,12 @@ class ObjectOp(object):
obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Starting Depth of Tool- first cut depth in Z"))
obj.addProperty("App::PropertyDistance", "FinalDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Final Depth of Tool- lowest value in Z"))
if FeatureNoFinalDepth & features:
obj.setEditorMode('FinalDepth', 2) # hide
obj.setEditorMode('FinalDepth', 2) # hide
self.addOpValues(obj, ['start', 'final'])
else:
# StartDepth has become necessary for expressions on other properties
obj.addProperty("App::PropertyDistance", "StartDepth", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Starting Depth internal use only for derived values"))
obj.setEditorMode('StartDepth', 1) # read-only
obj.setEditorMode('StartDepth', 1) # read-only
if FeatureStepDown & features:
obj.addProperty("App::PropertyDistance", "StepDown", "Depth", QtCore.QT_TRANSLATE_NOOP("PathOp", "Incremental Step Down of Tool"))
@@ -215,7 +217,7 @@ class ObjectOp(object):
'''opUpdateDepths(obj) ... overwrite to implement special depths calculation.
Can safely be overwritten by subclass.'''
pass
def opExecute(self, obj):
'''opExecute(obj) ... called whenever the receiver needs to be recalculated.
See documentation of execute() for a list of base functionality provided.
@@ -256,17 +258,17 @@ class ObjectOp(object):
obj.ToolController = PathUtils.findToolController(obj)
if not obj.ToolController:
return False
obj.OpToolDiameter = obj.ToolController.Tool.Diameter
obj.OpToolDiameter = obj.ToolController.Tool.Diameter
if FeatureDepths & features:
if self.applyExpression(obj, 'StartDepth', job.SetupSheet.StartDepthExpression):
obj.OpStartDepth = 1.0
obj.OpStartDepth = 1.0
else:
obj.StartDepth = 1.0
obj.StartDepth = 1.0
if self.applyExpression(obj, 'FinalDepth', job.SetupSheet.FinalDepthExpression):
obj.OpFinalDepth = 0.0
obj.OpFinalDepth = 0.0
else:
obj.FinalDepth = 0.0
obj.FinalDepth = 0.0
else:
obj.StartDepth = 1.0
@@ -318,11 +320,11 @@ class ObjectOp(object):
def faceZmin(bb, fbb):
if fbb.ZMax == fbb.ZMin and fbb.ZMax == bb.ZMax: # top face
return fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMax == bb.ZMax: # vertical face, full cut
elif fbb.ZMax > fbb.ZMin and fbb.ZMax == bb.ZMax: # vertical face, full cut
return fbb.ZMin
elif fbb.ZMax > fbb.ZMin and fbb.ZMin > bb.ZMin: # internal vertical wall
return fbb.ZMin
elif fbb.ZMax == fbb.ZMin and fbb.ZMax > bb.ZMin: # face/shelf
elif fbb.ZMax == fbb.ZMin and fbb.ZMax > bb.ZMin: # face/shelf
return fbb.ZMin
return bb.ZMin
@@ -464,4 +466,3 @@ class ObjectOp(object):
obj.Base = baselist
else:
PathLog.notice((translate("Path", "Base object %s.%s rejected by operation")+"\n") % (base.Label, sub))