8 # Variable globale pour stocker le Workspace de Salome
14 # -----------------------------------------------------------------------------
21 print "lastWindowClosed()"
26 qt.QObject.connect(qt.qApp,qt.SIGNAL("lastWindowClosed()"),g)
28 # -----------------------------------------------------------------------------
33 sgPyQt=SalomePyQt.SalomePyQt()
35 aGuiDS=salomedsgui.guiDS()
36 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
40 # -----------------------------------------------------------------------------
41 #Cette méthode est obsolète en V3
42 #En V2, si on n'implémente pas cette méthode, le composant fonctionne
43 #correctement. Un message "Attribute Error" apparait dans la trace.
44 def setWorkSpace(workSpace):
45 print "EficasGUI --- setWorkSpace"
49 print "WORKSPACE: ",WORKSPACE
51 desktop=sgPyQt.getDesktop()
53 # creation d'une message box
54 #qt.QMessageBox.information(d,"titre","message")
56 # recuperation du workspace
57 ws=sgPyQt.getMainFrame()
60 # -----------------------------------------------------------------------------
62 def OnGUIEvent(commandID) :
63 print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID
64 if dict_command.has_key(commandID):
65 print "OnGUIEvent :::::::::: commande associée : ",commandID
66 dict_command[commandID]()
68 print "Pas de commande associée a : ",commandID
70 # -----------------------------------------------------------------------------
74 Cette méthode permet les initialisations. On définit en particulier
75 l'identifiant de l'étude courante.
78 desktop=sgPyQt.getDesktop()
80 currentStudyId = sgPyQt.getStudyId()
81 print "setSettings: currentStudyId = " + str(currentStudyId)
82 # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
85 palStudyManager.setCurrentStudyID( currentStudyId ) #CS_pbruno
89 Cette méthode permet l'activation du module, s'il a été chargé mais pas encore
90 activé dans une étude précédente.
94 print "--------EFICASGUI:: activate"
98 # -----------------------------------------------------------------------------
100 def activeStudyChanged(ID):
102 desktop=sgPyQt.getDesktop()
103 global currentStudyId
104 # ne marche pas car sg est supposé résider dans une etude
105 # studyId=sg.getActiveStudyId()
107 print "_CS_GBO_ : EFICASGUI.activeStudyChanged : currentStudyId = ", currentStudyId
108 print "_CS_GBO_ : EFICASGUI.activeStudyChanged : sgPyQt.getStudyId() = ", sgPyQt.getStudyId()
110 palStudyManager.setCurrentStudyID( currentStudyId ) #CS_pbruno
113 def definePopup(theContext, theObject, theParent):
114 print "EFICASGUI --- definePopup"
116 theParent = "ObjectBrowser"
117 a=salome.sg.getAllSelected()
120 return (theContext, theObject, theParent)
123 def customPopup(popup, theContext, theObject, theParent):
124 print "EFICASGUI --- customPopup"
125 popup.removeItem(99000)
126 popup.removeItem(99001)
127 popup.removeItem(99002)
128 popup.removeItem(99003)
131 # -----------------------------------------------------------------------------
136 print "-------------------------EFICASGUI::runEficas-------------------------"
138 #eficasSalome.runEficas("ASTER",studyId=currentStudyId)
139 #ws = sgPyQt.getMainFrame()
140 desktop=sgPyQt.getDesktop()
141 eficasSalome.runEficas( desktop, palStudyManager, "ASTER" )
144 def runEficaspourHomard():
146 #eficasSalome.runEficas("HOMARD")
147 desktop=sgPyQt.getDesktop()
148 eficasSalome.runEficas( desktop, palStudyManager, "HOMARD" )
152 def runEficasHomard():
154 #eficasSalome.runEficas("HOMARD")
155 desktop=sgPyQt.getDesktop()
156 eficasSalome.runEficas( desktop, palStudyManager, "HOMARD" )
160 def runEficasFichier():
162 Lancement d'eficas à partir d'un fichier sélectionné dans l'arbre
165 print "runEficasFichier"
168 a=salome.sg.getAllSelected()
170 aGuiDS.setCurrentStudy(currentStudyId)
171 boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0])
175 boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_HOMARD",a[0])
179 #eficasSalome.runEficas(code,attr,studyId=currentStudyId)
180 desktop=sgPyQt.getDesktop()
181 eficasSalome.runEficas( desktop, palStudyManager, code, attr )
188 946:runEficaspourHomard,
190 4046:runEficaspourHomard,
191 9042:runEficasFichier,
194 #CS_pbruno temporaire
195 import studyManager #from PAL
196 palStudyManager = studyManager.SalomeStudy()