diff --git a/src/Mod/Path/PathScripts/PathJob.py b/src/Mod/Path/PathScripts/PathJob.py index de9e700530..208a0f20c3 100644 --- a/src/Mod/Path/PathScripts/PathJob.py +++ b/src/Mod/Path/PathScripts/PathJob.py @@ -125,6 +125,13 @@ class ObjectPathJob: obj.Y_Min = current_post.CORNER_MIN['y'] obj.Z_Min = current_post.CORNER_MIN['z'] + self.tooltip = None + self.tooltipArgs = None + if hasattr(current_post, "TOOLTIP"): + self.tooltip = current_post.TOOLTIP + if hasattr(current_post, "TOOLTIP_ARGS"): + self.tooltipArgs = current_post.TOOLTIP_ARGS + # def getToolControllers(self, obj): # '''returns a list of ToolControllers for the current job''' # controllers = [] @@ -249,6 +256,8 @@ class TaskPanel: if hasattr(o, "Shape"): self.form.cboBaseObject.addItem(o.Name) + self.postProcessorDefaultTooltip = self.form.cboPostProcessor.toolTip() + self.postProcessorDefaultArgsTooltip = self.form.cboPostProcessorArgs.toolTip() def accept(self): self.getFields() @@ -260,6 +269,17 @@ class TaskPanel: FreeCADGui.Control.closeDialog() FreeCAD.ActiveDocument.recompute() + def updateTooltips(self): + if hasattr(self.obj, "Proxy") and hasattr(self.obj.Proxy, "tooltip") and self.obj.Proxy.tooltip: + self.form.cboPostProcessor.setToolTip(self.obj.Proxy.tooltip) + if hasattr(self.obj.Proxy, "tooltipArgs") and self.obj.Proxy.tooltipArgs: + self.form.cboPostProcessorArgs.setToolTip(self.obj.Proxy.tooltipArgs) + else: + self.form.cboPostProcessorArgs.setToolTip(self.postProcessorDefaultArgsTooltip) + else: + self.form.cboPostProcessor.setToolTip(self.postProcessorDefaultTooltip) + self.form.cboPostProcessorArgs.setToolTip(self.postProcessorDefaultArgsTooltip) + def getFields(self): '''sets properties in the object to match the form''' if self.obj: @@ -288,6 +308,8 @@ class TaskPanel: selObj = Draft.clone(selObj) self.obj.Base = selObj + self.updateTooltips() + self.obj.Proxy.execute(self.obj) def setFields(self): @@ -302,6 +324,9 @@ class TaskPanel: self.form.cboPostProcessor.blockSignals(True) self.form.cboPostProcessor.setCurrentIndex(postindex) self.form.cboPostProcessor.blockSignals(False) + # make sure the proxy loads post processor script values and settings + self.obj.Proxy.onChanged(self.obj, "PostProcessor") + self.updateTooltips() self.form.cboPostProcessorArgs.displayText = self.obj.PostProcessorArgs for child in self.obj.Group: diff --git a/src/Mod/Path/PathScripts/centroid_post.py b/src/Mod/Path/PathScripts/centroid_post.py index 89f3193d16..1e90108573 100644 --- a/src/Mod/Path/PathScripts/centroid_post.py +++ b/src/Mod/Path/PathScripts/centroid_post.py @@ -21,7 +21,8 @@ #* USA * #* * #*************************************************************************** -''' example post for Centroid CNC mill''' +TOOLTIP=''' example post for Centroid CNC mill''' + import FreeCAD import datetime now = datetime.datetime.now() diff --git a/src/Mod/Path/PathScripts/comparams_post.py b/src/Mod/Path/PathScripts/comparams_post.py index 91a72cb5dc..0ac75faf99 100644 --- a/src/Mod/Path/PathScripts/comparams_post.py +++ b/src/Mod/Path/PathScripts/comparams_post.py @@ -21,7 +21,8 @@ #* USA * #* * #*************************************************************************** -''' Example Post, using Path.Commands instead of Path.toGCode strings for Path gcode output. ''' +TOOLTIP=''' Example Post, using Path.Commands instead of Path.toGCode strings for Path gcode output. ''' + import FreeCAD import Path, PathScripts from PathScripts import PostUtils diff --git a/src/Mod/Path/PathScripts/dumper_post.py b/src/Mod/Path/PathScripts/dumper_post.py index 87e33ec3e2..6a661b1b7d 100644 --- a/src/Mod/Path/PathScripts/dumper_post.py +++ b/src/Mod/Path/PathScripts/dumper_post.py @@ -22,7 +22,7 @@ # ***************************************************************************/ -''' +TOOLTIP=''' Dumper is an extremely simple postprocessor file for the Path workbench. It is used to dump the command list from one or more Path objects for simple inspection. This post doesn't do any manipulation of the path and doesn't write anything to disk. It just diff --git a/src/Mod/Path/PathScripts/example_post.py b/src/Mod/Path/PathScripts/example_post.py index a14dbda042..fe1516decf 100644 --- a/src/Mod/Path/PathScripts/example_post.py +++ b/src/Mod/Path/PathScripts/example_post.py @@ -22,7 +22,7 @@ # ***************************************************************************/ -''' +TOOLTIP=''' This is an example postprocessor file for the Path workbench. It is used to save a list of FreeCAD Path objects to a file. diff --git a/src/Mod/Path/PathScripts/linuxcnc_post.py b/src/Mod/Path/PathScripts/linuxcnc_post.py index 9c7ada7fbc..f58df71c59 100644 --- a/src/Mod/Path/PathScripts/linuxcnc_post.py +++ b/src/Mod/Path/PathScripts/linuxcnc_post.py @@ -22,7 +22,7 @@ # ***************************************************************************/ -''' +TOOLTIP=''' This is a postprocessor file for the Path workbench. It is used to take a pseudo-gcode fragment outputted by a Path object, and output real GCode suitable for a linuxcnc 3 axis mill. This postprocessor, once placed @@ -33,6 +33,13 @@ import linuxcnc_post linuxcnc_post.export(object,"/path/to/file.ncc") ''' +TOOLTIP_ARGS=''' +Arguments for linuxcnc: + --header,--no-header ... output headers (--header) + --comments,--no-comments ... output comments (--comments) + --line-numbers,--no-line-numbers ... prefix with line numbers (--no-lin-numbers) +''' + import datetime from PathScripts import PostUtils diff --git a/src/Mod/Path/PathScripts/opensbp_post.py b/src/Mod/Path/PathScripts/opensbp_post.py index 25969734ae..4a20a86550 100644 --- a/src/Mod/Path/PathScripts/opensbp_post.py +++ b/src/Mod/Path/PathScripts/opensbp_post.py @@ -25,7 +25,7 @@ from PathScripts import PostUtils # ***************************************************************************/ -''' +TOOLTIP=''' This is an postprocessor file for the Path workbench. It will output path data in a format suitable for OpenSBP controllers like shopbot. This postprocessor, once placed in the appropriate PathScripts folder, can be used directly from diff --git a/src/Mod/Path/PathScripts/rml_post.py b/src/Mod/Path/PathScripts/rml_post.py index 0c3b30ef2a..3460f9d4b5 100644 --- a/src/Mod/Path/PathScripts/rml_post.py +++ b/src/Mod/Path/PathScripts/rml_post.py @@ -22,7 +22,7 @@ #***************************************************************************/ -''' +TOOLTIP=''' FreeCAD Path post-processor to output code for the Roland Modela MDX-## machines. The machine speaks RML-1, specified in 'Roland RML-1 Programming Guidelines'