Salome HOME
ajout des prefs-telemac dans le path
authorpascale.noyret <pascale.noyret@edf.fr>
Mon, 14 Dec 2015 14:35:13 +0000 (15:35 +0100)
committerpascale.noyret <pascale.noyret@edf.fr>
Mon, 14 Dec 2015 14:35:13 +0000 (15:35 +0100)
eficasSalome.py [new file with mode: 0755]

diff --git a/eficasSalome.py b/eficasSalome.py
new file mode 100755 (executable)
index 0000000..fc57b98
--- /dev/null
@@ -0,0 +1,798 @@
+# -*- coding: utf-8 -*-
+#_____________________________________
+
+import sys, os, re,types
+import traceback
+from PyQt4.QtGui import QMessageBox
+from PyQt4.QtGui import QApplication
+
+from salome.kernel.logger import Logger
+logger = Logger( "EFICAS_SRC.EFICASGUI.eficasSalome.py" )
+
+import eficasConfig 
+# eficasConfig definit le EFICAS_ROOT
+# lignes de path ajoutees pour acceder aux packages python du
+# logiciel Eficas. Le package Aster est ajoute explicitement pour
+# acceder au module prefs.py. A
+# ajout de InterfaceQT4 pour permettre l acces a la fenetre Option
+sys.path[:0]=[eficasConfig.eficasPath,
+              os.path.join( eficasConfig.eficasPath,'Editeur'),
+              os.path.join( eficasConfig.eficasPath,'UiQT4'),
+              os.path.join( eficasConfig.eficasPath,'InterfaceQT4'),
+              #os.path.join( eficasConfig.eficasPath,'Extensions'),
+              eficasConfig.eficasPath,
+             ]
+
+
+import Editeur    
+from InterfaceQT4 import qtEficas
+
+import salome
+import SalomePyQt
+sgPyQt = SalomePyQt.SalomePyQt()
+langue=str(sgPyQt.stringSetting("language","language"))
+
+
+from salome.kernel.studyedit import getStudyEditor
+
+
+# couleur pour visualisation des geometries 
+import colors
+COLORS = colors.ListeColors
+LEN_COLORS = len( COLORS )
+
+from Extensions import localisation
+localisation.localise(None,langue)
+
+
+class MyEficas( qtEficas.Appli ):
+    """
+    Classe de lancement du logiciel EFICAS dans SALOME
+    Cette classe specialise le logiciel Eficas par l'ajout de:        
+    a)la creation de groupes de mailles dans le composant SMESH de SALOME
+    b)la visualisation d'elements geometrique dans le coposant GEOM de SALOME par selection dans EFICAS
+    """
+    def __init__( self, parent, code = "ASTER", fichier = None, module = "EFICAS",
+                  version = None, componentName = "Eficas",multi=False):
+        """
+        Constructeur.
+        @type   parent: 
+        @param  parent: widget Qt parent
+        @type   code: string
+        @param  code: catalogue a lancer ( ASTER, HOMARD OPENTURNS ). optionnel ( defaut = ASTER ).
+        @type   fichier: string
+        @param  fichier: chemin absolu du fichier eficas a ouvrir a das le lancement. optionnel
+        """
+
+        dictPathCode={'ASTER':'Aster','OPENTURNS_STUDY':'Openturns_Study','CARMEL3D':'Carmel3D', 'CARMELCND':'CarmelCND',
+                      'OPENTURNS_WRAPPER':'Openturns_Wrapper','MAP':'MAP','SEP':'Sep', 'ZCRACKS':'ZCracks', 'TELEMAC':'Telemac'}
+        if code in dictPathCode.keys():
+            pathCode=dictPathCode[code]
+            sys.path[:0]=[os.path.join(eficasConfig.eficasPath,pathCode)]
+
+        if Editeur.__dict__.has_key( 'session' ):
+            from Editeur import session
+            eficasArg = []
+            eficasArg += sys.argv            
+            if fichier:
+                eficasArg += [ fichier ]
+            if version:
+                eficasArg += [ "-c", version ]
+            else :
+                print "noversion"
+            session.parse( eficasArg )
+                        
+        self.editor = getStudyEditor()    # Editeur de l'arbre d'etude
+
+        qtEficas.Appli.__init__( self,code=code,salome=1,parent=parent,multi=multi,langue=langue)
+        
+        #--------------- specialisation EFICAS dans SALOME  -------------------                
+        self.parent = parent        
+        self.salome = True      #active les parties de code specifique dans Salome( pour le logiciel Eficas )
+        self.module = module    #indique sous quel module dans l'arbre d'etude ajouter le JDC.
+        self.componentName = componentName
+        
+        # donnee pour la creation de groupe de maille
+        self.mainShapeNames   = {} #dictionnaire pour gerer les multiples fichiers possibles ouverts par 
+                                   #eficas ( cle = identifiant du JDC ), une mainshape par fichier ouvert.    
+                                   #dictionnaire des sous-geometrie de la geometrie principale ( cle = entry, valeur = name ) 
+        #----------------------------------------------------------------------    
+        
+        self.icolor = 0  # compteur pour memoriser la couleur courante
+        self.show()
+        
+        
+    def closeEvent(self,event):
+        res=self.fileExit()
+        if res==2 : 
+          event.ignore()
+          return
+        if hasattr(self,'readercata') :
+           del self.readercata
+        import math
+        try:
+          import Numeric
+        except:
+          import numpy
+          Numeric = numpy
+
+        from Extensions.param2 import originalMath
+        #Numeric.cos=originalMath.numeric_ncos
+        #Numeric.sin=originalMath.numeric_nsin
+        #Numeric.array=originalMath.numeric_narray
+        #math.sin=originalMath.sin
+        #math.cos=originalMath.cos
+        #math.sqrt=originalMath.sqrt
+        #math.ceil=originalMath.ceil
+        #math.pi=originalMath.pi
+        originalMath.toOriginal()
+
+        global appli
+        appli = None
+        event.accept()
+     
+# ___________________________ Methodes de l ex Pal __________________________________
+
+    #----------------------------------------------------------------
+    def getCORBAObjectInComponent( self,  entry, composant ):
+    #----------------------------------------------------------------
+       object = None
+       mySO = self.editor.study.FindObjectID(entry)
+       if mySO:
+          object = mySO.GetObject()
+          if not object:
+             myComponent = salome.lcc.FindOrLoadComponent("FactoryServer", composant)
+             SCom        = self.editor.study.FindComponent( composant )
+             print myComponent , SCom
+             self.editor.builder.LoadWith( SCom , myComponent  )
+             object      = mySO.GetObject()
+       if not object :
+             logger.debug("selectedEntry: An error occurs")
+       return object
+
+
+    #----------------------------------------------
+    def giveMeshGroups( self,entry,label1,typeMesh):
+    #----------------------------------------------
+       msg=None
+       names=[]
+       import SMESH
+       try:
+         monMaillage =self.getCORBAObjectInComponent(entry,"SMESH") 
+         if monMaillage != None :                                    # selection d'un groupe de SMESH
+            if  monMaillage._narrow(SMESH.SMESH_Mesh):
+                mailSO = self.editor.study.FindObjectID(entry)
+                if mailSO == None : return names, msg
+
+
+                subIt = self.editor.study.NewChildIterator(mailSO)
+                while subIt.More():
+                      subSO = subIt.Value()
+                      subIt.Next()
+
+                      if (subSO.GetName()[0:9]!=label1) : continue
+                      subSSMeshit=self.editor.study.NewChildIterator(subSO)
+                      while subSSMeshit.More():
+                           subSSMeshSO = subSSMeshit.Value()
+                           subSSMeshit.Next()
+                           if  subSSMeshSO.GetObject()._narrow(typeMesh):
+                               names.append(subSSMeshSO.GetName())
+            else :
+                msg=entry + self.tr(" n est pas un maillage")
+       except :
+         logger.debug(' giveMeshGroups pb avec ( entry = %s ) ' %entry )          
+         msg=' giveMeshGroup pb avec ( entry = %s ) '+ entry          
+       return names, msg
+
+    #-------------------------------------
+    def isMeshGroup( self,entry):
+    #-------------------------------------
+       result=False
+       import SMESH
+       try:
+         monObjet =self.getCORBAObjectInComponent(entry,"SMESH") 
+         if monObjet != None :                                    # selection d'un groupe de SMESH
+            if  monObjet._narrow(SMESH.SMESH_GroupBase):
+                result = True 
+       except :
+         logger.debug(' isMeshGroup pb avec ( entry = %s ) ' %entry )          
+       return result
+
+    #-------------------------------------
+    def isMesh( self,entry):
+    #-------------------------------------
+       result=False
+       import SMESH
+       try:
+         monObjet =self.getCORBAObjectInComponent(entry,"SMESH") 
+         if monObjet != None :                                    # selection d'un groupe de SMESH
+            if  monObjet._narrow(SMESH.SMESH_Mesh):
+                result = True 
+       except :
+         logger.debug(' isMesh pb avec ( entry = %s ) ' %entry )          
+       return result
+
+    #-------------------------------------
+    def getMesh( self,entry):
+    #-------------------------------------
+       meshObject=None
+       import SMESH
+       try:
+       #if 1 :
+         monObjet =self.getCORBAObjectInComponent(entry,"SMESH") 
+         if monObjet != None :                                    # selection d'un groupe de SMESH
+            meshObject=monObjet._narrow(SMESH.SMESH_Mesh)
+       except :
+         logger.debug('  pb avec ( entry = %s ) ' %entry )          
+       return meshObject
+
+    #-------------------------------------
+
+    #-------------------------------------
+    def isShape( self,entry):
+    #-------------------------------------
+       result=False
+       import GEOM
+       try:
+         monObjet =self.getCORBAObjectInComponent(entry,"GEOM") 
+         if monObjet != None :                                    # selection d'un objet GEOM
+            if  monObjet._narrow(GEOM.GEOM_Object ):
+                result = True 
+       except :
+         logger.debug(' isShape pb avec ( entry = %s ) ' %entry )          
+       return result
+
+    #-----------------------------------------------------------------
+    def getMainShapeEntry(self,entry):
+    #-----------------------------------------------------------------
+        result=None
+        try:
+           mainShapeEntry = entry.split(':')[:4]
+           if len(mainShapeEntry) == 4:
+                strMainShapeEntry = '%s:%s:%s:%s'%tuple(mainShapeEntry)
+                if self.isMainShape(strMainShapeEntry):
+                    result = strMainShapeEntry
+        except:
+            logger.debug( 'Erreur pour SalomeStudy.getMainShapeEntry( entry = %s ) ' %entry )
+            result = None
+        return result
+
+    #-----------------------------------------------------------------
+    def isMainShape(self,entry):
+    #-----------------------------------------------------------------
+        result = False
+        try:
+            monObjet =self.getCORBAObjectInComponent(entry,"GEOM") 
+            import GEOM
+            shape    = monObjet._narrow( GEOM.GEOM_Object )
+            if shape.IsMainShape():
+                result = True
+        except:
+            logger.debug( 'Errreur pour SalomeStudy.isMainShape( entry = %s ) ' %entry )
+            result = False
+        return result
+
+    
+    #-----------------------------------------------------------------
+    def ChercheType( self, shape ):
+    #-----------------------------------------------------------------
+        tgeo =  shape.GetShapeType() 
+        geomEngine = salome.lcc.FindOrLoadComponent( "FactoryServer", "GEOM" )
+        #print dir(self.editor.study)
+        groupIMeasureOp = geomEngine.GetIMeasureOperations(self.editor.study._get_StudyId())
+        if tgeo != "COMPOUND" : return tgeo
+
+        strInfo =  groupIMeasureOp.WhatIs( shape )
+        dictInfo = {}
+        l = strInfo.split('\n')
+
+        for couple in l:
+             nom, valeur = couple.split(':')
+             dictInfo[ nom.strip() ] = valeur.strip()
+
+        ordre = [ "COMPSOLID", "SOLID", "SHELL", "FACE", "WIRE", "EDGE", "VERTEX" ]
+        for t in ordre:
+            if dictInfo[ t ] != '0':
+               tgeo = t
+               return tgeo
+        return None
+
+
+    #-----------------------------------------------------------------
+    def selectShape( self, editor, entry, kwType = None ):
+    #-----------------------------------------------------------------
+        """
+        selection sous-geometrie dans Salome:
+        -test1) si c'est un element sous-geometrique .
+        -test2) si appartient a la geometrie principale.
+        """
+        name, msgError = '',''
+        mySO = self.editor.study.FindObjectID(entry)
+        if mySO == None :
+           return name, msgError
+        object = mySO.GetObject()
+        if object == None :
+           return name, msgError
+
+        import GEOM
+        shape  = object._narrow( GEOM.GEOM_Object )
+        if not shape :
+           return name, msgError
+
+        tGeo=self.ChercheType(shape)
+        if not tGeo :
+           return name, msgError
+        #if kwType == "GROUP_NO" and str(tGeo) != "VERTEX":
+        #    name,msgError = '',"la selection n est pas un Vertex"
+        #    return name, msgError
+        if kwType == "GROUP_MA" and str(tGeo) == "VERTEX":
+            name, msgError = '', "la selection n est pas un groupe de maille"
+            return name, msgError
+
+        mainShapeEntry = self.getMainShapeEntry( entry )
+        if self.mainShapeNames.has_key( editor ):
+          #print "------------- self.mainShapeNames[editor]" , self.mainShapeNames[editor]
+          if self.mainShapeNames[editor] == mainShapeEntry:
+             name=mySO.GetName()
+          else :
+             msgError="Le groupe reference la geometrie " + mainShapeEntry + " et non " + self.mainShapeNames[editor]
+        else :
+          self.mainShapeNames[editor] = mainShapeEntry
+          name=mySO.GetName()
+       
+        return name, msgError
+        
+
+    #-----------------------------------------------------------------
+    def selectMeshGroup( self, editor, selectedEntry, kwType = None ):
+    #-----------------------------------------------------------------
+        """
+        selection groupe de maille dans Salome:
+        -test 1) si c'est un groupe de maille
+        -test 2) si le maillage fait reference a la geometrie principale
+        """
+        name, msgError = '',''
+
+        mySO=self.editor.study.FindObjectID(selectedEntry )
+        from salome.smesh.smeshstudytools import SMeshStudyTools
+        monSMeshStudyTools=SMeshStudyTools(self.editor)
+        meshSO = monSMeshStudyTools.getMeshFromGroup(mySO)
+        if meshSO == None : return name, msgError    
+
+       # on verifie que l entree selectionnee a le bon type (NODE ou EDGE...)
+        tGroup = ""
+        groupObject = self.getCORBAObjectInComponent(selectedEntry,"SMESH")
+        if not groupObject :
+           logger.debug("selectedMeshEntry: An error occurs")
+
+        import SMESH
+        aGroup = groupObject._narrow( SMESH.SMESH_GroupBase )
+        if aGroup: tGroup = aGroup.GetType()
+
+        if kwType == "GROUP_NO" and tGroup != SMESH.NODE:
+             msgError = self.tr("GROUP_NO attend un groupe de noeud")
+             return name, msgError
+        elif kwType == "GROUP_MA" and tGroup == SMESH.NODE:
+             msgError = self.tr("GROUP_MA attend un point goupe de maille")
+             return name, msgError
+
+        # on cherche la shape associee
+        #PN PN mesh_Object est un SOject
+        meshObject = meshSO.GetObject()
+        mesh     = meshObject._narrow( SMESH.SMESH_Mesh  )
+        if mesh:         #c'est bien un objet maillage
+             shape = mesh.GetShapeToMesh()
+             if shape:
+                ior = salome.orb.object_to_string( shape )
+                if ior:
+                   sObject   = self.editor.study.FindObjectIOR(  ior )
+                   mainShapeID = sObject.GetID()
+             else :
+                mainShapeID=0
+        else :
+             return name, self.tr("Type d objet non permis")
+
+        # on cherche si la shape associee est la bonne
+        #print "------------- mainShapeID" , mainShapeID
+        if self.mainShapeNames.has_key( editor ):
+          #print "------------- self.mainShapeNames[editor]" , self.mainShapeNames[editor]
+          if self.mainShapeNames[editor] == mainShapeID:
+             name=mySO.GetName()
+          else :
+             msgError=self.tr("Le groupe reference la geometrie ") + mainShapeID + self.tr(" et non ") + self.mainShapeNames[editor]
+        else :
+          self.mainShapeNames[editor] = mainShapeID
+          name=mySO.GetName()
+
+        #print "------------------------------ name :", name
+        #print "------------------------------ name :", name
+        #print "------------------------------ name :", name
+        return name,msgError
+
+
+    def displayMeshGroups(self, meshGroupName):
+        """
+        visualisation group de maille de nom meshGroupName dans salome
+        """
+        ok, msgError = False, ''
+        try:
+        #if 1 :
+            sg = salome.ImportComponentGUI('SMESH')
+            meshGroupEntries = []
+            selMeshEntry = None
+            selMeshGroupEntry = None
+            
+            # liste des groupes de maille de nom meshGroupName
+            listSO = self.editor.study.FindObjectByName(meshGroupName, "SMESH")
+            #print listSO
+            #print "liste des groupes de maille de nom %s: "%(meshGroupName), listSO
+            
+            if len(listSO)>1:
+               return 0,self.tr('Plusieurs objets  portent ce nom')
+            if len(listSO) ==0 :
+               return 0,self.tr('Aucun objet ne porte ce nom')
+            SObjet=listSO[0]
+            groupEntry = SObjet.GetID()                
+            myComponent = salome.lcc.FindOrLoadComponent("FactoryServer", "SMESH")
+            SCom        = self.editor.study.FindComponent("SMESH")
+            myBuilder   = self.editor.study.NewBuilder()
+            myBuilder.LoadWith( SCom , myComponent  )                             
+            sg.CreateAndDisplayActor(groupEntry)
+            #color = COLORS[ self.icolor % LEN_COLORS ]                
+            #self.icolor = self.icolor + 1
+            #sg.SetColor(groupEntry, color[0], color[1], color[2])
+            salome.sg.Display(groupEntry)
+            salome.sg.FitAll()                
+            ok = True                
+
+        except:
+        #else :
+            msgError = self.tr("Impossible d afficher ")+shapeName
+            logger.debug(50*'=')
+        return ok, msgError
+
+# ___________________________ Methodes appelees par EFICAS  __________________________________
+    #----------------------------------------------------------------
+    def selectGroupFromSalome( self, kwType = None, editor=None):
+    #----------------------------------------------------------------
+        """
+        Selection d'element(s) d'une geometrie ( sub-shape ) ou d'element(s) de maillage ( groupe de maille)  partir de l'arbre salome
+        retourne ( la liste des noms des groupes, message d'erreur )
+      
+        Note: Appele par EFICAS lorsqu'on clique sur le bouton ajouter la liste du panel GROUPMA        
+        """
+        names, msg = [], ''
+        try:            
+            atLeastOneStudy = self.editor.study
+            if not atLeastOneStudy:
+                return names, msg
+
+           # recupere toutes les selections de l'utilsateur dans l'arbre Salome
+            entries = salome.sg.getAllSelected()
+            nbEntries = len( entries )
+            if nbEntries >= 1:
+                for entry in entries:
+                    if self.isMeshGroup(entry):               # selection d 'un sous maillage
+                       name, msg = self.selectMeshGroup( editor, entry, kwType )
+                    elif self.isShape(entry):               # selection d'une sous-geometrie
+                       name, msg = self.selectShape( editor, entry, kwType )
+                    else:
+                       name, msg = None,self.tr("Selection SALOME non autorisee.")
+                    if name:
+                       names.append( name )                    
+                        
+        except:            
+            logger.debug("selectGroupFromSalome: An error occurs")
+        #print "=================== selectGroupFromSalome ", names, msg
+        #print "=================== selectGroupFromSalome ", names, msg
+        #print "=================== selectGroupFromSalome ", names, msg
+        return names, msg                
+
+    #----------------------------------------------------------------
+    def selectMeshFile( self,  editor=None):
+    #----------------------------------------------------------------
+        """
+        """
+        try :            
+            atLeastOneStudy = self.editor.study
+            if not atLeastOneStudy: return "", 'Pas d etude'
+
+           # recupere toutes les selections de l'utilsateur dans l'arbre Salome
+            entries = salome.sg.getAllSelected()
+            nbEntries = len( entries )
+            if nbEntries != 1 : return "", 'select a Mesh'
+            entry = entries[0]
+            if not self.isMesh(entry): return "", 'select a Mesh'
+            mySO=self.editor.study.FindObjectID(entry)
+            print mySO
+            ok, anAttr = mySO.FindAttribute("AttributeName")
+            if not ok :  return "" ,'Pb de nommage'
+            meshFile="/tmp/"+str(anAttr.Value())+'.med'
+            myMesh=self.getMesh(entry) 
+            if myMesh==None : return "" ,'Pb dans la selection '
+            myMesh.ExportMED( meshFile, 0)
+            return meshFile ,""
+        except :
+           return "", "Pb dans la selection "
+
+    #----------------------------------------------------------------
+    def importMedFile( self,fileName,  editor=None):
+    #----------------------------------------------------------------
+        try :            
+            theStudy = self.editor.study
+            if not theStudy: return (0, 'Pas d etude')
+            from salome.smesh import smeshBuilder
+            smesh = smeshBuilder.New(theStudy)
+            aMesh,aResult = smesh.CreateMeshesFromMED(fileName)
+            salome.sg.updateObjBrowser(1)
+            return 1,"" 
+        except :
+            return (O,"Pb a l import")
+                     
+    #----------------------------------------------------------------
+    def selectEntryFromSalome( self, kwType = None, editor=None):
+    #----------------------------------------------------------------
+        """
+        Selection d'element a partir de l'arbre salome
+        Ne verifie que l unicite de la selection
+        retourne ( la liste avec le  nom du groupe, message d'erreur )
+      
+        retourne une liste pour etre coherent avec selectGroupFromSalome
+        Note: Appele par EFICAS lorsqu'on clique sur le bouton ajouter la liste du panel SalomeEntry        
+        """
+        try:            
+            if self.editor.study._non_existent():
+               raise Exception(self.tr(u"L'étude Salome n'existe plus"))
+            entries = salome.sg.getAllSelected()
+            nbEntries = len( entries )
+            if nbEntries < 1:
+               raise Exception(self.tr(u"Veuillez sélectionner une entrée de l'arbre d'étude de Salome"))
+            elif nbEntries > 1 :
+               raise Exception(self.tr(u"Une seule entrée doit être sélectionnée dans l'arbre d'étude de Salome"))
+
+            value = kwType.get_selected_value(entries[0], self.editor)
+            msg = self.tr(u"L'entrée de l'arbre d'étude de Salome a été sélectionnée")
+            return [value], msg
+        except Exception, e:
+            QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), unicode(e))
+            return [], unicode(e)
+
+        
+    #---------------------------------------------
+    def addJdcInSalome(  self, jdcPath ):
+    #---------------------------------------------
+        """
+        Ajoute le Jeu De Commande dans l'arbre d'etude Salome dans la rubrique EFICAS
+        Revu pour QT4
+        """
+        msgError    = "Erreur dans l'export du fichier de commande dans l'arbre d'etude Salome"
+        ok = False
+        try:            
+            atLeastOneStudy = self.editor.study
+            if not atLeastOneStudy:
+                return ok, msgError
+                        
+            fileType = { 'ASTER'    : "FICHIER_EFICAS_ASTER",
+                         'SEP'      : "FICHIER_EFICAS_SEP",
+                         'MAP'      : "FICHIER_EFICAS_MAP",
+                         'OPENTURNS': "FICHIER_EFICAS_OPENTURNS",
+                         'OPENTURNS_STUDY': "FICHIER_EFICAS_OPENTURNS_STUDY",
+                         'OPENTURNS_WRAPPER': "FICHIER_EFICAS_OPENTURNS_WRAPPER",
+                         'CARMEL3D': "FICHIER_EFICAS_CARMEL3D",
+                         'CARMELCND': "FICHIER_EFICAS_CARMELCND",
+                        }
+                        
+            folderName = {  'ASTER'    :  'AsterFiles',
+                            'SEP'       : 'OMFiles' ,
+                            'CARMEL3D'  : 'CARMEL3DFiles' ,
+                            'CARMELCND'  : 'CARMELCNDFiles' ,
+                            'MAP'       : 'MapFiles' ,
+                            'OPENTURNS_STUDY': 'OpenturnsFiles',                                    
+                            'OPENTURNS_WRAPPER': 'OpenturnsFiles'}                                    
+
+            folderType = { 'ASTER':    "ASTER_FILE_FOLDER",
+                           'SEP':      "SEP_FILE_FOLDER",
+                           'MAP':      "MAP_FILE_FOLDER",
+                           'CARMEL3D': "CARMEL3D_FILE_FOLDER",
+                           'CARMELCND': "CARMELCND_FILE_FOLDER",
+                           'OPENTURNS_STUDY':"OPENTURNS_FILE_FOLDER",
+                           'OPENTURNS_WRAPPER': "OPENTURNS_FILE_FOLDER"}
+
+                        
+            moduleEntry = self.editor.findOrCreateComponent(self.module, self.componentName)
+            itemName    = re.split("/",jdcPath)[-1]
+            
+            if folderName.has_key(self.code) :
+               monFolderName=folderName[ self.code ]
+            else :
+               monFolderName=str(self.code)+"Files"
+
+            if folderType.has_key(self.code) :
+               monFolderType=fileType[ self.code ]
+            else :
+               monFolderType=str(self.code)+"_FILE_FOLDER"
+
+            if fileType.has_key(self.code) :
+               monFileType=fileType[ self.code ]
+            else :
+               monFileType="FICHIER_EFICAS_"+str(self.code)
+
+            fatherEntry = self.editor.findOrCreateItem(
+                                    moduleEntry,
+                                    name = monFolderName,
+                                    #icon = "ICON_COMM_FOLDER",
+                                    fileType = monFolderType)
+                                                                        
+            commEntry = self.editor.findOrCreateItem( fatherEntry ,
+                                           name = itemName,
+                                           fileType = monFileType,
+                                           fileName = jdcPath,
+                                           #icon    = "ICON_COMM_FILE",
+                                           comment = str( jdcPath ))
+
+            salome.sg.updateObjBrowser(1)
+
+            #print 'addJdcInSalome commEntry->', commEntry            
+            if commEntry:
+                ok, msgError = True, ''        
+        except Exception, exc:
+            msgError = "Can't add Eficas file to Salome study tree"
+            logger.debug(msgError, exc_info = True)
+            QMessageBox.warning(self, self.tr("Warning"),
+                                self.tr("%s. Raison:\n%s\n\n Voir la log pour plus de détails " % (msgError, exc)))
+        return ok, msgError        
+        
+           
+    #---------------------------------------
+    def displayShape(  self, shapeName ):
+    #---------------------------------------
+        """
+        visualisation de nom shapeName dans salome
+        """
+        ok, msgError = False, ''
+        try:
+        #if 1 :
+            import SalomePyQt
+            sgPyQt = SalomePyQt.SalomePyQt()
+            myActiveView=sgPyQt.getActiveView() 
+            if myActiveView < 0 :
+               return ok, 'pas de vue courante'
+                                     
+            currentViewType=sgPyQt.getViewType(myActiveView)
+            if str(currentViewType) != "OCCViewer" : # maillage
+                ok, msgError = self.displayMeshGroups(shapeName)
+            else: #geometrie
+                current_color = COLORS[ self.icolor % LEN_COLORS ]                
+                from salome.geom.geomtools import GeomStudyTools
+                myGeomTools=GeomStudyTools(self.editor)
+                ok = myGeomTools.displayShapeByName( shapeName, current_color )
+                salome.sg.FitAll()
+                self.icolor = self.icolor + 1             
+                if not ok:
+                    msgError =self.tr("Impossible d afficher ")+shapeName
+        except:            
+        #else :
+            logger.debug(50*'=')
+        return ok, msgError    
+                
+    #---------------------------------------
+    def ChercheGrpMeshInSalome(self):
+    #---------------------------------------
+        print "je passe par la"
+        import SMESH
+        names, msg = [], ''
+        try :
+        #if 1 :
+           entries = salome.sg.getAllSelected()
+           nbEntries = len( entries )
+           names, msg = None, self.tr("Selection SALOME non autorisee.")
+           if nbEntries == 1:
+                for entry in entries:
+                    names,msg=self.giveMeshGroups(entry,"SubMeshes",SMESH.SMESH_subMesh)
+        except :
+        #else :
+           print "bim bam boum"
+        return(msg,names)
+
+    #---------------------------------------
+    def ChercheGrpMailleInSalome(self):
+    #---------------------------------------
+        import SMESH
+        names, msg = [], ''
+        try :
+        #if 1:
+           entries = salome.sg.getAllSelected()
+           nbEntries = len( entries )
+           names, msg = None, self.tr("Selection SALOME non autorisee.")
+           if nbEntries == 1:
+                for entry in entries:
+                    print entry
+                    names,msg=self.giveMeshGroups(entry,"Groups of",SMESH.SMESH_GroupBase)
+                    print names
+        except :
+        #else:
+           print "bim bam boum"
+        return(msg,names)
+
+
+        
+        
+        
+#-------------------------------------------------------------------------------------------------------
+#    Pilotage de la Visu des elements de structures
+#
+
+
+    def envoievisu(self,liste_commandes):
+        try:
+            from salome.geom.structelem import StructuralElementManager, InvalidParameterError
+        except ImportError:
+            QMessageBox.critical(self, self.tr("Error"),
+                                 self.tr("Impossible d'afficher les elements de structure: "
+                                         "module GEOM n est pas  installe."))
+            return
+        try:
+            atLeastOneStudy = self.editor.study
+            if not atLeastOneStudy:
+                return
+            logger.debug(10*'#'+":envoievisu: creating a StructuralElementManager instance")
+            structElemManager = StructuralElementManager()
+            elem = structElemManager.createElement(liste_commandes)
+            elem.display()
+            salome.sg.updateObjBrowser(True)
+        except InvalidParameterError, err:
+            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,
+                                "minval": err.minValue, "value": err.value}
+            QMessageBox.warning(self, self.tr("Error"), msg)
+        except:
+            traceback.print_exc()
+            logger.debug(10*'#'+":pb dans envoievisu")
+
+
+class SalomeEntry:
+  """
+  This class replaces the class Accas.SalomeEntry (defined in EFICAS tool)
+  when Eficas is launched in Salome context. It handles the objects that can
+  be selected from Salome object browser.
+  By default, the selected value is the entry of the selected item in the
+  object browser. This class can be subclassed to provide more advanced
+  functions.
+  """
+  
+  help_message = u"Une entrée de l'arbre d'étude de Salome est attendue"
+  
+  def __init__(self, entryStr):
+    self._entry = entryStr
+  
+  @staticmethod
+  def __convert__(entryStr):
+    return SalomeEntry(entryStr)
+  
+  @staticmethod
+  def get_selected_value(selected_entry, study_editor):
+    return selected_entry
+
+        
+#-------------------------------------------------------------------------------------------------------        
+#           Point d'entree lancement EFICAS
+#
+def runEficas( code=None, fichier=None, module = "EFICAS", version=None, componentName = "Eficas",multi=False):
+    logger.debug(10*'#'+":runEficas: START")
+    #global appli    
+    logger.debug(10*'#'+":runEficas: code="+str(code))
+    logger.debug(10*'#'+":runEficas: fichier="+str(fichier))
+    logger.debug(10*'#'+":runEficas: module="+str(module))
+    logger.debug(10*'#'+":runEficas: version="+str(version))
+
+    #if not appli: #une seul instance possible!        
+    appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier,
+                       module = module, version = version, componentName = componentName,multi=multi )
+    #if not appli: #une seul instance possible!        
+    #    appli = MyEficas( SalomePyQt.SalomePyQt().getDesktop(), code = code, fichier = fichier,
+    #                      module = module, componentName = componentName, version=version )
+    logger.debug(10*'#'+":runEficas: END")
+
+