Salome HOME
utilisation studyManager
authorsalome <>
Tue, 6 Dec 2005 12:09:06 +0000 (12:09 +0000)
committersalome <>
Tue, 6 Dec 2005 12:09:06 +0000 (12:09 +0000)
src/EFICASGUI/EFICASGUI.py
src/EFICASGUI/eficasSalome.py

index df16a59b073bbe104a84b1d3a46d6fe761947d41..cf88dce8640c3d0170cd0ce55e4a5e1698ff2f15 100644 (file)
@@ -31,8 +31,10 @@ import salome
 
 sg=salome.sg
 sgPyQt=SalomePyQt.SalomePyQt()
-import salomedsgui
-aGuiDS=salomedsgui.guiDS()
+
+
+import studyManager
+
 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
 
 
@@ -82,7 +84,7 @@ def setSettings():
    # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
    # dans salomedsgui?
    
-   palStudyManager.setCurrentStudyID( currentStudyId ) #CS_pbruno   
+   studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno   
 
 def activate():
    """
@@ -107,7 +109,7 @@ def activeStudyChanged(ID):
    print "_CS_GBO_ : EFICASGUI.activeStudyChanged : currentStudyId = ", currentStudyId
    print "_CS_GBO_ : EFICASGUI.activeStudyChanged : sgPyQt.getStudyId() = ", sgPyQt.getStudyId()
    
-   palStudyManager.setCurrentStudyID( currentStudyId ) #CS_pbruno
+   studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
    
 
 def definePopup(theContext, theObject, theParent):
@@ -138,14 +140,14 @@ def runEficas():
    #eficasSalome.runEficas("ASTER",studyId=currentStudyId)   
    #ws = sgPyQt.getMainFrame()   
    desktop=sgPyQt.getDesktop()   
-   eficasSalome.runEficas( desktop, palStudyManager, "ASTER" )
+   eficasSalome.runEficas( desktop, studyManager.palStudy, "ASTER" )
    
 
 def runEficaspourHomard():
    print "runEficas"
    #eficasSalome.runEficas("HOMARD")
    desktop=sgPyQt.getDesktop()
-   eficasSalome.runEficas( desktop, palStudyManager, "HOMARD" ) 
+   eficasSalome.runEficas( desktop, studyManager.palStudy, "HOMARD" ) 
    
    
     
@@ -153,32 +155,36 @@ def runEficasHomard():
    print "runEficas"
    #eficasSalome.runEficas("HOMARD")
    desktop=sgPyQt.getDesktop()
-   eficasSalome.runEficas( desktop, palStudyManager, "HOMARD" )
+   eficasSalome.runEficas( desktop, studyManager.palStudy, "HOMARD" )
    
    
 
 def runEficasFichier():
    """
    Lancement d'eficas à partir d'un fichier sélectionné dans l'arbre
