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()
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):
47 print "EficasGUI --- setWorkSpace"
51 print "WORKSPACE: ",WORKSPACE
53 desktop=sgPyQt.getDesktop()
55 # creation d'une message box
56 #qt.QMessageBox.information(d,"titre","message")
58 # recuperation du workspace
59 ws=sgPyQt.getMainFrame()
62 # -----------------------------------------------------------------------------
64 def OnGUIEvent(commandID) :
65 print "EficasGUI :: OnGUIEvent :::::::::::::::::::::::::::::::::commandID = ",commandID
66 if dict_command.has_key(commandID):
67 print "OnGUIEvent :::::::::: commande associée : ",commandID
68 dict_command[commandID]()
70 print "Pas de commande associée a : ",commandID
72 # -----------------------------------------------------------------------------
76 Cette méthode permet les initialisations. On définit en particulier
77 l'identifiant de l'étude courante.
80 desktop=sgPyQt.getDesktop()
82 currentStudyId = sgPyQt.getStudyId()
83 print "setSettings: currentStudyId = " + str(currentStudyId)
84 # _CS_gbo_ Voir si on peut utiliser directement sgPyQt.getStudyId()
87 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
91 Cette méthode permet l'activation du module, s'il a été chargé mais pas encore
92 activé dans une étude précédente.
96 print "--------EFICASGUI:: activate"
100 # -----------------------------------------------------------------------------
102 def activeStudyChanged(ID):
104 desktop=sgPyQt.getDesktop()
105 global currentStudyId
106 # ne marche pas car sg est supposé résider dans une etude
107 # studyId=sg.getActiveStudyId()
109 print "_CS_GBO_ : EFICASGUI.activeStudyChanged : currentStudyId = ", currentStudyId
110 print "_CS_GBO_ : EFICASGUI.activeStudyChanged : sgPyQt.getStudyId() = ", sgPyQt.getStudyId()
112 studyManager.palStudy.setCurrentStudyID( currentStudyId ) #CS_pbruno
115 def definePopup(theContext, theObject, theParent):
116 print "EFICASGUI --- definePopup"
118 theParent = "ObjectBrowser"
119 a=salome.sg.getAllSelected()
122 return (theContext, theObject, theParent)
125 def customPopup(popup, theContext, theObject, theParent):
126 print "EFICASGUI --- customPopup"
127 popup.removeItem(99000)
128 popup.removeItem(99001)
129 popup.removeItem(99002)
130 popup.removeItem(99003)
133 # -----------------------------------------------------------------------------
138 print "-------------------------EFICASGUI::runEficas-------------------------"
140 #eficasSalome.runEficas("ASTER",studyId=currentStudyId)
141 #ws = sgPyQt.getMainFrame()
142 desktop=sgPyQt.getDesktop()
143 eficasSalome.runEficas( desktop, studyManager.palStudy, "ASTER" )
146 def runEficaspourHomard():
148 #eficasSalome.runEficas("HOMARD")
149 desktop=sgPyQt.getDesktop()
150 eficasSalome.runEficas( desktop, studyManager.palStudy, "HOMARD" )
154 def runEficasHomard():
156 #eficasSalome.runEficas("HOMARD")
157 desktop=sgPyQt.getDesktop()
158 eficasSalome.runEficas( desktop, studyManager.palStudy, "HOMARD" )
162 def runEficasFichier():
164 Lancement d'eficas à partir d'un fichier sélectionné dans l'arbre
165 d'étude par clique droit de la souris.
167 print "runEficasFichier"
170 a=salome.sg.getAllSelected()
172 #studyManager.palStudy.setCurrentStudyID( currentStudyId )
173 #boo,attr=aGuiDS.getExternalFileAttribute("FICHIER_EFICAS_ASTER",a[0])
176 aType, aValue = studyManager.palStudy.getTypeAndValue( selectedEntry )
177 if aType == studyManager.FICHIER_EFICAS_ASTER:
180 elif aType == studyManager.FICHIER_EFICAS_HOMARD:
184 #eficasSalome.runEficas(code,attr,studyId=currentStudyId)
185 desktop=sgPyQt.getDesktop()
186 eficasSalome.runEficas( desktop, studyManager.palStudy, code, fileName )
194 946:runEficaspourHomard,
196 4046:runEficaspourHomard,
197 9042:runEficasFichier,