+# -*- coding: utf-8 -*-
+
"""
Interface PyQt
"""
sg=salome.sg
sgPyQt=SalomePyQt.SalomePyQt()
-import salomedsgui
-aGuiDS=salomedsgui.guiDS()
+
+
+import studyManager
+
print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
-# -----------------------------------------------------------------------------
+
+# -----------------------------------------------------------------------------
+#Cette méthode est obsolète en V3
+#En V2, si on n'implémente pas cette méthode, le composant fonctionne
+#correctement. Un message "Attribute Error" apparait dans la trace.
def setWorkSpace(workSpace):
- print "EficasGUI --- setWorkSpace"
+ #print "EficasGUI --- setWorkSpace"
global WORKSPACE
- print workSpace
+ #print workSpace
WORKSPACE=workSpace
- print "WORKSPACE: ",WORKSPACE
+ #print "WORKSPACE: ",WORKSPACE
# le desktop
desktop=sgPyQt.getDesktop()
# recuperation du workspace
ws=sgPyQt.getMainFrame()
- print ws
+ #print ws
# -----------------------------------------------------------------------------
def OnGUIEvent(commandID) :
- print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID,WORKSPACE = ",commandID,WORKSPACE
+ print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID
if dict_command.has_key(commandID):
print "OnGUIEvent :::::::::: commande associée : ",commandID
- dict_command[commandID](WORKSPACE)
+ dict_command[commandID]()
else:
print "Pas de commande associée a : ",commandID
desktop=sgPyQt.getDesktop()
global currentStudyId
currentStudyId = sgPyQt.getStudyId()
- print "setSettings: currentStudyId = " + str(currentStudyId)
+ #print "setSettings: currentStudyId = " + str(currentStudyId)
# _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
# dans salomedsgui?
+
+ studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
+
+def activate():
+ """
+ Cette méthode permet l'activation du module, s'il a été chargé mais pas encore
+ activé dans une étude précédente.
+
+ Portage V3.
+ """
+ print "--------EFICASGUI:: activate"
+ setSettings()
# -----------------------------------------------------------------------------
# ne marche pas car sg est supposé résider dans une etude
# studyId=sg.getActiveStudyId()
currentStudyId=ID
- print "_CS_GBO_ : EFICASGUI.activeStudyChanged : currentStudyId = ", currentStudyId
- print "_CS_GBO_ : EFICASGUI.activeStudyChanged : sgPyQt.getStudyId() = ", sgPyQt.getStudyId()
+
+ studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
+
-def definePopup(theContext, theObject, theParent):
- print "EFICASGUI --- definePopup"
- theContext = ""
+def definePopup(theContext, theObject, theParent):
+ theContext= ""
+ theObject = "100"
theParent = "ObjectBrowser"
a=salome.sg.getAllSelected()
- if len(a) >0:
- theObject="73"
+ #print a
+
+ selectedEntry = a[0]
+ aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
+
+ if aType == studyManager.FICHIER_EFICAS_ASTER or aType == studyManager.FICHIER_EFICAS_HOMARD \
+ or aType == studyManager.FICHIER_EFICAS_HOMARD:
+ theObject="73"
+
return (theContext, theObject, theParent)
popup.removeItem(99003)
+def windows():
+ """
+ This method is called when GUI module is being created
+ and initialized.
+ Should return a map of the SALOME dockable windows id's
+ needed to be opened when module is activated.
+ """
+ print "ASTERGUI::windows"
+ from qt import Qt
+ winMap = {}
+ winMap[ SalomePyQt.WT_ObjectBrowser ] = Qt.DockLeft
+ winMap[ SalomePyQt.WT_PyConsole ] = Qt.DockBottom
+ return winMap
+
# -----------------------------------------------------------------------------
import eficasSalome
-def runEficas(ws):
- print "--------------------------------------------------"
- print currentStudyId
- eficasSalome.runEficas(ws,"ASTER",studyId=currentStudyId)
+def runEficas():
+ print "-------------------------EFICASGUI::runEficas-------------------------"
+ print currentStudyId
+ #eficasSalome.runEficas("ASTER",studyId=currentStudyId)
+ #ws = sgPyQt.getMainFrame()
+ #desktop=sgPyQt.getDesktop()
+ eficasSalome.runEficas( "ASTER" )
-def runEELIH(ws,code="ASTER"):
- # Enregistrement dans l étude
- import eficasEtude
- import appli
- print "++++++++++++++++++++++++++++++++++++++++++++++++++++"
- print currentStudyId
+
+def runEficaspourHomard():
+ print "runEficas"
+ #eficasSalome.runEficas("HOMARD")
+ desktop=sgPyQt.getDesktop()
+ eficasSalome.runEficas( "HOMARD" )
+
+def runEficaspourOpenturns():
+ print "runEficas Pour Openturns"
+ desktop=sgPyQt.getDesktop()
+ eficasSalome.runEficas( "OPENTURNS" )
- MaRef=eficasEtude.Eficas_In_Study(code,studyId=currentStudyId)
- # flag = E pour Eficas (enregistrement manuel du fichier de commandes)
- flag = 'E'
- moi=appli.Appli(MaRef, flag)
-def runEficaspourHomard(ws):
- print "runEficas"
- eficasSalome.runEficas(ws,"HOMARD")
-
-def runEficasHomard(ws):
- print "runEficas"
- eficasSalome.runEficas(None,"HOMARD")
-def runEficasFichier(ws):
+def runEficasFichier(version=None):
"""
- Lancement d'eficas à partir d'un fichier sélectionné dans l'arbre
- d'étude.
+ Lancement d'eficas pour ASTER
+ si un fichier est sélectionné, il est ouvert dans eficas
"""
- print "runEficasFichier"
- attr=None
- code="ASTER"
+ 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])
- 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"
+ elif aType == studyManager.FICHIER_EFICAS_OPENTURNS:
+ fileName = aValue
+ code = "OPENTURNS"
+ else:
+ fileName=None
+ code = "ASTER"
+ else:
+ code = "ASTER"
+
+ if code:
+ #eficasSalome.runEficas(code,attr,studyId=currentStudyId)
+ #desktop=sgPyQt.getDesktop()
+ if version :
+ eficasSalome.runEficas( code, fileName, version=version)
+ else :
+ eficasSalome.runEficas( code, fileName)
+
+
+def runEficasFichierV8():
+ runEficasFichier(version="v8.5")
- eficasSalome.runEficas(ws,code,attr,studyId=currentStudyId)
+def runEficasFichierV9():
+ runEficasFichier(version="v9.1")
# Partie applicative
dict_command={
- 941:runEficas,
- 943:runEELIH,
- 946:runEficaspourHomard,
- 4041:runEficas,
- 4043:runEELIH,
- 4046:runEficaspourHomard,
- 9042:runEficasFichier,
+ 941:runEficasFichier,# runEficas,
+ 946:runEficaspourHomard,
+ 946:runEficaspourOpenturns,
+ 4041:runEficasFichier, #runEficas,
+ 4046:runEficaspourHomard,
+ 4047:runEficaspourOpenturns,
+ 9042:runEficasFichier,
+ 9043:runEficasFichierV8,
+ 9044:runEficasFichierV9,
}
+
+
+