deactivate commands in Arch if no document is open
This commit is contained in:
parent
6f09d262d7
commit
4a6449d2bd
|
@ -72,6 +72,9 @@ class _CommandAxis:
|
|||
else:
|
||||
FreeCADGui.doCommand("Arch.makeAxis()")
|
||||
FreeCAD.ActiveDocument.commitTransaction()
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
class _Axis:
|
||||
"The Axis object"
|
||||
|
|
|
@ -51,6 +51,9 @@ class _CommandBuilding:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Building","Building"),
|
||||
'Accel': "B, U",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Building","Creates a building object including selected objects.")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
|
|
|
@ -997,6 +997,9 @@ class _CommandSelectNonSolidMeshes:
|
|||
return {'Pixmap': 'Arch_SelectNonManifold.svg',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SelectNonSolidMeshes","Select non-manifold meshes"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SelectNonSolidMeshes","Selects all non-manifold meshes from the document or from the selected groups")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
msel = []
|
||||
|
@ -1087,6 +1090,9 @@ class _CommandSurvey:
|
|||
return {'Pixmap' : 'Arch_Survey',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Survey","Survey"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Survey","Starts survey")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
|
|
|
@ -53,6 +53,9 @@ class _CommandFloor:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Floor"),
|
||||
'Accel': "F, L",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Floor","Creates a floor object including selected objects")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
|
|
|
@ -58,6 +58,9 @@ class _CommandFrame:
|
|||
'Accel': "F, R",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Frame","Creates a frame object from a planar 2D object and a profile")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
s = FreeCADGui.Selection.getSelection()
|
||||
if len(s) == 2:
|
||||
|
|
|
@ -79,6 +79,9 @@ class _CommandRebar:
|
|||
'Accel': "R, B",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Rebar","Creates a Reinforcement bar from the selected face of a structural object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
if sel:
|
||||
|
|
|
@ -57,6 +57,9 @@ class _CommandRoof:
|
|||
'Accel': "R, F",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Roof","Creates a roof object from the selected face of an object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelectionEx()
|
||||
if sel:
|
||||
|
|
|
@ -75,6 +75,9 @@ class _CommandSectionPlane:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Section Plane"),
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SectionPlane","Creates a section plane object, including the selected objects")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
ss = "["
|
||||
|
|
|
@ -51,6 +51,9 @@ class _CommandSite:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Site"),
|
||||
'Accel': "S, I",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Site","Creates a site object including selected objects.")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
|
|
|
@ -77,6 +77,9 @@ class _CommandSpace:
|
|||
'Accel': "S, P",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a space object from selected boundary objects")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Space"))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
|
|
|
@ -59,6 +59,9 @@ class _CommandStairs:
|
|||
'Accel': "S, R",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Space","Creates a stairs object")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction(translate("Arch","Create Stairs"))
|
||||
FreeCADGui.doCommand("import Arch")
|
||||
|
|
|
@ -363,6 +363,9 @@ class _CommandStructure:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Structure","Structure"),
|
||||
'Accel': "S, T",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Structure","Creates a structure object from scratch or from a selected object (sketch, wire, face or solid)")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
|
|
@ -149,6 +149,9 @@ class _CommandWall:
|
|||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Arch_Wall","Wall"),
|
||||
'Accel': "W, A",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Wall","Creates a wall object from scratch or from a selected object (wire, face or solid)")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
self.Align = "Center"
|
||||
|
|
|
@ -373,6 +373,9 @@ class _CommandWindow:
|
|||
'Accel': "W, N",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Window","Creates a window object from a selected object (wire, rectangle or sketch)")}
|
||||
|
||||
def IsActive(self):
|
||||
return not FreeCAD.ActiveDocument is None
|
||||
|
||||
def Activated(self):
|
||||
sel = FreeCADGui.Selection.getSelection()
|
||||
p = FreeCAD.ParamGet("User parameter:BaseApp/Preferences/Mod/Arch")
|
||||
|
|
Loading…
Reference in New Issue
Block a user