5 sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/mapy/components/c_pre_polymer_data_management')
\r
6 sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/mapy/virtual_polymer_common')
\r
7 sys.path.append('/home/A96028/opt/MAP/map-2016.1/lib/python2.7/site-packages/')
\r
8 import pckdb, class_data, instruction, equation_part, utils
\r
12 def __init__(self,ntuple):
\r
15 def __convert__(self,valeur):
\r
16 if type(valeur) == types.StringType: return None
\r
17 if len(valeur) != self.ntuple: return None
\r
21 return "Tuple de %s elements" % self.ntuple
\r
26 #class ObjetUtilisateur(ASSD): pass
\r
28 class classeVisuEquation :
\r
29 def __init__(self,dicoListeAffiche):
\r
30 self.dicoListeAffiche=dicoListeAffiche
\r
34 return ('a1','a2','a3')
\r
36 def maFuncWithArg(monMC):
\r
37 if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return
\r
38 monMC.dsMaFunct = True
\r
40 editor=monMC.jdc.editor
\r
41 if monMC.valeur == 'POOH->P' : monInto=('a1','a2','a3')
\r
42 else : monInto=('b1','b2','b3')
\r
44 change=editor.changeIntoDefMC('AGING', ('Equation', 'b_approved','b_type_creation','Equation_Modification','Type2'), monInto )
\r
46 print ('j ai change le into')
\r
47 editor.reCalculeValiditeMCApresChgtInto('AGING', 'Type2', ('Equation', 'b_approved','b_type_creation','Equation_Modification'))
\r
48 if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()
\r
50 monMC.dsMaFunct = False
\r
52 def recupereDicoGenerique(monMC):
\r
53 if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return
\r
54 print ('je passe dans la recuperation')
\r
55 editor=monMC.jdc.editor
\r
56 valeurDB=editor.getValeur('Equation','Equation_DB',())
\r
57 print ('valeurDB',valeurDB)
\r
58 correspond=pckdb.DBRENAME
\r
59 if valeurDB != None :
\r
60 listEquation, listModele,listePostTraitement=pckdb.read_pckdb(correspond[valeurDB])
\r
61 print (listEquation, listModele,listePostTraitement)
\r
62 monMC.dsMaFunct = False
\r
63 return listEquation, listModele,listePostTraitement
\r
65 def recupereDicoEquation(monMC):
\r
66 if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return
\r
67 listEquation, listModele,listePostTraitement=recupereDicoGenerique(monMC)
\r
68 editor=monMC.jdc.editor
\r
70 valeurEquationListe=editor.getValeur('Equation','Equation_Liste',('b_type_show',))
\r
71 valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_reaction_type',))
\r
72 if valeurAgingType == None :
\r
73 print ('dans reaction-type')
\r
74 valeurAgingType=editor.getValeur('Equation','Equation_reaction',('b_type_show','b_aging_type',))
\r
75 if valeurAgingType == None : monMC.dsMaFunct = False; return
\r
77 print ('valeurType',valeurAgingType)
\r
78 listeEquationPourIhm = []
\r
79 listeReprEquationPourIhm = []
\r
81 for equation in listEquation :
\r
82 if valeurEquationListe == 'aging_type' :
\r
83 if equation.type_vieil == valeurAgingType :
\r
84 listeEquationPourIhm.append(equation)
\r
85 listeReprEquationPourIhm.append(equation.representation)
\r
86 dicoListeAffiche[equation.representation]=equation
\r
88 if equation.type_react == valeurAgingType :
\r
89 listeEquationPourIhm.append(equation)
\r
90 listeReprEquationPourIhm.append(equation.representation)
\r
91 dicoListeAffiche[equation.representation]=equation
\r
92 change=editor.changeIntoDefMC('Equation', ('b_type_show','ListeEquation'), listeReprEquationPourIhm )
\r
94 editor.reCalculeValiditeMCApresChgtInto('Equation', 'listeEquation', ('b_type_show',))
\r
95 if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()
\r
96 editor.maClasseVisuEquation = classeVisuEquation(dicoListeAffiche)
\r
97 monMC.dsMaFunct = False
\r
99 def afficheValeurEquation(monMC):
\r
100 if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return
\r
101 editor=monMC.jdc.editor
\r
102 valeur=monMC.valeur
\r
103 if valeur == None :
\r
104 monMC.dsMaFunct = False
\r
106 print (editor.maClasseVisuEquation.dicoListeAffiche[valeur])
\r
107 print(str (editor.maClasseVisuEquation.dicoListeAffiche[valeur]))
\r
108 editor.maClasseVisuEquation.valeurEquationChoisie=valeur
\r
109 monMC.dsMaFunct = False
\r
112 def instancieChemicalFormulation(monMC):
\r
113 if hasattr(monMC,'dsMaFunct') and monMC.dsMaFunct== True : return
\r
114 if monMC.valeur == False : return
\r
116 editor=monMC.jdc.editor
\r
117 if hasattr(editor,'dsMaFunct') and editor.dsMaFunct== True : return
\r
118 editor.dsMaFunct = True
\r
120 print ('ds instancie')
\r
121 v=editor.maClasseVisuEquation.valeurEquationChoisie
\r
122 monEquation=editor.maClasseVisuEquation.dicoListeAffiche[v]
\r
123 type_react=monEquation.type_react
\r
124 type_vieil=monEquation.type_vieil
\r
125 print (v, type_react, type_vieil)
\r
126 #editor.changeIntoMCandSet('Equation', ('b_type_show','b_modification','b_modif','ChemicalFormulation'),( v,),v )
\r
127 change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Reaction_Type'),type_react )
\r
128 change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Aging_Type'), type_vieil )
\r
130 for index,valeurConstituant in enumerate(monEquation.constituants):
\r
131 valeurEquation=monEquation.equation[index]
\r
132 editor.ajoutMC(monMC.etape,'OptionnelConstituant',None,('b_type_show','b_modification','b_modif',))
\r
133 print (index,valeurConstituant,valeurEquation)
\r
135 #OptionnelConstituant = FACT ( statut = 'f',max = '**',
\r
136 # Constituant = SIMP (statut = 'o', typ = 'TXM'),
\r
137 # Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
\r
138 for index,valeurConstituant in enumerate(monEquation.const_cine_nom):
\r
139 valeurArrhe=monEquation.arrhenius[index]
\r
140 if valeurArrhe : valeurConstanteType='Arrhenius type'
\r
141 else : valeurConstanteType='non Arrhenius type'
\r
143 print (index,valeurConstituant,valeurConstanteType)
\r
144 #OptionnelleConstante = FACT (statut = 'f', max = '**',
\r
145 # ConstanteName= SIMP (statut = 'o', typ = 'TXM',),
\r
146 # ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'),
\r
147 change=editor.changeDefautDefMC('Equation', ('b_type_show','b_modification','b_modif','Commentaire'),monEquation.comment )
\r
148 print (monEquation.comment )
\r
150 if editor.fenetreCentraleAffichee : editor.fenetreCentraleAffichee.node.affichePanneau()
\r
151 monMC.dsMaFunct = False
\r
152 editor.dsMaFunct = False
\r
156 monDico= { 'Equation_Liste' : ('initiation', 'propagation', 'termination', 'stabilization')}
\r
158 JdC = JDC_CATA(code='VP',
\r
164 #---------------------------------
\r
165 Equation = PROC (nom="Equation",
\r
167 #---------------------------------
\r
168 Equation_DB=SIMP(statut= 'o',typ= 'TXM', into=("Approved data base", "My data base") ),
\r
169 Equation_Type = SIMP(statut= 'o',typ= 'TXM', into=("Show equation database", "Equation creation"),),
\r
172 # ---------------------------------------------------------------------------
\r
173 b_type_show = BLOC(condition = " Equation_Type == 'Show equation database'",
\r
174 # ---------------------------------------------------------------------------
\r
175 Equation_Liste=SIMP(statut= 'o',typ= 'TXM', into=('reaction_type','aging_type')),
\r
177 b_reaction_type = BLOC(condition = " Equation_Liste == 'reaction_type'",
\r
178 Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=monDico['Equation_Liste'],siValide=recupereDicoEquation),
\r
179 ), # Fin b_reaction_type
\r
181 b_aging_type = BLOC(condition = " Equation_Liste == 'aging_type'",
\r
182 Equation_reaction=SIMP(statut= 'o',typ= 'TXM', into=('All', 'thermo', 'radio'),siValide=recupereDicoEquation),
\r
183 ), # Fin b_reaction_type
\r
185 ListeEquation = SIMP(statut='o', typ='TXM', homo='SansOrdreNiDoublon',siValide=afficheValeurEquation),
\r
186 b_modification = BLOC(condition = " ListeEquation != None ",
\r
187 modification = SIMP(typ = bool, statut = 'o',defaut = False, fr='toto', ang='toto en anglais', siValide=instancieChemicalFormulation),
\r
189 b_modif = BLOC(condition = "modification == True",
\r
190 Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],),
\r
191 Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max='**', homo='SansOrdreNiDoublon', into=('All', 'thermo', 'radio'),),
\r
193 OptionnelConstituant = FACT ( statut = 'f',max = '**',
\r
194 Constituant = SIMP (statut = 'o', typ = 'TXM'),
\r
195 Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
\r
196 ), # fin Const_Equa
\r
197 OptionnelleConstante = FACT (statut = 'f', max = '**',
\r
198 ConstanteName= SIMP (statut = 'o', typ = 'TXM',),
\r
199 ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'),
\r
200 ),# fin ConstanteOptionnelle
\r
201 Commentaire = SIMP (statut = 'f', typ = 'TXM', defaut = ' '),
\r
205 ), # fin b_modification
\r
206 ), # Fin b_type_show
\r
209 # ---------------------------------------------------------------------------
\r
210 b_type_creation = BLOC(condition = " Equation_Type == 'Equation creation'",
\r
211 # ---------------------------------------------------------------------------
\r
212 Equation_Modification = FACT ( statut = 'o',
\r
214 ChemicalFormulation = SIMP(statut='o', typ='TXM', defaut = 'POOH -> 2P'),
\r
216 Reaction_Type=SIMP(statut= 'o',typ= 'TXM', min=1,into=monDico['Equation_Liste'],),
\r
217 Aging_Type=SIMP(statut= 'o',typ= 'TXM', min=1,max='**', homo='SansOrdreNiDoublon', into=('All', 'thermo', 'radio'),),
\r
219 Constituants = FACT ( statut = 'o',
\r
220 ConstituantPOOH = SIMP (statut = 'f', typ = 'TXM', into = ('POOH',), defaut= 'POOH'),
\r
221 b_pooh = BLOC(condition = " ConstituantPOOH == 'POOH'" ,
\r
222 Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '-ku1*POOH'),
\r
224 ConstituantP = SIMP (statut = 'f', typ = 'TXM', into = ('P',),defaut='P'),
\r
225 b_p = BLOC(condition = " ConstituantP == 'P'" ,
\r
226 Differential_Equation = SIMP(statut= 'o',typ= 'TXM', defaut = '2*ku1*POOH'),
\r
228 OptionnelConstituant = FACT ( statut = 'f',max = '**',
\r
229 Constituant = SIMP (statut = 'o', typ = 'TXM'),
\r
230 Differential_Equation = SIMP(statut= 'o',typ= 'TXM'),
\r
231 ), # fin Const_Equa
\r
232 ),# Fin Constituants
\r
234 Constante = FACT ( statut = 'o',
\r
235 Constanteku1 = SIMP (statut = 'f', typ = 'TXM', into = ('ku1',), defaut= 'ku1'),
\r
236 b_cku1 = BLOC(condition = "Constanteku1 == 'ku1'" ,
\r
237 ConstanteType = SIMP(statut= 'o',typ= 'TXM', into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'),
\r
239 OptionnelleConstante = FACT (statut = 'f', max = '**',
\r
240 ConstanteName= SIMP (statut = 'o', typ = 'TXM',),
\r
241 ConstanteType = SIMP(statut= 'o',typ= 'TXM', min=1,into=('Arrhenius type','non Arrhenius type'),defaut='Arrhenius type'),
\r
242 ),# fin ConstanteOptionnelle
\r
244 Commentaire = SIMP (statut = 'f', typ = 'TXM', defaut = ' '),
\r
246 ), # Fin Equation_Modification
\r
248 #Chemical_Formulation = SIMP(statut= 'o',typ= 'TXM', defaut = 'POOH->P',siValide=maFuncWithArg),
\r
249 #Type1 = SIMP(statut='o', typ = 'TXM', into=maFunc),
\r
250 #Type2 = SIMP(statut='o', typ = 'TXM'),
\r
252 ), # fin b_type_creation
\r
257 Modele = PROC (nom="Modele",
\r
259 Commentaire = SIMP (statut = 'f', typ = 'TXM'),
\r