Skip to content

Commit

Permalink
Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code
Browse files Browse the repository at this point in the history
  • Loading branch information
yorikvanhavre committed May 21, 2014
2 parents 0a71f4a + 4a6449d commit 42d9f1e
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 33 deletions.
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchAxis.py
Expand Up @@ -72,6 +72,9 @@ def Activated(self):
else:
FreeCADGui.doCommand("Arch.makeAxis()")
FreeCAD.ActiveDocument.commitTransaction()

def IsActive(self):
return not FreeCAD.ActiveDocument is None

class _Axis:
"The Axis object"
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchBuilding.py
Expand Up @@ -51,6 +51,9 @@ def GetResources(self):
'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()
Expand Down
41 changes: 13 additions & 28 deletions src/Mod/Arch/ArchCommands.py
Expand Up @@ -872,10 +872,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Add","Adds the selected components to the active object")}

def IsActive(self):
if len(FreeCADGui.Selection.getSelection()) > 1:
return True
else:
return False
return len(FreeCADGui.Selection.getSelection()) > 1

def Activated(self):
sel = FreeCADGui.Selection.getSelection()
Expand Down Expand Up @@ -907,10 +904,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Remove","Remove the selected components from their parents, or create a hole in a component")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
sel = FreeCADGui.Selection.getSelection()
Expand Down Expand Up @@ -945,10 +939,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_SplitMesh","Splits selected meshes into independent components")}

def IsActive(self):
if len(FreeCADGui.Selection.getSelection()):
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
if FreeCADGui.Selection.getSelection():
Expand All @@ -973,10 +964,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_MeshToShape","Turns selected meshes into Part Shape objects")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
if FreeCADGui.Selection.getSelection():
Expand Down Expand Up @@ -1009,6 +997,9 @@ def GetResources(self):
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 = []
Expand Down Expand Up @@ -1036,10 +1027,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_RemoveShape","Removes cubic shapes from Arch components")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
sel = FreeCADGui.Selection.getSelection()
Expand All @@ -1053,10 +1041,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_CloseHoles","Closes holes in open shapes, turning them solids")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
for o in FreeCADGui.Selection.getSelection():
Expand All @@ -1072,10 +1057,7 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_Check","Checks the selected objects for problems")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False
return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
result = check(FreeCADGui.Selection.getSelection())
Expand Down Expand Up @@ -1108,6 +1090,9 @@ def GetResources(self):
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")
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchFloor.py
Expand Up @@ -53,6 +53,9 @@ def GetResources(self):
'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()
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchFrame.py
Expand Up @@ -58,6 +58,9 @@ def GetResources(self):
'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:
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchRebar.py
Expand Up @@ -79,6 +79,9 @@ def GetResources(self):
'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:
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchRoof.py
Expand Up @@ -57,6 +57,9 @@ def GetResources(self):
'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:
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchSectionPlane.py
Expand Up @@ -75,6 +75,9 @@ def GetResources(self):
'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 = "["
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchSite.py
Expand Up @@ -51,6 +51,9 @@ def GetResources(self):
'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()
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchSpace.py
Expand Up @@ -77,6 +77,9 @@ def GetResources(self):
'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")
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchStairs.py
Expand Up @@ -72,6 +72,9 @@ def GetResources(self):
'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")
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchStructure.py
Expand Up @@ -363,6 +363,9 @@ def GetResources(self):
'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")
Expand Down
10 changes: 5 additions & 5 deletions src/Mod/Arch/ArchWall.py
Expand Up @@ -149,6 +149,9 @@ def GetResources(self):
'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"
Expand Down Expand Up @@ -345,11 +348,8 @@ def GetResources(self):
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Arch_MergeWalls","Merges the selected walls, if possible")}

def IsActive(self):
if FreeCADGui.Selection.getSelection():
return True
else:
return False

return bool(FreeCADGui.Selection.getSelection())

def Activated(self):
walls = FreeCADGui.Selection.getSelection()
if len(walls) == 1:
Expand Down
3 changes: 3 additions & 0 deletions src/Mod/Arch/ArchWindow.py
Expand Up @@ -373,6 +373,9 @@ def GetResources(self):
'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")
Expand Down

0 comments on commit 42d9f1e

Please sign in to comment.