Salome HOME
pour POPUP menu
authorsalome <>
Thu, 6 Jan 2005 11:12:12 +0000 (11:12 +0000)
committersalome <>
Thu, 6 Jan 2005 11:12:12 +0000 (11:12 +0000)
resources/EFICAS_en.xml
src/EFICASGUI/EFICASGUI.py
src/EFICASGUI/dataEficas.py
src/EFICASGUI/eficasEtude.py
src/EFICASGUI/eficasSalome.py
src/EFICASGUI/salomedsgui.py

index 617dac714987bc2332e8fada70a5f2b378508c49..d6e1cf11a5f80bd3d82e0dc18195bc8498132956 100644 (file)
         <toolbutton-item item-id="4046" label-id="Eficas pour Homard" icon-id="eficaster.png" tooltip-id="Editer un jeu de commande HOMARD avec Eficas" accel-id="" toggle-id="" execute-action=""/>
     </toolbar>
 
+  <!-- ### POPUP MENU ###  -->
+     <popupmenu label-id="" context-id="" parent-id="ObjectBrowser" object-id="73">
+       <popup-item item-id="9042" pos-id="" label-id="Eficas" icon-id="" tooltip-id="Editer avec Eficas" execute-action=""/>
+    </popupmenu>
+
   </desktop>   
 </application>
index 59852ca8ee5cad6337f9159196f90564269f028b..f437a7423d709fb127f1eed70d56af2e303062d8 100644 (file)
@@ -29,6 +29,8 @@ import salome
 
 sg=salome.SalomeGUI()
 sgPyQt=SalomePyQt.SalomePyQt()
+import salomedsgui
+aGuiDS=salomedsgui.guiDS()
 print "EFicasGUI :: :::::::::::::::::::::::::::::::::::::::::::::::::::::"
 
 # -----------------------------------------------------------------------------
@@ -76,6 +78,23 @@ def activeStudyChanged(ID):
    print "On a changé d'étude active",studyId
    print sgPyQt.getStudyId()
 
+def definePopup(theContext, theObject, theParent):
+   print "EFICASGUI --- definePopup"
+   theContext = ""
+   theParent = "ObjectBrowser"
+   a=salome.sg.getAllSelected()
+   if len(a) >0:
+       theObject="73"
+   return (theContext, theObject, theParent)
+
+
+def customPopup(popup, theContext, theObject, theParent):
+   print "EFICASGUI --- customPopup"
+   popup.removeItem(99000)
+   popup.removeItem(99001)
+   popup.removeItem(99002)
+   popup.removeItem(99003)
+
 
 # -----------------------------------------------------------------------------
 
@@ -89,10 +108,24 @@ def runEficaspourHomard(ws):
    print "runEficas"
    eficasSalome.runEficas(ws,"HOMARD")
     
-def runEficasHomard():
+def runEficasHomard(ws):
    print "runEficas"
    eficasSalome.runEficas(None,"HOMARD")
 
+def runEficasFichier(ws):
+   print "runEficasFichier"
+   attr=None
+   code="ASTER"
+   a=salome.sg.getAllSelected()
+   if len(a) == 1:
+      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"
+   eficasSalome.runEficas(ws,code,attr)
+
 # Partie applicative
 
 dict_command={
@@ -100,5 +133,6 @@ dict_command={
                946:runEficaspourHomard,
                4041:runEficas,
                4046:runEficaspourHomard,
+              9042:runEficasFichier,
              }
 
index 9450b9af3cede774e801a44f79022fe519e8ad8f..b33252217672607eae0f70b6707510e08c17654e 100644 (file)
@@ -16,12 +16,12 @@ import import_code
 import splash
 
 
-def init(top,code="ASTER"):
+def init(top,code="ASTER",fichier=None):
     splash.init_splash(top,code=code,titre="Lancement d'EFICAS pour %s" %code)
     splash._splash.configure(text="Chargement d'EFICAS en cours.\n Veuillez patienter ...")
     # Enregistrement dans l étude
     import eficasEtude
-    MaRef=eficasEtude.Eficas_In_Study()
+    MaRef=eficasEtude.Eficas_In_Study(code)
 
     import eficas
     class MyEficas(eficas.EFICAS):
@@ -32,5 +32,6 @@ def init(top,code="ASTER"):
         def contexte(self):
             self.salome=MaRef
 
-    moi=MyEficas(top,code=code)
+    print code
+    moi=MyEficas(top,code=code,fichier=fichier)
     moi.contexte()
index c2a9d3945d83ca765275cbc0457287972438a0b3..d672bc5c62a22fbcecc648741fa05200b73b86d2 100644 (file)
@@ -4,7 +4,7 @@
 # Author    : Pascale NOYRET, EDF
 # Project   : SALOME
 # Copyright : EDF 2003
-#  $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/ASTER_SRC/src/ASTERGUI/eficasEtude.py,v 1.1.1.1.2.1 2004/05/18 11:40:21 salome Exp $
+#  $Header: /home/salome/PlateFormePAL/Bases_CVS_EDF/Modules_EDF/EFICAS_SRC/src/EFICASGUI/eficasEtude.py,v 1.1.1.1 2004/09/28 09:41:16 salome Exp $
 #=============================================================================
 
 import salome
@@ -18,22 +18,23 @@ aGuiDS=salomedsgui.guiDS()
 
 class Eficas_In_Study:
 
-      def __init__(self):
+      def __init__(self,code):
           import SMESH_utils
           self.enregistre()
+         self.code=code
           self.liste_deja_la=[]
           
       def  enregistre(self):
            self.fatherId=aGuiDS.enregistre("Eficas")
            salome.sg.updateObjBrowser(0)
 
-      def  rangeInStudy(self,fichier):
+      def  rangeInStudy(self,fichier, suf=""):
           if fichier not in self.liste_deja_la :
                self.liste_deja_la.append(fichier)
                 Nom=re.split("/",fichier)[-1]
 
                 self.commId=aGuiDS.createItemInStudy(self.fatherId,Nom)
-                aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS",fichier)
+                aGuiDS.setExternalFileAttribute(self.commId,"FICHIER_EFICAS_"+self.code+suf,fichier)
                 salome.sg.updateObjBrowser(0)
 
       def creeConfigTxt(self,fichier,dico):
index 964a7068e1f35ef3d07c4e21dc59d79a35f84c43..2d9920262bda74be99f8363e708b19272bffa362 100644 (file)
@@ -19,14 +19,14 @@ root=Tkinter.Tk()
 root.withdraw()
 
 
-def runEficas(ws,code="ASTER"):
+def runEficas(ws,code="ASTER",fichier=None):
     global initialised
     if not initialised:
         t=Tkinter.Toplevel()
         t.withdraw()
         print t.geometry()
         print t.winfo_geometry()
-        import dataEficas; dataEficas.init(t,code)
+        import dataEficas; dataEficas.init(t,code,fichier)
         t.update()
         print t.geometry()
         print t.winfo_geometry()
index d30549c99e4276adea882525805bd223ef5db04e..521dd64c95181ece3497a6a77229fefaa266d5e8 100644 (file)
@@ -67,6 +67,8 @@ class guiDS:
                 FName = A1._narrow(SALOMEDS.AttributeName)
                 FName.SetValue(objectName)
                 objId = newObj.GetID()
+           else:
+               objId = listSO[0].GetID()
         return objId
 
     def getReference(self,objectId):