Salome HOME
sauve du 20/12
[tools/eficas.git] / PSEN_N1 / opsPSEN_N1.py
1 # -*- coding: iso-8859-1 -*-
2 # Copyright (C) 2007-2013   EDF R&D
3 #
4 # This library is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU Lesser General Public
6 # License as published by the Free Software Foundation; either
7 # version 2.1 of the License.
8 #
9 # This library is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 # Lesser General Public License for more details.
13 #
14 # You should have received a copy of the GNU Lesser General Public
15 # License along with this library; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
17 #
18 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 #
20
21 #from ExtractGeneratorLoadLineandTransfoDico import *
22 #from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2
23
24 def INCLUDE(self,PSSE_path,**args):
25    """
26        Fonction sd_prod pour la macro INCLUDE
27    """
28    #print('in INCLUDE')
29    #print args
30    CaseFolder = args['output_folder']
31    if CaseFolder==None: return
32    reevalue=0
33    if hasattr(self,'fichier_ini'):
34        reevalue=1
35        if self.fichier_ini == CaseFolder : return
36        if hasattr(self,'old_context_fichier_init' ):
37          for concept in self.old_context_fichier_init.values():
38              self.jdc.delete_concept(concept)
39          self.jdc_aux=None
40          self.contexte_fichier_init={}
41          self.reevalue_sd_jdc()
42          self.jdc.reset_context()
43
44    self.fichier_ini=CaseFolder
45    self.contexte_fichier_init = {}
46    self.fichier_unite = 999
47    self.fichier_err = None
48    self.fichier_text=""
49
50    unite = 999
51
52    BusList = [138, 77, 69]
53    self.jdc.appli.changeIntoMC(self,'BusesList',BusList)
54
55
56
57 def INCLUDE_context(self,d):
58    """
59        Fonction op_init pour macro INCLUDE
60    """
61    for k,v in self.g_context.items():
62       d[k]=v
63
64
65 def PROCESS_context(self,d):
66     print "dans le init du Process"
67
68 def PROCESS(self,XLS_file,**args):
69     if XLS_file == "" or XLS_file == None: return
70     if not (hasattr(self,'dico')) :
71        from Processor import getXLS
72        self.dico=getXLS(XLS_file)
73        self.jdc.appli.changeIntoMC(self,'Onglets',self.dico.keys())
74        self.OngletsValeurs=[]
75     else :
76        # On teste si on a modifie la liste des onglets
77        OngletsValeurs= self.get_child('Onglets').getval()
78        
79
80        if not (hasattr(self,'OngletsValeurs')) : self.OngletsValeurs=OngletsValeurs
81        elif self.OngletsValeurs == OngletsValeurs : print 'return' ;return
82        else : self.OngletsValeurs=OngletsValeurs
83
84        if OngletsValeurs==() or OngletsValeurs == []: 
85           self.jdc.appli.deleteMC(self,'BusList')
86           self.jdc.appli.deleteMC(self,'ContList')
87           self.OngletsValeurs=[]
88           return
89
90        OldBusValeurs= self.get_child('BusList').getval()
91        OldContValeurs= self.get_child('ContList').getval()
92        if OldBusValeurs ==  None : OldBusValeurs=[]
93        if OldContValeurs ==  None : OldContValeurs=[]
94
95        listeBus=[]
96        listeCont=[]
97        listeBusCoches=[]
98        listeContCoches=[]
99        for o in OngletsValeurs :
100            for b in self.dico[o][0]:
101                texte=b+" ("+ str(o) +" )"
102                listeBus.append(str(texte))
103                if texte in OldBusValeurs : listeBusCoches.append(str(texte))
104            for c in self.dico[o][1]:
105                texte=c+" ("+ str(o) +" )"
106                listeCont.append(str(texte))
107                if texte in OldContValeurs : listeContCoches.append(str(texte))
108            
109        self.jdc.appli.changeIntoMCandSet(self,'BusList',listeBus,listeBusCoches)
110        self.jdc.appli.changeIntoMCandSet(self,'ContList',listeCont,listeContCoches)
111    
112