From fce27b94f9af38c3db98c212a1b667def4648995 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Wed, 16 Mar 2022 22:27:56 -0500 Subject: [PATCH 1/2] minor fix --- src/Mod/Path/PathScripts/PathInspect.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathInspect.py b/src/Mod/Path/PathScripts/PathInspect.py index 786bcd2c4c..38692c9397 100644 --- a/src/Mod/Path/PathScripts/PathInspect.py +++ b/src/Mod/Path/PathScripts/PathInspect.py @@ -265,11 +265,12 @@ class CommandPathInspect: } def IsActive(self): - if FreeCAD.ActiveDocument is not None: - for o in FreeCAD.ActiveDocument.Objects: - if o.Name[:3] == "Job": - return True - return False + return hasattr(FreeCADGui.Selection.getSelection()[0], "Path") + # if FreeCAD.ActiveDocument is not None: + # for o in FreeCAD.ActiveDocument.Objects: + # if o.Name[:3] == "Job": + # return True + # return False def Activated(self): # check that the selection contains exactly what we want From 3e3ce1b4a5c42ea6a145e4bc9683b6ca07627e94 Mon Sep 17 00:00:00 2001 From: sliptonic Date: Tue, 29 Mar 2022 18:04:10 -0500 Subject: [PATCH 2/2] [Path] minor tweaks to inspect --- src/Mod/Path/PathScripts/PathInspect.py | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Mod/Path/PathScripts/PathInspect.py b/src/Mod/Path/PathScripts/PathInspect.py index 38692c9397..bc68e2e78e 100644 --- a/src/Mod/Path/PathScripts/PathInspect.py +++ b/src/Mod/Path/PathScripts/PathInspect.py @@ -132,7 +132,7 @@ class GCodeEditorDialog(QtGui.QDialog): lab.setText( translate( "Path_Inspect", - "Note: Pressing OK will commit any change you make above to the object, but if the object is parametric, these changes will be overridden on recompute.", + "Note: This dialog shows Path Commands in FreeCAD base units (mm/s). \n Values will be converted to the desired unit during post-processing.", ) ) lab.setWordWrap(True) @@ -140,12 +140,12 @@ class GCodeEditorDialog(QtGui.QDialog): # OK and Cancel buttons self.buttons = QtGui.QDialogButtonBox( - QtGui.QDialogButtonBox.Ok | QtGui.QDialogButtonBox.Cancel, + QtGui.QDialogButtonBox.Close, QtCore.Qt.Horizontal, self, ) + layout.addWidget(self.buttons) - self.buttons.accepted.connect(self.accept) self.buttons.rejected.connect(self.reject) self.editor.selectionChanged.connect(self.highlightpath) self.finished.connect(self.cleanup) @@ -257,20 +257,16 @@ class CommandPathInspect: def GetResources(self): return { "Pixmap": "Path_Inspect", - "MenuText": QT_TRANSLATE_NOOP("Path_Inspect", "Inspect G-code"), + "MenuText": QT_TRANSLATE_NOOP("Path_Inspect", "Inspect Path Commands"), "Accel": "P, I", "ToolTip": QT_TRANSLATE_NOOP( - "Path_Inspect", "Inspects the G-code contents of a path" + "Path_Inspect", "Inspects the contents of a Path object" ), } def IsActive(self): - return hasattr(FreeCADGui.Selection.getSelection()[0], "Path") - # if FreeCAD.ActiveDocument is not None: - # for o in FreeCAD.ActiveDocument.Objects: - # if o.Name[:3] == "Job": - # return True - # return False + obj = FreeCADGui.Selection.getSelection()[0] + return hasattr(obj, "Path") and len(obj.Path.Commands) > 0 def Activated(self): # check that the selection contains exactly what we want