1 # -*- coding: utf-8 -*-
10 # Variable globale pour stocker le Workspace de Salome
16 # -----------------------------------------------------------------------------
21 print "lastWindowClosed()"
26 qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g)
28 # -----------------------------------------------------------------------------
33 sgPyQt=SalomePyQt.SalomePyQt()
38 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
42 # -----------------------------------------------------------------------------
43 #Cette méthode est obsolète en V3
44 #En V2, si on n'implémente pas cette méthode, le composant fonctionne
45 #correctement. Un message "Attribute Error" apparait dans la trace.
46 def setWorkSpace(workSpace):
50 desktop=sgPyQt.getDesktop()
52 # recuperation du workspace
53 ws=sgPyQt.getMainFrame()
56 # -----------------------------------------------------------------------------
58 def OnGUIEvent(commandID) :
59 print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID
60 if dict_command.has_key(commandID):
61 print "OnGUIEvent :::::::::: commande associée : ",commandID
62 dict_command[commandID]()
64 print "Pas de commande associée a : ",commandID
66 # -----------------------------------------------------------------------------
70 Cette méthode permet les initialisations. On définit en particulier
71 l'identifiant de l'étude courante.
74 desktop=sgPyQt.getDesktop()
76 currentStudyId = sgPyQt.getStudyId()
77 #print "setSettings: currentStudyId = " + str(currentStudyId)
78 # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
81 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
85 Cette méthode permet l'activation du module, s'il a été chargé mais pas encore
86 activé dans une étude précédente.
90 print "--------EFICASGUI:: activate"
94 # -----------------------------------------------------------------------------
96 def activeStudyChanged(ID):
98 desktop=sgPyQt.getDesktop()
100 # ne marche pas car sg est supposé résider dans une etude
101 # studyId=sg.getActiveStudyId()
104 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
107 def definePopup(theContext, theObject, theParent):
110 theParent = "ObjectBrowser"
111 a=salome.sg.getAllSelected()
115 aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
117 if aType == studyManager.FICHIER_EFICAS_ASTER or aType == studyManager.FICHIER_EFICAS_HOMARD \
118 or aType == studyManager.FICHIER_EFICAS_HOMARD:
121 return (theContext, theObject, theParent)
124 def customPopup(popup, theContext, theObject, theParent):
125 print "EFICASGUI --- customPopup"
126 popup.removeItem(99000)
127 popup.removeItem(99001)
128 popup.removeItem(99002)
129 popup.removeItem(99003)
134 This method is called when GUI module is being created
136 Should return a map of the SALOME dockable windows id's
137 needed to be opened when module is activated.
139 print "ASTERGUI::windows"
142 winMap[ SalomePyQt.WT_ObjectBrowser ] = Qt.DockLeft
143 winMap[ SalomePyQt.WT_PyConsole ] = Qt.DockBottom
146 # -----------------------------------------------------------------------------
151 print "-------------------------EFICASGUI::runEficas-------------------------"
153 eficasSalome.runEficas( "ASTER" )
156 def runEficaspourHomard():
158 desktop=sgPyQt.getDesktop()
159 eficasSalome.runEficas( "HOMARD" )
161 def runEficaspourOpenturns():
162 print "runEficas Pour Openturns"
163 desktop=sgPyQt.getDesktop()
164 eficasSalome.runEficas( "OPENTURNS" )
168 def runEficasFichier(version=None):
170 Lancement d'eficas pour ASTER
171 si un fichier est sélectionné, il est ouvert dans eficas
175 a=salome.sg.getAllSelected()
179 aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
180 if aType == studyManager.FICHIER_EFICAS_ASTER:
183 elif aType == studyManager.FICHIER_EFICAS_HOMARD:
186 elif aType == studyManager.FICHIER_EFICAS_OPENTURNS:
196 #eficasSalome.runEficas(code,attr,studyId=currentStudyId)
197 #desktop=sgPyQt.getDesktop()
199 eficasSalome.runEficas( code, fileName, version=version)
201 eficasSalome.runEficas( code, fileName)
204 def runEficasFichierV8():
205 runEficasFichier(version="v8.5")
207 def runEficasFichierV9():
208 runEficasFichier(version="v9.1")
213 941:runEficasFichier,# runEficas,
214 946:runEficaspourHomard,
215 946:runEficaspourOpenturns,
216 4041:runEficasFichier, #runEficas,
217 4046:runEficaspourHomard,
218 4047:runEficaspourOpenturns,
219 9042:runEficasFichier,
220 9043:runEficasFichier,
221 9044:runEficasFichierV9,