Added tooltip support for PostProcessor scripts.

This commit is contained in:
Markus Lampert 2016-10-20 16:26:41 -07:00 committed by wmayer
parent da94fb506a
commit 67e3b13c13
8 changed files with 41 additions and 7 deletions

View File

@ -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:

View File

@ -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()

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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

View File

@ -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

View File

@ -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'