Merge branch 'master' of ssh://git.code.sf.net/p/free-cad/code

This commit is contained in:
Yorik van Havre 2014-05-21 18:10:59 -03:00
commit 42d9f1ecab
14 changed files with 54 additions and 33 deletions

View File

@ -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"

View File

@ -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()

View File

@ -872,10 +872,7 @@ class _CommandAdd:
'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()
@ -907,10 +904,7 @@ class _CommandRemove:
'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()
@ -945,10 +939,7 @@ class _CommandSplitMesh:
'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():
@ -973,10 +964,7 @@ class _CommandMeshToShape:
'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():
@ -1009,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 = []
@ -1036,10 +1027,7 @@ class _CommandRemoveShape:
'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()
@ -1053,10 +1041,7 @@ class _CommandCloseHoles:
'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():
@ -1072,10 +1057,7 @@ class _CommandCheck:
'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())
@ -1108,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")

View File

@ -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()

View File

@ -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:

View File

@ -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:

View File

@ -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:

View File

@ -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 = "["

View File

@ -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()

View File

@ -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")

View File

@ -72,6 +72,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")

View File

@ -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")

View File

@ -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"
@ -345,11 +348,8 @@ class _CommandMergeWalls:
'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:

View File

@ -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")