From 2ec2369132ac52f917fd34fe5107ba0321995866 Mon Sep 17 00:00:00 2001 From: salome <> Date: Thu, 6 Jan 2005 11:12:12 +0000 Subject: [PATCH] pour POPUP menu --- resources/EFICAS_en.xml | 5 +++++ src/EFICASGUI/EFICASGUI.py | 36 ++++++++++++++++++++++++++++++++++- src/EFICASGUI/dataEficas.py | 7 ++++--- src/EFICASGUI/eficasEtude.py | 9 +++++---- src/EFICASGUI/eficasSalome.py | 4 ++-- src/EFICASGUI/salomedsgui.py | 2 ++ 6 files changed, 53 insertions(+), 10 deletions(-) diff --git a/resources/EFICAS_en.xml b/resources/EFICAS_en.xml index 617dac71..d6e1cf11 100644 --- a/resources/EFICAS_en.xml +++ b/resources/EFICAS_en.xml @@ -27,5 +27,10 @@ + + + + + diff --git a/src/EFICASGUI/EFICASGUI.py b/src/EFICASGUI/EFICASGUI.py index 59852ca8..f437a742 100644 --- a/src/EFICASGUI/EFICASGUI.py +++ b/src/EFICASGUI/EFICASGUI.py @@ -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, } diff --git a/src/EFICASGUI/dataEficas.py b/src/EFICASGUI/dataEficas.py index 9450b9af..b3325221 100644 --- a/src/EFICASGUI/dataEficas.py +++ b/src/EFICASGUI/dataEficas.py @@ -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() diff --git a/src/EFICASGUI/eficasEtude.py b/src/EFICASGUI/eficasEtude.py index c2a9d394..d672bc5c 100644 --- a/src/EFICASGUI/eficasEtude.py +++ b/src/EFICASGUI/eficasEtude.py @@ -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): diff --git a/src/EFICASGUI/eficasSalome.py b/src/EFICASGUI/eficasSalome.py index 964a7068..2d992026 100644 --- a/src/EFICASGUI/eficasSalome.py +++ b/src/EFICASGUI/eficasSalome.py @@ -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() diff --git a/src/EFICASGUI/salomedsgui.py b/src/EFICASGUI/salomedsgui.py index d30549c9..521dd64c 100644 --- a/src/EFICASGUI/salomedsgui.py +++ b/src/EFICASGUI/salomedsgui.py @@ -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): -- 2.30.2