FEM: Migrate _CommandPurgeFemResults to FemCommands and add new is_active type

Signed-off-by: Przemo Firszt <przemo@firszt.eu>
This commit is contained in:
Przemo Firszt
2015-10-13 10:41:38 +01:00
committed by wmayer
parent da3444775a
commit 7d8db19ef8
2 changed files with 19 additions and 19 deletions

View File

@@ -52,4 +52,14 @@ class FemCommands(object):
active = FreeCADGui.ActiveDocument is not None
elif self.is_active == 'with_analysis':
active = FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None
elif self.is_active == 'with_results':
active = FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None and self.results_present()
return active
def results_present(self):
results = False
analysis_members = FemGui.getActiveAnalysis().Member
for o in analysis_members:
if o.isDerivedFrom('Fem::FemResultObject'):
results = True
return results