From f48fa90cda1d6b5299db3dec34b673499ddfc6a6 Mon Sep 17 00:00:00 2001 From: Renaud Barate Date: Fri, 9 Sep 2011 08:54:44 +0000 Subject: [PATCH] Test for GEOM module properly and only when displaying structural elements --- src/EFICASGUI/eficasSalome.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/EFICASGUI/eficasSalome.py b/src/EFICASGUI/eficasSalome.py index 97923cbf..71952691 100644 --- a/src/EFICASGUI/eficasSalome.py +++ b/src/EFICASGUI/eficasSalome.py @@ -2,6 +2,7 @@ #_____________________________________ import sys, os, re,types +import traceback from PyQt4.QtGui import QMessageBox from salome.kernel.logger import Logger @@ -29,7 +30,6 @@ import SalomePyQt from salome.kernel.studyedit import getStudyEditor -from salome.geom.structelem import StructuralElementManager, InvalidParameterError # couleur pour visualisation des geometries @@ -514,7 +514,13 @@ class MyEficas( qtEficas.Appli ): def envoievisu(self,liste_commandes): - import traceback + try: + from salome.geom.structelem import StructuralElementManager, InvalidParameterError + except ImportError: + QMessageBox.critical(self, self.tr("Error"), + self.tr("Cannot display structural elements: " + "module GEOM is not installed.")) + return try: atLeastOneStudy = self.editor.study if not atLeastOneStudy: @@ -525,7 +531,6 @@ class MyEficas( qtEficas.Appli ): elem.display() salome.sg.updateObjBrowser(True) except InvalidParameterError, err: - from PyQt4.QtGui import QMessageBox trStr = self.tr("Invalid parameter for group %(group)s: %(expr)s must be " "greater than %(minval)g (actual value is %(value)g)") msg = str(trStr) % {"group": err.groupName, "expr": err.expression, -- 2.39.2