From 499630034be118c4d0df4ff3297f73cb3f248c0f Mon Sep 17 00:00:00 2001 From: Przemo Firszt Date: Mon, 19 Oct 2015 14:04:47 +0100 Subject: [PATCH] FEM: improve enabling/disabling commands Signed-off-by: Przemo Firszt --- src/Mod/Fem/FemCommands.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Mod/Fem/FemCommands.py b/src/Mod/Fem/FemCommands.py index 1689df662..e5abf07f8 100644 --- a/src/Mod/Fem/FemCommands.py +++ b/src/Mod/Fem/FemCommands.py @@ -51,11 +51,11 @@ class FemCommands(object): elif self.is_active == 'with_document': active = FreeCADGui.ActiveDocument is not None elif self.is_active == 'with_analysis': - active = FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None + active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() elif self.is_active == 'with_results': - active = FreeCADGui.ActiveDocument is not None and FemGui.getActiveAnalysis() is not None and self.results_present() + active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.results_present() elif self.is_active == 'with_part_feature': - active = FemGui.getActiveAnalysis() is not None and FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument and self.part_feature_selected() + active = FemGui.getActiveAnalysis() is not None and self.active_analysis_in_active_doc() and self.part_feature_selected() return active def results_present(self): @@ -72,3 +72,6 @@ class FemCommands(object): return True else: return False + + def active_analysis_in_active_doc(self): + return FemGui.getActiveAnalysis().Document is FreeCAD.ActiveDocument