From: Renaud Barate Date: Wed, 13 Oct 2010 08:25:07 +0000 (+0000) Subject: Fixes to make Eficas for OpenTURNS work properly in Salome context X-Git-Tag: LOGILAB~414 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=268a682fdd5655be0277ea05aeeff92698085b53;p=tools%2Feficas.git Fixes to make Eficas for OpenTURNS work properly in Salome context --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 0f2d52b8..cb91de69 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,7 @@ option ( WITH_OPENTURNS "Install Open TURNS files" OFF ) option ( WITH_ASTER "Install Aster files" OFF ) option ( WITH_MAP "Install MAP files" OFF ) option ( WITH_SEP "Install SEP files" OFF ) +option ( IN_SALOME_CONTEXT "Configure Eficas for use in Salome" OFF ) set ( _OPTIONLIST WITH_OPENTURNS @@ -97,6 +98,7 @@ set ( _SALOME_MECA_LIST WITH_OPENTURNS WITH_ASTER WITH_SEP + IN_SALOME_CONTEXT ) if (WITH_ALL_PACKAGES) @@ -126,7 +128,11 @@ endif ( NOT ${_VALIDOPT} ) # Detection des prerequis lies aux options if (WITH_OPENTURNS) - find_package ( OpenTURNS REQUIRED ) + if (IN_SALOME_CONTEXT) + SET(OpenTURNS_PYTHON_MODULE_DIR "") + else (IN_SALOME_CONTEXT) + find_package ( OpenTURNS REQUIRED ) + endif (IN_SALOME_CONTEXT) endif (WITH_OPENTURNS) #if (WITH_ASTER) diff --git a/InterfaceQT4/CMakeLists.txt b/InterfaceQT4/CMakeLists.txt index 8c102b66..13b390de 100644 --- a/InterfaceQT4/CMakeLists.txt +++ b/InterfaceQT4/CMakeLists.txt @@ -35,6 +35,7 @@ install ( FILES browser.py compobase.py compobloc.py compocommandecomm.py compoc monUniqueSDCOIntoPanel.py monUniqueSDCOPanel.py monVisu.py politiquesValidation.py qtCommun.py qtEficas.py qtSaisie.py readercata.py typeNode.py utilIcons.py viewManager.py + configuration.py DESTINATION ${CMAKE_INSTALL_PREFIX}/InterfaceQT4 ) diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index e1351b90..4605279b 100644 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -238,7 +238,7 @@ class JDCEditor(QSplitter): self.affiche_infos("Erreur à la conversion",Qt.red) else : self.affiche_infos("Type de fichier non reconnu",Qt.red) - QMessageBox.critical( self, "Type de fichier non reconnu","EFICAS ne sait pas ouvrir ce type de fichier") + QMessageBox.critical( self, "Type de fichier non reconnu","EFICAS ne sait pas ouvrir le type de fichier %s" % self.appliEficas.format_fichier_in) return None CONTEXT.unset_current_step() diff --git a/Openturns_Study/CMakeLists.txt b/Openturns_Study/CMakeLists.txt index 4f1f8afa..548f612a 100644 --- a/Openturns_Study/CMakeLists.txt +++ b/Openturns_Study/CMakeLists.txt @@ -22,11 +22,11 @@ # Question : Que faire des fichiers sdistOTqt.py et style.py configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_STUDY.py.in - ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_STUDY.py + ${CMAKE_CURRENT_BINARY_DIR}/prefs_OPENTURNS_STUDY.py @ONLY ) install ( FILES qtEficas_openturns_study.py - ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_STUDY.py + ${CMAKE_CURRENT_BINARY_DIR}/prefs_OPENTURNS_STUDY.py prefs.py configuration_OPENTURNS_STUDY.py opsOT.py diff --git a/Openturns_Study/catalogues_openturns.ini b/Openturns_Study/catalogues_openturns.ini index 35cd8c86..37e0255a 100644 --- a/Openturns_Study/catalogues_openturns.ini +++ b/Openturns_Study/catalogues_openturns.ini @@ -5,6 +5,6 @@ rep_cata=os.getcwd() catalogues = ( # (code,version,catalogue,formatIn,formatOut) - ('OPENTURNS_STUDY','V8',os.path.join(rep_cata,'OpenTURNS_Cata_Study_V10.py'),'openturns_study','wrapper'), + ('OPENTURNS_STUDY','V8',os.path.join(rep_cata,'OpenTURNS_Cata_Study_V8.py'),'openturns_study'), ) diff --git a/Openturns_Study/configuration_OPENTURNS_STUDY.py b/Openturns_Study/configuration_OPENTURNS_STUDY.py index 7eab3837..e6e8d9eb 100644 --- a/Openturns_Study/configuration_OPENTURNS_STUDY.py +++ b/Openturns_Study/configuration_OPENTURNS_STUDY.py @@ -19,7 +19,7 @@ # # ====================================================================== """ - Ce module sert pour charger les paramètres de configuration d'EFICAS + Ce module sert pour charger les paramètres de configuration d'EFICAS """ # Modules Python import configuration @@ -38,8 +38,8 @@ class CONFIG(configuration.CONFIG_BASE): self.labels_user=['exec_acrobat', 'catalogues','savedir','path_doc','OpenTURNS_path'] self.labels_eficas=["OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat"] self.labels_eficas=self.labels_eficas+["rep_cata","initialdir","savedir","catalogues"] - self.setValeurs() self.cataFile="catalogues_openturns.ini" + self.setValeurs() #--------------------------------------- def lecture_fichier_ini_standard(self): diff --git a/Openturns_Study/prefs_OPENTURNS_STUDY.py b/Openturns_Study/prefs_OPENTURNS_STUDY.py deleted file mode 100644 index 7b643304..00000000 --- a/Openturns_Study/prefs_OPENTURNS_STUDY.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY -# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY -# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT -# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU -# GENERAL PUBLIC LICENSE FOR MORE DETAILS. -# -# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE -# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -import os, sys -# Les variables pouvant positionnees sont : -print "import des prefs de OPENTURNS" - -# REPINI sert à localiser le fichier -# initialdir sert comme directory initial des QFileDialog -# positionnee a repin au debut mise a jour dans configuration -REPINI=os.path.dirname(os.path.abspath(__file__)) -initialdir=REPINI - -# INSTALLDIR sert à localiser l'installation d'Eficas -INSTALLDIR=os.path.join(REPINI,'..') - - -# Codage des strings qui accepte les accents (en remplacement de 'ascii') -# lang indique la langue utilisée pour les chaines d'aide : fr ou ang -lang='fr' -encoding='iso-8859-1' - -# Acces a la documentation -rep_cata = INSTALLDIR -path_doc = os.path.join(rep_cata,'Doc') -exec_acrobat = "/usr/bin/xpdf" -savedir = os.environ['HOME'] - - -# OpenTURNS Python module -OpenTURNS_path="/local00/home/dutka/OpenTURNS/dutka/build/install/lib/python2.4/site-packages" -# Choix des catalogues -sys.path[:0]=[INSTALLDIR, OpenTURNS_path] diff --git a/Openturns_Study/prefs_OPENTURNS_STUDY.py.in b/Openturns_Study/prefs_OPENTURNS_STUDY.py.in index e9454058..3f079d41 100644 --- a/Openturns_Study/prefs_OPENTURNS_STUDY.py.in +++ b/Openturns_Study/prefs_OPENTURNS_STUDY.py.in @@ -23,18 +23,18 @@ import os, sys # Les variables pouvant positionnees sont : print "import des prefs de OPENTURNS" -# REPINI sert à localiser le fichier +# REPINI sert à localiser le fichier # initialdir sert comme directory initial des QFileDialog # positionnee a repin au debut mise a jour dans configuration REPINI=os.path.dirname(os.path.abspath(__file__)) initialdir=REPINI -# INSTALLDIR sert à localiser l'installation d'Eficas +# INSTALLDIR sert à localiser l'installation d'Eficas INSTALLDIR=os.path.join(REPINI,'..') # Codage des strings qui accepte les accents (en remplacement de 'ascii') -# lang indique la langue utilisée pour les chaines d'aide : fr ou ang +# lang indique la langue utilisée pour les chaines d'aide : fr ou ang lang='fr' encoding='iso-8859-1' @@ -48,4 +48,6 @@ savedir = os.environ['HOME'] # OpenTURNS Python module OpenTURNS_path="@OpenTURNS_PYTHON_MODULE_DIR@" # Choix des catalogues -sys.path[:0]=[INSTALLDIR, OpenTURNS_path] +if len(OpenTURNS_path) > 0: + sys.path[:0]=[OpenTURNS_path] +sys.path[:0]=[INSTALLDIR] diff --git a/Openturns_Wrapper/CMakeLists.txt b/Openturns_Wrapper/CMakeLists.txt index da3bb738..4beb6981 100644 --- a/Openturns_Wrapper/CMakeLists.txt +++ b/Openturns_Wrapper/CMakeLists.txt @@ -22,11 +22,11 @@ # Question : Que faire des fichiers sdistOTqt.py et style.py configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_WRAPPER.py.in - ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_WRAPPER.py + ${CMAKE_CURRENT_BINARY_DIR}/prefs_OPENTURNS_WRAPPER.py @ONLY ) install ( FILES qtEficas_openturns_wrapper.py - ${CMAKE_CURRENT_SOURCE_DIR}/prefs_OPENTURNS_WRAPPER.py + ${CMAKE_CURRENT_BINARY_DIR}/prefs_OPENTURNS_WRAPPER.py prefs.py configuration_OPENTURNS_WRAPPER.py catalogues_openturns.ini diff --git a/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py b/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py index f15bcd99..20dfb33d 100644 --- a/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py +++ b/Openturns_Wrapper/configuration_OPENTURNS_WRAPPER.py @@ -19,7 +19,7 @@ # # ====================================================================== """ - Ce module sert pour charger les paramètres de configuration d'EFICAS + Ce module sert pour charger les paramètres de configuration d'EFICAS """ # Modules Python import configuration @@ -38,8 +38,8 @@ class CONFIG(configuration.CONFIG_BASE): self.labels_user=['exec_acrobat', 'catalogues','savedir','path_doc','OpenTURNS_path'] self.labels_eficas=["OpenTURNS_path","rep_user","INSTALLDIR","path_doc","exec_acrobat"] self.labels_eficas=self.labels_eficas+["rep_cata","initialdir","savedir","catalogues"] - self.setValeurs() self.cataFile="catalogues_openturns.ini" + self.setValeurs() #--------------------------------------- diff --git a/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py b/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py deleted file mode 100644 index 7b643304..00000000 --- a/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py +++ /dev/null @@ -1,51 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM IS FREE SOFTWARE; YOU CAN REDISTRIBUTE IT AND/OR MODIFY -# IT UNDER THE TERMS OF THE GNU GENERAL PUBLIC LICENSE AS PUBLISHED BY -# THE FREE SOFTWARE FOUNDATION; EITHER VERSION 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT -# WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF -# MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE GNU -# GENERAL PUBLIC LICENSE FOR MORE DETAILS. -# -# YOU SHOULD HAVE RECEIVED A COPY OF THE GNU GENERAL PUBLIC LICENSE -# ALONG WITH THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -import os, sys -# Les variables pouvant positionnees sont : -print "import des prefs de OPENTURNS" - -# REPINI sert à localiser le fichier -# initialdir sert comme directory initial des QFileDialog -# positionnee a repin au debut mise a jour dans configuration -REPINI=os.path.dirname(os.path.abspath(__file__)) -initialdir=REPINI - -# INSTALLDIR sert à localiser l'installation d'Eficas -INSTALLDIR=os.path.join(REPINI,'..') - - -# Codage des strings qui accepte les accents (en remplacement de 'ascii') -# lang indique la langue utilisée pour les chaines d'aide : fr ou ang -lang='fr' -encoding='iso-8859-1' - -# Acces a la documentation -rep_cata = INSTALLDIR -path_doc = os.path.join(rep_cata,'Doc') -exec_acrobat = "/usr/bin/xpdf" -savedir = os.environ['HOME'] - - -# OpenTURNS Python module -OpenTURNS_path="/local00/home/dutka/OpenTURNS/dutka/build/install/lib/python2.4/site-packages" -# Choix des catalogues -sys.path[:0]=[INSTALLDIR, OpenTURNS_path] diff --git a/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py.in b/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py.in index e9454058..3f079d41 100644 --- a/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py.in +++ b/Openturns_Wrapper/prefs_OPENTURNS_WRAPPER.py.in @@ -23,18 +23,18 @@ import os, sys # Les variables pouvant positionnees sont : print "import des prefs de OPENTURNS" -# REPINI sert à localiser le fichier +# REPINI sert à localiser le fichier # initialdir sert comme directory initial des QFileDialog # positionnee a repin au debut mise a jour dans configuration REPINI=os.path.dirname(os.path.abspath(__file__)) initialdir=REPINI -# INSTALLDIR sert à localiser l'installation d'Eficas +# INSTALLDIR sert à localiser l'installation d'Eficas INSTALLDIR=os.path.join(REPINI,'..') # Codage des strings qui accepte les accents (en remplacement de 'ascii') -# lang indique la langue utilisée pour les chaines d'aide : fr ou ang +# lang indique la langue utilisée pour les chaines d'aide : fr ou ang lang='fr' encoding='iso-8859-1' @@ -48,4 +48,6 @@ savedir = os.environ['HOME'] # OpenTURNS Python module OpenTURNS_path="@OpenTURNS_PYTHON_MODULE_DIR@" # Choix des catalogues -sys.path[:0]=[INSTALLDIR, OpenTURNS_path] +if len(OpenTURNS_path) > 0: + sys.path[:0]=[OpenTURNS_path] +sys.path[:0]=[INSTALLDIR]