diff --git a/src/Mod/CAM/Path/Dressup/Array.py b/src/Mod/CAM/Path/Dressup/Array.py index f57ee956c3..72fb24f173 100644 --- a/src/Mod/CAM/Path/Dressup/Array.py +++ b/src/Mod/CAM/Path/Dressup/Array.py @@ -166,6 +166,8 @@ class DressupArray: def onChanged(self, obj, prop): if prop == "Type": self.setEditorModes(obj) + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() def onDocumentRestored(self, obj): """onDocumentRestored(obj) ... Called automatically when document is restored.""" diff --git a/src/Mod/CAM/Path/Dressup/Boundary.py b/src/Mod/CAM/Path/Dressup/Boundary.py index a1d1f3852a..79f454c297 100644 --- a/src/Mod/CAM/Path/Dressup/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Boundary.py @@ -95,6 +95,10 @@ class DressupPathBoundary(object): def loads(self, state): return None + def onChanged(self, obj, prop): + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() + def onDocumentRestored(self, obj): self.obj = obj if not hasattr(obj, "KeepToolDown"): diff --git a/src/Mod/CAM/Path/Dressup/DogboneII.py b/src/Mod/CAM/Path/Dressup/DogboneII.py index cba0461efd..ac2d550813 100644 --- a/src/Mod/CAM/Path/Dressup/DogboneII.py +++ b/src/Mod/CAM/Path/Dressup/DogboneII.py @@ -277,6 +277,10 @@ class Proxy(object): def loads(self, state): return None + def onChanged(self, obj, prop): + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() + def toolRadius(self, obj): return PathDressup.toolController(obj.Base).Tool.Diameter.Value / 2 diff --git a/src/Mod/CAM/Path/Dressup/Gui/Array.py b/src/Mod/CAM/Path/Dressup/Gui/Array.py index 74f9a4772c..f2a42dbead 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Array.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Array.py @@ -5,6 +5,7 @@ import FreeCAD import Path import Path.Base.Util as PathUtil import Path.Dressup.Array as DressupArray +import Path.Dressup.Utils as PathDressup import Path.Main.Stock as PathStock import PathScripts.PathUtils as PathUtils @@ -51,6 +52,12 @@ class DressupArrayViewProvider(object): def clearTaskPanel(self): pass + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandPathDressupArray: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py b/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py index f8478fc240..8750bf4a05 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py +++ b/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py @@ -26,6 +26,7 @@ import Path import math import Path.Base.Gui.Util as PathGuiUtil import PathScripts.PathUtils as PathUtils +import Path.Dressup.Utils as PathDressup from PySide.QtCore import QT_TRANSLATE_NOOP if False: @@ -150,6 +151,8 @@ class ObjectDressup: job = PathUtils.findParentJob(obj) if job: job.Proxy.setCenterOfRotation(self.center(obj)) + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() def center(self, obj): return FreeCAD.Vector(0, 0, 0 - obj.Radius.Value) @@ -246,6 +249,12 @@ class ViewProviderDressup: arg1.Object.Base = None return True + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandPathDressup: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Gui/Boundary.py b/src/Mod/CAM/Path/Dressup/Gui/Boundary.py index 1b582c2b58..ccac16ca33 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Boundary.py @@ -27,6 +27,7 @@ import FreeCAD import FreeCADGui import Path import Path.Dressup.Boundary as PathDressupPathBoundary +import Path.Dressup.Utils as PathDressup import PathGui if False: @@ -241,6 +242,12 @@ class DressupPathBoundaryViewProvider(object): def clearTaskPanel(self): self.panel = None + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + def Create(base, name="DressupPathBoundary"): FreeCAD.ActiveDocument.openTransaction("Create a Boundary dressup") diff --git a/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py b/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py index 9b2166dce0..3e20e745c6 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py +++ b/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py @@ -27,6 +27,7 @@ import FreeCAD import FreeCADGui import Path import Path.Dressup.DogboneII as DogboneII +import Path.Dressup.Utils as PathDressup import PathScripts.PathUtils as PathUtils if False: @@ -301,6 +302,12 @@ class ViewProviderDressup(object): arg1.Object.Base = None return True + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + def Create(base, name="DressupDogbone"): """ diff --git a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py index 6e86cab7b3..b615817498 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py @@ -27,6 +27,7 @@ import Path.Base.Gui.Util as PathGuiUtil from PySide import QtCore import math import PathScripts.PathUtils as PathUtils +import Path.Dressup.Utils as PathDressup from PySide.QtCore import QT_TRANSLATE_NOOP # lazily loaded modules @@ -88,6 +89,10 @@ class ObjectDressup: def loads(self, state): return None + def onChanged(self, obj, prop): + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() + def shortcut(self, queue): """Determines whether its shorter to twist CW or CCW to align with the next move""" @@ -573,6 +578,12 @@ class ViewProviderDressup: arg1.Object.Base = None return True + def getIcon(self): + if getattr(PathDressup.baseOp(self.Object), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandDressupDragknife: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py index 546a40a400..3f301d8899 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py +++ b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py @@ -170,6 +170,10 @@ class ObjectDressup: def loads(self, state): return None + def onChanged(self, obj, prop): + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() + def setup(self, obj): obj.LeadIn = True obj.LeadOut = True @@ -1344,6 +1348,12 @@ class ViewProviderDressup: def clearTaskPanel(self): self.panel = None + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandPathDressupLeadInOut: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py b/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py index 870bc7a8be..02c19c7be0 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py +++ b/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py @@ -286,6 +286,8 @@ class ObjectDressup: def onChanged(self, obj, prop): if prop in ["RampFeedRate", "UseStartDepth"]: self.setEditorProperties(obj) + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() def setEditorProperties(self, obj): if hasattr(obj, "UseStartDepth"): @@ -359,7 +361,7 @@ class ObjectDressup: last_params.update(params) if cmd.Name in Path.Geom.CmdMoveAll and ( - not "X" in params or not "Y" in params or not "Z" in params + "X" not in params or "Y" not in params or "Z" not in params ): params["X"] = params.get("X", start_point[0]) params["Y"] = params.get("Y", start_point[1]) @@ -759,6 +761,12 @@ class ViewProviderDressup: def loads(self, state): return None + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandPathDressupRampEntry: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Gui/Tags.py b/src/Mod/CAM/Path/Dressup/Gui/Tags.py index 138babc3c8..1b87a8d8bd 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Tags.py @@ -30,6 +30,7 @@ import Path import Path.Base.Gui.GetPoint as PathGetPoint import Path.Dressup.Tags as PathDressupTag import PathScripts.PathUtils as PathUtils +import Path.Dressup.Utils as PathDressup if False: @@ -530,6 +531,12 @@ class PathDressupTagViewProvider: self.panel.selectTagWithId(i) FreeCADGui.updateGui() + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + def Create(baseObject, name="DressupTag"): """ diff --git a/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py b/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py index 4d71c74316..304881c9b8 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py +++ b/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py @@ -29,6 +29,7 @@ import FreeCAD import FreeCADGui import Path import PathScripts.PathUtils as PathUtils +import Path.Dressup.Utils as PathDressup from PySide import QtGui from PySide.QtCore import QT_TRANSLATE_NOOP @@ -95,9 +96,11 @@ class ObjectDressup: def loads(self, state): return None - def onChanged(self, fp, prop): + def onChanged(self, obj, prop): if str(prop) == "probefile": - self._loadFile(fp, fp.probefile) + self._loadFile(obj, obj.probefile) + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() def _bilinearInterpolate(self, surface, x, y): p1 = FreeCAD.Vector(x, y, 100.0) @@ -108,7 +111,7 @@ class ObjectDressup: return points[0].Z def _loadFile(self, obj, filename): - if filename == "": + if not filename: return f1 = open(filename, "r") @@ -329,6 +332,12 @@ class ViewProviderDressup: arg1.Object.Base = None return True + def getIcon(self): + if getattr(PathDressup.baseOp(self.obj), "Active", True): + return ":/icons/CAM_Dressup.svg" + else: + return ":/icons/CAM_OpActive.svg" + class CommandPathDressup: def GetResources(self): diff --git a/src/Mod/CAM/Path/Dressup/Tags.py b/src/Mod/CAM/Path/Dressup/Tags.py index f52552b90d..b0df883ed2 100644 --- a/src/Mod/CAM/Path/Dressup/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Tags.py @@ -972,6 +972,10 @@ class ObjectTagDressup: self.mappers = [] return None + def onChanged(self, obj, prop): + if prop == "Path" and obj.ViewObject: + obj.ViewObject.signalChangeIcon() + def onDocumentRestored(self, obj): self.obj = obj diff --git a/src/Mod/CAM/PathCommands.py b/src/Mod/CAM/PathCommands.py index 2761867984..3d33449b7b 100644 --- a/src/Mod/CAM/PathCommands.py +++ b/src/Mod/CAM/PathCommands.py @@ -191,15 +191,6 @@ class _ToggleOperation: for sel in selection: baseOp = Path.Dressup.Utils.baseOp(sel) baseOp.Active = not baseOp.Active - if sel == baseOp: - # selected not a Dressup - baseOp.ViewObject.Visibility = baseOp.Active - elif not baseOp.Active: - # only hide operation under Dressup - baseOp.ViewObject.Visibility = False - elif baseOp.Active: - # only unhide Dressup - sel.ViewObject.Visibility = True FreeCAD.ActiveDocument.recompute()