1 # -*- coding: utf-8 -*-
10 # Variable globale pour stocker le Workspace de Salome
16 # -----------------------------------------------------------------------------
23 print "lastWindowClosed()"
28 qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g)
30 # -----------------------------------------------------------------------------
35 sgPyQt=SalomePyQt.SalomePyQt()
40 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
44 # -----------------------------------------------------------------------------
45 #Cette méthode est obsolète en V3
46 #En V2, si on n'implémente pas cette méthode, le composant fonctionne
47 #correctement. Un message "Attribute Error" apparait dans la trace.
48 def setWorkSpace(workSpace):
49 #print "EficasGUI --- setWorkSpace"
53 #print "WORKSPACE: ",WORKSPACE
55 desktop=sgPyQt.getDesktop()
57 # creation d'une message box
58 #qt.QMessageBox.information(d,"titre","message")
60 # recuperation du workspace
61 ws=sgPyQt.getMainFrame()
64 # -----------------------------------------------------------------------------
66 def OnGUIEvent(commandID) :
67 print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID
68 if dict_command.has_key(commandID):
69 print "OnGUIEvent :::::::::: commande associée : ",commandID
70 dict_command[commandID]()
72 print "Pas de commande associée a : ",commandID
74 # -----------------------------------------------------------------------------
78 Cette méthode permet les initialisations. On définit en particulier
79 l'identifiant de l'étude courante.
82 desktop=sgPyQt.getDesktop()
84 currentStudyId = sgPyQt.getStudyId()
85 #print "setSettings: currentStudyId = " + str(currentStudyId)
86 # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
89 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
93 Cette méthode permet l'activation du module, s'il a été chargé mais pas encore
94 activé dans une étude précédente.
98 print "--------EFICASGUI:: activate"
102 # -----------------------------------------------------------------------------
104 def activeStudyChanged(ID):
106 desktop=sgPyQt.getDesktop()
107 global currentStudyId
108 # ne marche pas car sg est supposé résider dans une etude
109 # studyId=sg.getActiveStudyId()
112 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
115 def definePopup(theContext, theObject, theParent):
118 theParent = "ObjectBrowser"
119 a=salome.sg.getAllSelected()
123 aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
125 if aType == studyManager.FICHIER_EFICAS_ASTER or aType == studyManager.FICHIER_EFICAS_HOMARD \
126 or aType == studyManager.FICHIER_EFICAS_HOMARD:
129 return (theContext, theObject, theParent)
132 def customPopup(popup, theContext, theObject, theParent):
133 print "EFICASGUI --- customPopup"
134 popup.removeItem(99000)
135 popup.removeItem(99001)
136 popup.removeItem(99002)
137 popup.removeItem(99003)
142 This method is called when GUI module is being created
144 Should return a map of the SALOME dockable windows id's
145 needed to be opened when module is activated.
147 print "ASTERGUI::windows"
150 winMap[ SalomePyQt.WT_ObjectBrowser ] = Qt.DockLeft
151 winMap[ SalomePyQt.WT_PyConsole ] = Qt.DockBottom
154 # -----------------------------------------------------------------------------
159 print "-------------------------EFICASGUI::runEficas-------------------------"
161 #eficasSalome.runEficas("ASTER",studyId=currentStudyId)
162 #ws = sgPyQt.getMainFrame()
163 #desktop=sgPyQt.getDesktop()
164 eficasSalome.runEficas( "ASTER" )
167 def runEficaspourHomard():
169 #eficasSalome.runEficas("HOMARD")
170 desktop=sgPyQt.getDesktop()
171 eficasSalome.runEficas( "HOMARD" )
173 def runEficaspourOpenturns():
174 print "runEficas Pour Openturns"
175 desktop=sgPyQt.getDesktop()
176 eficasSalome.runEficas( "OPENTURNS" )
180 def runEficasFichier(version=None):
182 Lancement d'eficas pour ASTER
183 si un fichier est sélectionné, il est ouvert dans eficas
187 a=salome.sg.getAllSelected()
189 #studyManager.palStudy.setCurrentStudyID( currentStudyId )
190 #boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0])
193 aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
194 if aType == studyManager.FICHIER_EFICAS_ASTER:
197 elif aType == studyManager.FICHIER_EFICAS_HOMARD:
200 elif aType == studyManager.FICHIER_EFICAS_OPENTURNS:
210 #eficasSalome.runEficas(code,attr,studyId=currentStudyId)
211 #desktop=sgPyQt.getDesktop()
213 eficasSalome.runEficas( code, fileName, version=version)
215 eficasSalome.runEficas( code, fileName)
218 def runEficasFichierV8():
219 runEficasFichier(version="v8.5")
221 def runEficasFichierV9():
222 runEficasFichier(version="v9.1")
227 941:runEficasFichier,# runEficas,
228 946:runEficaspourHomard,
229 946:runEficaspourOpenturns,
230 4041:runEficasFichier, #runEficas,
231 4046:runEficaspourHomard,
232 4047:runEficaspourOpenturns,
233 9042:runEficasFichier,
234 9043:runEficasFichierV8,
235 9044:runEficasFichierV9,