diff --git a/src/Mod/CAM/Path/Dressup/Array.py b/src/Mod/CAM/Path/Dressup/Array.py index aa73c7fb29..730475b2bc 100644 --- a/src/Mod/CAM/Path/Dressup/Array.py +++ b/src/Mod/CAM/Path/Dressup/Array.py @@ -164,6 +164,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 0458c5046c..2da47ac18c 100644 --- a/src/Mod/CAM/Path/Dressup/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Boundary.py @@ -93,6 +93,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 ebb250caa1..974f7dc8e8 100644 --- a/src/Mod/CAM/Path/Dressup/DogboneII.py +++ b/src/Mod/CAM/Path/Dressup/DogboneII.py @@ -275,6 +275,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 8b0220de40..78644405fa 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Array.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Array.py @@ -3,6 +3,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 @@ -49,6 +50,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 6f4456fea4..a7c1de1f90 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py +++ b/src/Mod/CAM/Path/Dressup/Gui/AxisMap.py @@ -24,6 +24,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: @@ -148,6 +149,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) @@ -244,6 +247,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 dc65eb023f..94357c6c58 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Boundary.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Boundary.py @@ -25,6 +25,7 @@ import FreeCAD import FreeCADGui import Path import Path.Dressup.Boundary as PathDressupPathBoundary +import Path.Dressup.Utils as PathDressup import PathGui if False: @@ -239,6 +240,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 f8cfd48559..08201da632 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py +++ b/src/Mod/CAM/Path/Dressup/Gui/DogboneII.py @@ -25,6 +25,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: @@ -299,6 +300,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 7c2002f25d..5aa733ad76 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Dragknife.py @@ -25,6 +25,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 @@ -86,6 +87,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""" @@ -571,6 +576,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 5896c44f10..b0288161c7 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py +++ b/src/Mod/CAM/Path/Dressup/Gui/LeadInOut.py @@ -168,6 +168,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 @@ -1342,6 +1346,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 5caabe2cea..b10cf5ffe2 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py +++ b/src/Mod/CAM/Path/Dressup/Gui/RampEntry.py @@ -284,6 +284,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"): @@ -357,7 +359,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]) @@ -757,6 +759,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 149a4140df..00d1c2f8f6 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Gui/Tags.py @@ -28,6 +28,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: @@ -528,6 +529,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 02042472c4..e95bef0833 100644 --- a/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py +++ b/src/Mod/CAM/Path/Dressup/Gui/ZCorrect.py @@ -27,6 +27,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 @@ -93,9 +94,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) @@ -106,7 +109,7 @@ class ObjectDressup: return points[0].Z def _loadFile(self, obj, filename): - if filename == "": + if not filename: return f1 = open(filename, "r") @@ -327,6 +330,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 1f09ab12dc..118febb6db 100644 --- a/src/Mod/CAM/Path/Dressup/Tags.py +++ b/src/Mod/CAM/Path/Dressup/Tags.py @@ -970,6 +970,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 5e0cf56447..1396ce59ee 100644 --- a/src/Mod/CAM/PathCommands.py +++ b/src/Mod/CAM/PathCommands.py @@ -189,15 +189,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()