In the c++ version of Gui/Command, there is a method isActive that returns true if the command is available for use. Does this method work in Python commands? Mine does not seem to get executed.
#does isActive work in python commands?
def isActive(self):
"""Return True when the command should be active or False when it should be disabled (greyed)."""
print("isActive")
if App.ActiveDocument:
print("have ActiveDocument")
return havePage() and haveView()
else:
return False
wandererfan wrote: ↑Fri Jan 14, 2022 1:55 pm
In the c++ version of Gui/Command, there is a method isActive that returns true if the command is available for use. Does this method work in Python commands? Mine does not seem to get executed.
#does isActive work in python commands?
def isActive(self):
"""Return True when the command should be active or False when it should be disabled (greyed)."""
print("isActive")
if App.ActiveDocument:
print("have ActiveDocument")
return havePage() and haveView()
else:
return False
Try it with an upper case i, see here: https://github.com/FreeCAD/FreeCAD/blob ... ure.py#L68
This does what it's supposed to do; I verified by inverting the condition. A `print` call though seems to end up in the limbo; it's neither redirected to the reports view, nor to the terminal that started freecad.