Merge pull request #24732 from tarman3/dressup_icon
CAM: Fix Dressups icon Active state
This commit is contained in:
@@ -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."""
|
||||
|
||||
@@ -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"):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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"):
|
||||
"""
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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"):
|
||||
"""
|
||||
|
||||
@@ -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):
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user