diff --git a/src/Mod/Path/PathScripts/PathChamfer.py b/src/Mod/Path/PathScripts/PathChamfer.py index 2966827b1c..84fe471b2f 100644 --- a/src/Mod/Path/PathScripts/PathChamfer.py +++ b/src/Mod/Path/PathScripts/PathChamfer.py @@ -119,9 +119,16 @@ class ObjectChamfer(PathEngraveBase.ObjectOp): obj.ExtraDepth = '0.1 mm' obj.Join = 'Round' -def Create(name): +def SetupProperties(): + setup = [] + setup.append('Width') + setup.append('ExtraDepth') + return setup + +def Create(name, obj = None): '''Create(name) ... Creates and returns a Chamfer operation.''' - obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) + if obj is None: + obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectChamfer(obj, name) return obj diff --git a/src/Mod/Path/PathScripts/PathChamferGui.py b/src/Mod/Path/PathScripts/PathChamferGui.py index a05dca063e..bc088726a7 100644 --- a/src/Mod/Path/PathScripts/PathChamferGui.py +++ b/src/Mod/Path/PathScripts/PathChamferGui.py @@ -104,7 +104,8 @@ Command = PathOpGui.SetupOperation('Chamfer', TaskPanelOpPage, 'Path-Chamfer', QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Chamfer"), - QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Creates a Chamfer Path along Edges or around Faces")) + QtCore.QT_TRANSLATE_NOOP("PathChamfer", "Creates a Chamfer Path along Edges or around Faces"), + PathChamfer.SetupProperties) FreeCAD.Console.PrintLog("Loading PathChamferGui... done\n") diff --git a/src/Mod/Path/PathScripts/PathEngrave.py b/src/Mod/Path/PathScripts/PathEngrave.py index 93d4d36c00..5bdc155833 100644 --- a/src/Mod/Path/PathScripts/PathEngrave.py +++ b/src/Mod/Path/PathScripts/PathEngrave.py @@ -150,9 +150,13 @@ class ObjectEngrave(PathEngraveBase.ObjectOp): job = PathUtils.findParentJob(obj) self.opSetDefaultValues(obj, job) -def Create(name): +def SetupProperties(): + return [ "StartVertex" ] + +def Create(name, obj = None): '''Create(name) ... Creates and returns an Engrave operation.''' - obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) + if obj is None: + obj = FreeCAD.ActiveDocument.addObject("Path::FeaturePython", name) proxy = ObjectEngrave(obj, name) return obj diff --git a/src/Mod/Path/PathScripts/PathEngraveGui.py b/src/Mod/Path/PathScripts/PathEngraveGui.py index 501d116f0b..181bff7f2f 100644 --- a/src/Mod/Path/PathScripts/PathEngraveGui.py +++ b/src/Mod/Path/PathScripts/PathEngraveGui.py @@ -133,6 +133,7 @@ Command = PathOpGui.SetupOperation('Engrave', TaskPanelOpPage, 'Path-Engrave', QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Engrave"), - QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Creates an Engraving Path around a Draft ShapeString")) + QtCore.QT_TRANSLATE_NOOP("PathEngrave", "Creates an Engraving Path around a Draft ShapeString"), + PathEngrave.SetupProperties) FreeCAD.Console.PrintLog("Loading PathEngraveGui... done\n") diff --git a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py index 77255718ec..731e910fdd 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototype.py @@ -122,6 +122,10 @@ class PropertyFloat(Property): def typeString(self): return "Float" +class PropertyInteger(Property): + def typeString(self): + return "Integer" + class PropertyBool(Property): def typeString(self): return "Bool" @@ -137,8 +141,10 @@ class OpPrototype(object): 'App::PropertyDistance': PropertyDistance, 'App::PropertyEnumeration': PropertyEnumeration, 'App::PropertyFloat': PropertyFloat, + 'App::PropertyInteger': PropertyInteger, 'App::PropertyLength': PropertyLength, 'App::PropertyLink': Property, + 'App::PropertyLinkList': Property, 'App::PropertyLinkSubListGlobal': Property, 'App::PropertyPercent': PropertyPercent, 'App::PropertyString': PropertyString, @@ -149,13 +155,13 @@ class OpPrototype(object): } def __init__(self, name): - self.name = name + self.Label = name self.properties = {} self.DoNotSetDefaultValues = True self.Proxy = None def __setattr__(self, name, val): - if name in ['name', 'DoNotSetDefaultValues', 'properties', 'Proxy']: + if name in ['Label', 'DoNotSetDefaultValues', 'properties', 'Proxy']: if name == 'Proxy': val = None # make sure the proxy is never set return super(self.__class__, self).__setattr__(name, val) diff --git a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py index 28ffb26ff4..f42b01400d 100644 --- a/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py +++ b/src/Mod/Path/PathScripts/PathSetupSheetOpPrototypeGui.py @@ -110,6 +110,7 @@ class _PropertyLengthEditor(_PropertyEditor): self.prop.setValue(FreeCAD.Units.Quantity(widget.text())) class _PropertyPercentEditor(_PropertyEditor): + def widget(self, parent): return QtGui.QSpinBox(parent) @@ -123,6 +124,20 @@ class _PropertyPercentEditor(_PropertyEditor): def setModelData(self, widget): self.prop.setValue(widget.value()) +class _PropertyIntegerEditor(_PropertyEditor): + + def widget(self, parent): + return QtGui.QSpinBox(parent) + + def setEditorData(self, widget): + value = self.prop.getValue() + if value is None: + value = 0 + widget.setValue(value) + + def setModelData(self, widget): + self.prop.setValue(widget.value()) + class _PropertyFloatEditor(_PropertyEditor): def widget(self, parent): @@ -143,6 +158,7 @@ _EditorFactory = { PathSetupSheetOpPrototype.PropertyDistance: _PropertyLengthEditor, PathSetupSheetOpPrototype.PropertyEnumeration: _PropertyEnumEditor, PathSetupSheetOpPrototype.PropertyFloat: _PropertyFloatEditor, + PathSetupSheetOpPrototype.PropertyInteger: _PropertyIntegerEditor, PathSetupSheetOpPrototype.PropertyLength: _PropertyLengthEditor, PathSetupSheetOpPrototype.PropertyPercent: _PropertyPercentEditor, PathSetupSheetOpPrototype.PropertyString: _PropertyStringEditor,