-   d'étude. 
+   d'étude par clique droit de la souris
    """
    print "runEficasFichier"
-   attr=None
-   code=None
+   fileName = None
+   code     = None
    a=salome.sg.getAllSelected()
    if len(a) == 1:
-      aGuiDS.setCurrentStudy(currentStudyId)
-      boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0])
-      if boo :
-         code = "ASTER" 
-      else :
-         boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_HOMARD",a[0])         
-         if boo:
-           code = "HOMARD"
+      #studyManager.palStudy.setCurrentStudyID( currentStudyId )
+      #boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0])
+      selectedEntry = a[0]
+      
+      aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
+      if aType == studyManager.FICHIER_EFICAS_ASTER:
+        fileName = aValue
+        code     = "ASTER"
+      elif aType == studyManager.FICHIER_EFICAS_HOMARD:
+        fileName = aValue
+        code     = "HOMARD"        
    if code:
         #eficasSalome.runEficas(code,attr,studyId=currentStudyId)         
-        desktop=sgPyQt.getDesktop()   
-        eficasSalome.runEficas( desktop, palStudyManager, code, attr )
+        desktop=sgPyQt.getDesktop()
+        eficasSalome.runEficas( desktop, studyManager.palStudy, code, fileName )
+        
    
 
 # Partie applicative
@@ -191,7 +197,6 @@ dict_command={
                 9042:runEficasFichier,
              }
              
-#CS_pbruno temporaire
-import studyManager #from PAL
-#palStudyManager = studyManager.SalomeStudy()
-palStudyManager = studyManager.study
\ No newline at end of file
+
+
+
index 9a7e19ffa0d4f30b334290a8a5ae631417a42301..742817e3a5c771177fb8f689422384ef9466db1e 100644 (file)
@@ -155,12 +155,12 @@ class MyEficas( Tkinter.Toplevel, eficas.EFICAS ):
             if not self.mainShapeEntries.has_key( jdcID ):
                 self.mainShapeEntries[ jdcID ] = selectedMainShapeEntry
             if selectedMainShapeEntry == self.mainShapeEntries[ jdcID ]:
-                name = self.palStudyManager.getNameAttribute( selectedEntry )
+                name = self.palStudyManager.getName( selectedEntry )
                 self.subShapes[ selectedEntry ] = name
             else:
                 print 'CS_pbruno pas la même mainshape selectedEntry->',selectedEntry
                 if not self.mainShapeNames.has_key( jdcID ):
-                    self.mainShapeNames[ jdcID ] = self.palStudyManager.getNameAttribute( self.mainShapeEntries[ jdcID ] )
+                    self.mainShapeNames[ jdcID ] = self.palStudyManager.getName( self.mainShapeEntries[ jdcID ] )
                 msgError = msgSubShapeBadMainShape + self.mainShapeNames[ jdcID ]
 
         return name, msgError 
@@ -187,11 +187,11 @@ class MyEficas( Tkinter.Toplevel, eficas.EFICAS ):
                 if not self.mainShapeEntries.has_key( jdcID ):
                     self.mainShapeEntries[ jdcID ] = selectedMainShapeEntry
                 if selectedMainShapeEntry == self.mainShapeEntries[ jdcID ]:
-                    name = self.palStudyManager.getNameAttribute( selectedEntry  )  #ok test 2)
+                    name = self.palStudyManager.getName( selectedEntry  )  #ok test 2)
                 else:
                     print 'CS_pbruno pas la même mainshape selectedEntry ->',selectedEntry
                     if not self.mainShapeNames.has_key( jdcID ):
-                        self.mainShapeNames[ jdcID ] = self.palStudyManager.getNameAttribute( self.mainShapeEntries[ jdcID ] )
+                        self.mainShapeNames[ jdcID ] = self.palStudyManager.getName( self.mainShapeEntries[ jdcID ] )
                     msgError = msgMeshGroupBadMainShape + self.mainShapeNames[ jdcID ]                   
                                 
         return name, msgError 
@@ -391,20 +391,20 @@ class MyEficas( Tkinter.Toplevel, eficas.EFICAS ):
         
         
 #def runEficas( palStudyManager, code="ASTER", fichier=None, studyId=None):
-def runEficas( parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.study, code="ASTER", fichier=None ):
+def runEficas( parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.palStudy, code="ASTER", fichier=None ):
     global appli    
     if not appli: #une seul instance possible!                        
         appli = MyEficas( parent, palStudyManager, code = code, fichier = fichier )
         
     
-def runHomard( parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.study, code="HOMARD", fichier=None ):    
+def runHomard( parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.palStudy, code="HOMARD", fichier=None ):    
     global appli    
     if not appli: #une seul instance possible!                        
         appli = MyEficas( parent, palStudyManager, code = code, fichier = fichier )
 
         
 """        
-def runAster(parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.study, code="ASTER", fichier=None ) :
+def runAster(parent = SalomePyQt.SalomePyQt().getDesktop(), palStudyManager = studyManager.palStudy, code="ASTER", fichier=None ) :
     global appli    
     if not appli: #une seul instance possible!                        
         appli = MyEficas( parent, palStudyManager, code = code, fichier = fichier )