+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012-2013 EDF
-#
-# This file is part of SALOME HYDRO module.
-#
-# SALOME HYDRO module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME HYDRO module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
-
-import types
-from Accas import *
-
-
-class Tuple:
- def __init__(self,ntuple):
- self.ntuple=ntuple
-
- def __convert__(self,valeur):
- if type(valeur) == types.StringType:
- return None
- if len(valeur) != self.ntuple:
- return None
- return valeur
-
- def info(self):
- return "Tuple de %s elements" % self.ntuple
-
- __repr__=info
- __str__=info
-
-JdC = JDC_CATA(regles = (UN_PARMI('TELEMAC2D',)),
- )
-
-
-
-Atmos = PROC(
- nom = "Atmos", op = None,
- fr = u"Définition d'un cas d'étude Atmosphérique",
- ang = u"Definition of study case",
- Wind = FACT( statut='o',
- Wind_Speed = SIMP(statut = "o", typ = 'I', sug=20),
- Speed_Unit = SIMP(statut = "o", typ = 'TXM',
- into = ('knots','mph','m/s'),
- defaut = 'mph'),
- Measurement = SIMP(statut = "o", typ = 'TXM',
- into = ( 'Manual', 'TypeA', 'TypeB'),),
- b_enter_mesure = BLOC(condition = 'MEASUREMENT == "Manual"',
- Value = SIMP(statut = "o", typ = 'I'),
- Unit = SIMP(statut = "o", typ = 'TXM', into = ('feet', 'meters')),
- ),
- ),
- Ground = FACT( statut='o',
- Ground_Roughness = SIMP(statut='o',typ='TXM',
- into=('Open Country', 'Urban Or Forest', 'Open Water', 'Manual')
- ),
- b_enter_ground = BLOC(condition = 'Ground_Roughness == "Manual"',
- Input_Roughness = SIMP(statut = "o", typ = 'I'),
- Unit = SIMP(statut = "o", typ = 'TXM', into = ('in', 'cm'), defaut='cm')
- ),
-
- ),
- Cover = FACT( statut='o',
- Cover_type = SIMP(statut='o',typ='TXM', into=('Manual', 'Clear','Partly Cloudy','Complete Cover',),),
- b_enter_cover = BLOC(condition = 'Cover_type == "Manual"',
- Cover_Value = SIMP(statut = "o", typ = 'I',val_max=10),
- ),
- ),
-
-)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import types
+from Accas import *
+
+
+class Tuple:
+ def __init__(self,ntuple):
+ self.ntuple=ntuple
+
+ def __convert__(self,valeur):
+ if type(valeur) == types.StringType:
+ return None
+ if len(valeur) != self.ntuple:
+ return None
+ return valeur
+
+ def info(self):
+ return "Tuple de %s elements" % self.ntuple
+
+ __repr__=info
+ __str__=info
+
+JdC = JDC_CATA(regles = (UN_PARMI('Atmos',)),
+ )
+
+
+
+Atmos = PROC(
+ nom = "Atmos", op = None,
+ fr = u"Définition d'un cas d'étude Atmosphérique",
+ ang = u"Definition of study case",
+ Wind = FACT( statut='f',
+ Wind_Speed = SIMP(statut = "o", typ = 'I', sug=20),
+ Speed_Unit = SIMP(statut = "o", typ = 'TXM',
+ into = ('knots','mph','m/s'),
+ defaut = 'mph'),
+ Measurement = SIMP(statut = "o", typ = 'TXM',
+ into = ( 'Manual', 'TypeA', 'TypeB'),),
+ b_enter_mesure = BLOC(condition = 'MEASUREMENT == "Manual"',
+ Value = SIMP(statut = "o", typ = 'I'),
+ Unit = SIMP(statut = "o", typ = 'TXM', into = ('feet', 'meters')),
+ ),
+ ),
+ Ground = FACT( statut='o',
+ Ground_Roughness = SIMP(statut='o',typ='TXM',
+ into=('Open Country', 'Urban Or Forest', 'Open Water', 'Manual')
+ ),
+ b_enter_ground = BLOC(condition = 'Ground_Roughness == "Manual"',
+ Input_Roughness = SIMP(statut = "o", typ = 'I'),
+ Unit = SIMP(statut = "o", typ = 'TXM', into = ('in', 'cm'), defaut='cm')
+ ),
+
+ ),
+ Cover = FACT( statut='o',
+ Cover_type = SIMP(statut='o',typ='TXM', into=('Manual', 'Clear','Partly Cloudy','Complete Cover',),),
+ b_enter_cover = BLOC(condition = 'Cover_type == "Manual"',
+ Cover_Value = SIMP(statut = "o", typ = 'I',val_max=10),
+ ),
+ ),
+
+ ZONE = FACT ( statut='o',
+ max='**',
+ Distance = SIMP(statut='o',typ='R'),
+ Resolution = SIMP(statut='o',typ='R'),
+ Ratio = SIMP(statut='o',typ='R'),
+ ),
+)
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import types
+from Accas import *
+
+
+
+JdC = JDC_CATA(code='Atmos',regles = (UN_PARMI('Wind',)),
+ )
+
+
+Wind = PROC( nom="Wind", op = None,
+ Wind_Speed1 = SIMP(statut = "o", typ = 'I'),
+ Mesure1 = FACT( statut='f',
+ Value1 = SIMP(statut = "o", typ = 'I'),
+ Unit1 = SIMP(statut = "o", typ = 'I'),
+ ),
+ B_enter_mesure = BLOC(condition = 'Wind_Speed1 == 1',
+ Wind_Speed = SIMP(statut = "o", typ = 'I'),
+ Mesure = FACT( statut='f', max='**',
+ Value = SIMP(statut = "o", typ = 'I'),
+ Unit = SIMP(statut = "o", typ = 'I'),
+ ),
+ ),
+)
+
--- /dev/null
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2012-2013 EDF
+#
+# This file is part of SALOME HYDRO module.
+#
+# SALOME HYDRO module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME HYDRO module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with SALOME HYDRO module. If not, see <http://www.gnu.org/licenses/>.
+
+import types
+from Accas import *
+
+
+
+JdC = JDC_CATA(regles = (UN_PARMI('Atmos',)),
+ )
+
+
+
+Atmos = PROC(
+ nom = "Atmos", op = None,
+ fr = u"Définition d'un cas d'étude Atmosphérique",
+ ang = u"Definition of study case",
+ Wind_Speed = SIMP(statut = "o", typ = 'I'),
+)
--- /dev/null
+import atmo_reduit
+monElt=atmo_reduit.Wind_Speed(3)
+monAtmo=atmo_reduit.Atmos(monElt)
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- edited with XMLSpy v2015 rel. 4 (http://www.altova.com) by USER1 (EDF-DSP) -->
+<schema xmlns="http://www.w3.org/2001/XMLSchema" xmlns:atmos="http://chercheurs.edf.com/logiciels/atmos" targetNamespace="http://chercheurs.edf.com/logiciels/atmos" elementFormDefault="qualified" attributeFormDefault="qualified">
+ <simpleType name="T_Wind_Speed">
+ <restriction base="int"/>
+ </simpleType>
+ <complexType name="T_Atmos">
+ <sequence>
+ <element name="Wind_Speed" type="atmos:T_Wind_Speed" minOccurs="1" maxOccurs="1"/>
+ </sequence>
+ </complexType>
+ <element name="Atmos" type="atmos:T_Atmos"/>
+</schema>
</complexType>
<complexType name="T_Mesure1">
- <sequence>
+ <sequence maxOccurs="4">
<element name="Value1" type="atmos:T_Value1"/>
<element name="Unit1" type="atmos:T_Unit1"/>
</sequence>
</complexType>
<complexType name="T_Mesure">
- <sequence>
+ <sequence maxOccurs="4">
<element name="Value" type="atmos:T_Value"/>
<element name="Unit" type="atmos:T_Unit"/>
</sequence>
encoding='iso-8859-1'
#
+#typeDeCata='XML'
catalogues=(
- ('Atmo','V2017',os.path.join(repIni,'Cata_V0.py'),'python','python'),
+ ('Atmo','V2017',os.path.join(repIni,'cata_reduit.py'),'python','python'),
)
nombreDeBoutonParLigne=4
simpleClic=True
+class Tuple:
+ def __init__(self,ntuple):
+ self.ntuple=ntuple
+
+ def __convert__(self,valeur):
+ if type(valeur) == types.StringType:
+ return None
+ if len(valeur) != self.ntuple:
+ return None
+ return valeur
+
+ def info(self):
+ return "Tuple de %s elements" % self.ntuple
+
+ __repr__=info
+ __str__=info
+
+
+
def inverseDico(dicoSource) :
#---------------------------
dicoInverse = {}
dicoInverse[elt][att]=clef
return dicoInverse
-dictSIMPEficasXML= { 'typ' : 'typeAttendu',
+dictSIMPEficasXML= { 'typ' : 'nomTypeAttendu',
'statut' : 'statut',
'min' : 'minOccurences',
'max' : 'maxOccurences',
'ang' : ('doc','ang'),
'fr' : ('doc','fr',),
'docu' : ('doc','docu'),
+ 'regles' : 'regles',
'validators' : 'validators' ,
}
dictFACTXMLEficas = inverseDico(dictFACTEficasXML)
+dictBLOCEficasXML = { 'statut' : 'statut',
+ 'ang' : ('doc','ang'),
+ 'fr' : ('doc','fr',),
+ 'regles' : 'regles',
+ 'condition' : 'condition' ,
+ }
+
+dictBLOCXMLEficas = inverseDico(dictBLOCEficasXML)
+
dictPROCEficasXML = { 'nom' : 'nom',
'regles' : 'regles',
'ang' : ('doc','ang'),
dictPROCXMLEficas = inverseDico(dictPROCEficasXML)
-listeParamDeTypeTypeAttendu = ( 'defaut', 'sug', 'val_min', 'val_max', 'into')
+dictOPEREficasXML = dictPROCEficasXML
+dictOPERXMLEficas = dictPROCXMLEficas
+
+dicoPourCast = { 'I' : int, 'R' : float, 'bool' : bool , }
+
+listeParamDeTypeTypeAttendu = ( 'defaut', 'sug', 'val_min', 'val_max', 'into', 'intoSug')
listeParamDeTypeStr = ('fr', 'docu', 'ang', 'nom' )
-dicoPourCast = { 'I' : int, 'R' : float }
-listeParamTjsEnListe = ('into')
-listeParamEnListeSiMax = ('defaut', 'into', 'sug')
+listeParamTjsSequence = ('into' , 'intoSug')
+listeParamSelonType = ('defaut', 'sug', 'into', 'intoSug')
if __name__ == "__main__":
import pprint
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import sys,os
+#import raw.efficas as efficas
+import types
+
+sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..')))
+
+
+import Atmo.raw.atmo_test1 as modeleMetier
+
+class X_MCSIMP:
+# -------------
+
+ def buildObjPyxb(self) :
+ #print ('X_MCSIMP buildObjPyxb', self.nom, self)
+ self.monNomDeClasseModeleMetier='T_'+self.nom
+ self.maClasseModeleMetier=getattr(modeleMetier,self.monNomDeClasseModeleMetier)
+ if self.val != None : self.objPyxb=self.maClasseModeleMetier(self.val)
+ else : self.objPyxb=self.maClasseModeleMetier()
+ #print ('fin X_MCSIMP', self.objPyxb, self.nom,self)
+
+
+ def setValeur(self,val):
+ print ('a faire PNPNPNPN')
+
+
+class X_MCCOMPO:
+# --------------
+#
+ def buildObjPyxb(self,mc_list) :
+ print ('X_MCCOMPO buildObjPyxb', self.nom, self)
+ self.monNomDeClasseModeleMetier='T_'+self.nom
+ self.maClasseModeleMetier=getattr(modeleMetier,self.monNomDeClasseModeleMetier)
+ listArg=[]
+ for objAccas in mc_list :
+ listArg.append(objAccas.objPyxb)
+ self.objPyxb=self.maClasseModeleMetier(*listArg)
+ print ('fin MCCOMPO', self.objPyxb, self.nom,self,self.objPyxb.content())
+
+class X_MCFACT:
+# --------------
+# Pour un MCFACT :
+# le buildObjPyxb sera pris en charge par X_MCLIST
+# on ne fait rien
+
+ def buildObjPyxb(self,mc_list):
+ pass
+
+class X_MCLIST:
+# --------------
+
+ def buildObjPyxb(self,factList):
+ #print ('X_MCLIST buildObjPyxb', self.nom, self)
+ self.monNomDeClasseModeleMetier='T_'+self.nom
+ self.maClasseModeleMetier=getattr(modeleMetier,self.monNomDeClasseModeleMetier)
+ listArg=[]
+ for objAccas in factList :
+ #print objAccas.nom
+ for objAccasFils in objAccas.mc_liste :
+ #print (objAccasFils)
+ #print (objAccasFils.nom)
+ #print (objAccasFils.objPyxb)
+ listArg.append(objAccasFils.objPyxb)
+ # print (objAccasFils.objPyxb)
+ self.objPyxb=self.maClasseModeleMetier(*listArg)
+ #print (self.objPyxb.content())
+ #print ('fin MCLIST', self.objPyxb, self.nom,self)
+
+class X_JDC:
+# ----------
+
+ def __init__(self):
+ print ('--------- init du X_JDC')
+ self.monNomDeClasseModeleMetier=self.code
+ self.maClasseModeleMetier=getattr(modeleMetier,self.monNomDeClasseModeleMetier)
+ self.objPyxb=self.maClasseModeleMetier()
+
+ def ajoutEtapeAPyxb(self,etape):
+ # OK seulement si sequence (choice ? ...)
+ print ('----------------------------------------------------------------------------------------------je suis la')
+ self.objPyxb.append(etape.objPyxb)
+ self.toxml()
+
+ def toxml(self):
+ print(self.objPyxb.toDOM().toprettyxml())
+ print(self.objPyxb.toxml())
+
+
+
+if __name__ == "__main__":
+ print ('a faire')
from Accas import *
-# traiter le cas des tuples
# ds l init du SIMP il manque siValide et fenetreIhm
from mapDesTypes import dictSIMPEficasXML, dictSIMPXMLEficas
from mapDesTypes import dictFACTEficasXML, dictFACTXMLEficas
from mapDesTypes import dictPROCEficasXML, dictPROCXMLEficas
+from mapDesTypes import dictOPEREficasXML, dictOPERXMLEficas
+from mapDesTypes import dictBLOCEficasXML, dictBLOCXMLEficas
+from mapDesTypes import dicoPourCast
from mapDesTypes import listeParamDeTypeTypeAttendu, listeParamDeTypeStr, dicoPourCast
-from mapDesTypes import listeParamEnListeSiMax, listeParamTjsEnListe
-
+from mapDesTypes import listeParamTjsSequence, listeParamSelonType
# ------------------------------
self.dictArgsEficas['min']=int(self.dictArgsEficas['min'])
if 'max' in list(self.dictArgsEficas.keys()):
- if self.dictArgsEficas['max']== -1 : self.dictArgsEficas['max']="**"
- else : self.dictArgsEficas['max']=int(self.dictArgsEficas['max'])
+ if self.dictArgsEficas['max']== -1 : self.dictArgsEficas['max']="**"
+ else : self.dictArgsEficas['max']=int(self.dictArgsEficas['max'])
for param in list(self.dictArgsEficas.keys()):
if param in listeParamDeTypeStr :
# En 2.7 a revoir en 3 ? necessaire
self.nomObj=str(self.nom)
-
-
-
def getAccasEquivalent(self):
# ---------------------------
return self.nomObj, self.objAccas
# ---------------------------------------------------------
class objetComposeDefinitionAccas (objetDefinitionAccas):
# ---------------------------------------------------------
- def exploreArbre(self):
+ def exploreArbre(self,cata):
# --------------------------
liste=[]
for obj in self.content(): liste.append(obj)
# PNPNPN essayer de comprendre reverse ou non
for obj in liste:
- if hasattr(obj,'explore') : obj.explore ()
+ if hasattr(obj,'explore') : obj.explore(cata)
if hasattr(obj,'getAccasEquivalent') :
nom,objetAccas=obj.getAccasEquivalent()
self.dictArgsEficas[nom]=objetAccas
class monSIMP (efficas.T_SIMP, objetDefinitionAccas):
# ----------------------------------------------------
- def explore(self):
+ def explore(self,cata):
# --------------------
- # 2 arguments pour ne pas avoir a differencier les appels explore
+ #print ("je passe dans explore pour SIMP ", self.nom)
self.dictATraiter= dictSIMPXMLEficas
self.argumentXMLToEficas()
def argumentXMLToEficas(self):
# ----------------------------
+ #print self.nom
objetDefinitionAccas.argumentXMLToEficas(self)
- self.convertitEnListes()
- self.convertitLesTypes()
- def estListe(self):
+ if self.attendTuple() :
+ #nbDElts=type(listeDElt[0])
+ print self.nomTypeAttendu
+
+
+ self.traiteLesSequences()
+ print (self.dictArgsEficas)
+ #self.convertitLesTypes()
+
+ def attendListe(self):
# ---------------
- if hasattr(self,'max') and self.max > 1 : return True
- else : return False
+ if 'max' in self.dictArgsEficas :
+ if self.dictArgsEficas['max'] > 1 : return True
+ if self.dictArgsEficas['max'] == "**" : return True
+ return False
def attendTuple(self):
- # -------------------
+ # -----------------
+ if self.dictArgsEficas['typ'] != 'tuple' : return False
+ return True
+
+ def attendTXM(self):
+ # ----------------
+ if self.dictArgsEficas['typ'] == 'TXM' : return True
return False
+
- def convertitEnListes(self):
- # ------------------------
- # Cas des Tuples non traites
- for param in listeParamTjsEnListe :
+ def traiteLesSequences(self):
+ # ---------------------------
+ listeDeListe=self.attendListe()
+ for param in listeParamTjsSequence :
if param in self.dictArgsEficas :
- if not self.attendTuple() :
- self.dictArgsEficas[param]=[self.dictArgsEficas[param],]
-
- if self.estListe() :
- for param in listeParamEnListeSiMax:
- if param in self.dictArgsEficas :
- if not self.attendTuple() :
- self.dictArgsEficas[param]=[self.dictArgsEficas[param],]
+ if listeDeListe == False:
+ listeDElt=self.dictArgsEficas[param][0].content()
+ listeRetour=self.convertitListeDsLeBonType(listeDElt)
+ self.dictArgsEficas[param]=listeRetour
+ else :
+ listeResultat=[]
+ # on transforme en liste pour traiter chaque elt de la liste
+ for i in range(len(self.dictArgsEficas[param])):
+ if self.dictArgsEficas[param][i].typesimple != None :
+ lesElts=self.dictArgsEficas[param][i].typesimple
+ else :
+ lesElts=self.dictArgsEficas[param][i].content()
+ if (not(isinstance(lesElts,list)) and not (isinstance(lesElts,tuple))):
+ lesElts=(lesElts,)
+ lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
+ lesEltsTransformes=self.convertitListeDsLeBonType(lesElts)
+ listeResultat.append(lesEltsTransformes)
+ self.dictArgsEficas[param]=listeResultat
+ #print ('fin de traiteLesSequences pour', self.nom, ' param :', param, 'listeResultat',self.dictArgsEficas[param])
+
+
+ def convertitListeDsLeBonType(self,listeDElt):
+ # -------------------------------------------
+ # Cas des Tuples non traites
+ typeAttendu = self.dictArgsEficas['typ']
+ if typeAttendu in list(dicoPourCast.keys()):
+ nouvelleListe=[]
+ castDsLeTypeAttendu=dicoPourCast[typeAttendu]
+ for valeurACaster in listeDElt :
+ val=castDsLeTypeAttendu(valeurACaster)
+ nouvelleListe.append(val)
+ return nouvelleListe
+ elif self.attendTuple() :
+ nbDElts=type(listeDElt[0]).n
+
+ else : return listeDElt
+
+
def convertitLesTypes(self):
# ------------------------
# Cas des Tuples non traites
+ # Cas des fonctions utilisateurs non traites
typeAttendu = self.dictArgsEficas['typ']
if typeAttendu in list(dicoPourCast.keys()):
+ castDsLeTypeAttendu=dicoPourCast[typeAttendu]
for param in listeParamDeTypeTypeAttendu :
if param in list(self.dictArgsEficas.keys()):
- castDsLeTypeAttendu=dicoPourCast[typeAttendu]
+ if param in listeParamEnListeSelonType or param in listeParamTjsEnListe :
+ print ('typeAttendu',typeAttendu)
+ print (self.dictArgsEficas[param])
+ print (self.dictArgsEficas[param].content())
+ print (self.dictArgsEficas[param].content())
+ return
valeurACaster=self.dictArgsEficas[param].typesimple
if not isinstance(valeurACaster, (list, tuple)) :
val=castDsLeTypeAttendu(valeurACaster)
# -------------------------------------------------------
class monFACT(efficas.T_FACT, objetComposeDefinitionAccas):
# -------------------------------------------------------
- def explore(self):
+ def explore(self,cata):
# --------------------
- print "je passe dans explore pour FACT ", self.nom
+ #print "je passe dans explore pour FACT ", self.nom
self.dictATraiter= dictFACTXMLEficas
self.argumentXMLToEficas()
- self.exploreArbre()
+ self.exploreArbre(cata)
self.objAccas=A_FACT.FACT(**self.dictArgsEficas)
print "je passe dans explore pour PROC ", self.nom
self.dictATraiter= dictPROCXMLEficas
self.argumentXMLToEficas()
- self.exploreArbre()
+ self.exploreArbre(cata)
self.dictArgsEficas['op']=None
self.objAccas=A_PROC.PROC(**self.dictArgsEficas)
setattr(cata, self.nomObj,self.objAccas)
cata.contexteXML[self.nomObj]=self.objAccas
+# ---------------------------------------------------------
+class monOPER(efficas.T_OPER, objetComposeDefinitionAccas):
+# ---------------------------------------------------------
+ def explore(self,cata):
+# ------------------------
+ print "je passe dans explore pour OPER", self.nom
+ self.cata=cata
+ self.dictATraiter= dictOPERXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+
+ textCreationClasse='class '+str(self.typeCree)+'(ASSD): pass\n'
+ exec(textCreationClasse,globals())
+ maClasseCreee=globals()[self.typeCree]
+ self.dictArgsEficas['sd_prod'] = maClasseCreee
+ cata.contexteXML[self.typeCree] = maClasseCreee
+
+ self.dictArgsEficas['op'] = None
+ self.objAccas=A_OPER.OPER(**self.dictArgsEficas)
+ setattr(cata, self.nomObj,self.objAccas)
+ cata.contexteXML[self.nomObj] = self.objAccas
+
+# ---------------------------------------------------------
+class monBLOC(efficas.T_BLOC, objetComposeDefinitionAccas):
+# ---------------------------------------------------------
+ def explore(self,cata):
+# ------------------------
+ print ('je passe dans explore pour BLOC', self.nom)
+ self.cata=cata
+ self.dictATraiter= dictBLOCXMLEficas
+ self.argumentXMLToEficas()
+ self.exploreArbre(cata)
+ self.objAccas=A_BLOC.BLOC(**self.dictArgsEficas)
+ setattr(cata, self.nomObj,self.objAccas)
+ cata.contexteXML[self.nomObj] = self.objAccas
+
# ------------------------------
class monCata(efficas.T_cata):
# ------------------------------
efficas.T_SIMP._SetSupersedingClass(monSIMP)
efficas.T_FACT._SetSupersedingClass(monFACT)
efficas.T_PROC._SetSupersedingClass(monPROC)
+efficas.T_OPER._SetSupersedingClass(monOPER)
+efficas.T_BLOC._SetSupersedingClass(monBLOC)
efficas.T_cata._SetSupersedingClass(monCata)
if __name__ == "__main__":
# print dir(efficas.T_SIMP)
#xml = open('cata_test1.xml').read()
- xml = open('Cata_MED_FAM_test.xml').read()
+ xml = open('cata.xml').read()
SchemaMed = efficas.CreateFromDocument(xml)
SchemaMed.exploreCata()
#SchemaMed.dumpXSD()
self.inhibeExpand=True
self.expandItem(self.racine)
self.inhibeExpand=False
- #print "self.editor.afficheCommandesPliees", self.editor.afficheCommandesPliees
+ #print ("self.editor.maConfiguration.afficheCommandesPliees", self.editor.maConfiguration.afficheCommandesPliees)
if self.racine.children !=[] :
#self.editor.initSplitterSizes(3)
- if self.editor.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
+ if self.editor.maConfiguration.afficheCommandesPliees : self.racine.children[0].plieToutEtReaffiche()
else : self.racine.children[0].deplieToutEtReaffiche()
self.racine.children[0].fenetre.donnePremier()
else :
item.select()
def handleExpandedItem(self,item):
- #print "handleExpandedItem pour ", item.item.nom, self.inhibeExpand
+ #print ("handleExpandedItem pour ", item.item.nom, self.inhibeExpand)
#import traceback
#traceback.print_stack()
if self.inhibeExpand == True : return
estUneFeuille=(isinstance(item,composimp.Node))
# il faut afficher le parent
if estUneFeuille : itemParent.affichePanneau()
- elif self.editor.afficheCommandesPliees : itemParent.plieToutEtReafficheSaufItem(item)
+ elif self.editor.maConfiguration.afficheCommandesPliees : itemParent.plieToutEtReafficheSaufItem(item)
else : itemParent.affichePanneau()
try :
fr = item.item.getFr()
- if self.editor: self.editor.afficheCommentaire(six.text_type(fr))
+ chaineDecoupee= fr.split('\n')
+ if len(chaineDecoupee) > 3 :
+ txt='\n'.join(chaineDecoupee[0:2])+'...\nfull help : double clicked on validity chip of '+ str(item.item.nom)+ ' in central widget'
+ else : txt=fr
+
+ if self.editor:
+ self.editor.afficheCommentaire(six.text_type(txt))
except:
pass
item.select()
def afficheCeNiveau(self):
- #print ('afficheCeNiveau pour ', self.item.nom, self.item.getLabelText())
+ print ('afficheCeNiveau pour ', self.item.nom, self.item.getLabelText())
for indiceWidget in range(self.editor.widgetCentraleLayout.count()):
widget=self.editor.widgetCentraleLayout.itemAt(indiceWidget)
self.editor.widgetCentraleLayout.removeItem(widget)
self.inhibeExpand=False
def plieToutEtReaffiche(self):
- if self.item.getNom() == 'RAFFINEMENT' :
- import traceback
- traceback.print_stack()
- print (a)
+ #print ('plieToutEtReaffiche', self.item.getNom())
from InterfaceQT4 import compojdc
if (isinstance(self, compojdc.Node)) : self.affichePanneau(); return
self.inhibeExpand=True
def setPlie(self):
#print "je mets inhibeExpand a true dans setPlie"
- #print "je suis dans plieTout", self.item.getNom()
+ #print ("je suis dans plieTout", self.item.getNom())
from . import compojdc
if self.fenetre == self.editor.fenetreCentraleAffichee and isinstance(self.treeParent,compojdc.Node):
return
self.nombreDeBoutonParLigne=0
self.translatorFichier=None
self.dicoImages= {}
+ self.dicoIcones= {}
+ self.afficheCommandesPliees = True
self.simpleClic= False
self.afficheOptionnelVide=False
self.afficheListesPliees=True
self.widgetOptionnel=None
self.fenetreCentraleAffichee=None
self.dejaDansPlieTout=False
- self.afficheCommandesPliees = True
self.listeDesListesOuvertes=set()
self.afficheListesPliees=True
if appli!=None and hasattr(appli,"statusBar"): self.sb = appli.statusBar()
#self.affiche=self.appliEficas.maConfiguration.affiche
- if self.code in ['MAP','CARMELCND','PSEN'] : self.afficheCommandesPliees=False
- #if self.code in ['MAP','CARMELCND'] : self.afficheCommandesPliees=False
+ if self.code in ['MAP','CARMELCND','PSEN'] : self.editor.maConfiguration.afficheCommandesPliees=False
if self.code in ['MAP',]: self.fermeArbre()
# self.widgetTree.close()
# self.widgetTree=None
self.node_selected = []
self.deplier = True
self.message=''
+ self.afficheApresInsert=False
+ if self.maConfiguration.closeArbre : self.afficheApresInsert=True
if self.code in ['Adao','ADAO','MAP'] : self.afficheApresInsert=True
- else : self.afficheApresInsert=False
if self.code in ['TELEMAC',] : self.enteteQTree='premier'
else : self.enteteQTree='complet'
if self.code in ['Adao','ADAO','TELEMAC'] : self.affichePlie=True
self.appliEficas = appli
self.appli = appli
self.fichier = fichier
+ self.fichierComplet = fichier
self.jdc = jdc
self.first = True
self.jdc_item = None
self.setIconesFichier()
self.setIconesSalome()
self.setIconesGenerales()
- #self.setCommentaire()
+ self.setCommentaire()
self.setZoneInfo()
nodeCourrant=self.node.tree.currentItem()
if nodeCourrant==None: nodeCourrant=self.node.tree.racine
if self.name != None :
- plier=self.editor.afficheCommandesPliees
+ plier=self.editor.maConfiguration.afficheCommandesPliees
if nodeCourrant==self.node : nouveau=self.node.appendChild(self.name,'first',plier)
else : nouveau=nodeCourrant.appendBrother(self.name,plier=plier)
else :
#if self.editor.afficheApresInsert==True : nouveau.plieToutEtReaffiche()
if self.editor.afficheApresInsert == True :
#if self.editor.affichePlie==True: nouveau.plieToutEtReaffiche()
- if self.editor.afficheCommandesPliees ==True: nouveau.plieToutEtReaffiche()
+ if self.editor.maConfiguration.afficheCommandesPliees ==True: nouveau.plieToutEtReaffiche()
else : nouveau.deplieToutEtReaffiche()
nouveau.fenetre.donnePremier()
#nouveau.deplieToutEtReaffiche()
self.editor.splitter.addWidget(self.monOptionnel)
self.editor.ajoutOptionnel()
self.editor.inhibeSplitter=0
+ self.monOptionnel=self.editor.widgetOptionnel
self.afficheOptionnel()
spacerItem = QSpacerItem(21, 20, QSizePolicy.Expanding, QSizePolicy.Expanding)
#spacerItem = QSpacerItem(21, 20, QSizePolicy.Preferred, QSizePolicy.Preferred)
def setDepliePourNode(self):
noeudCourant=self.node.tree.itemCourant
noeudCourant.setDeplieChildren()
+ if self.editor.fenetreCentraleAffichee == noeudCourant.fenetre : return
noeudCourant.afficheCeNiveau()
pass
def getPanel (self):
- print ('surcharge ds getPanel')
+ #print ('surcharge ds getPanel')
pass
def __init__(self,node,editor,definition,obj):
self.listeAffichageWidget=[]
Groupe.__init__(self,node,editor,None,definition,obj,1,self)
+ from InterfaceQT4 import composimp
+ if isinstance(self.node ,composimp.Node):
+ widget=self.node.getPanelGroupe(self,self.maCommande)
self.afficheOptionnel()
self.inhibe=False
if self.appliEficas.ssIhm == False : self.appliEficas.setWindowTitle(self.titre)
self.appliEficas.titre=self.titre
self.QWParent.titre=self.titre
+ #self.dumpXsd()
def importCata(self,cata):
def dumpToXml(self):
pass
#from Efi2Xsd import readerEfficas
- #print ('in dumpToXml')
#newSchema= xml = open('Cata_MED_FAM.xml').read()
#SchemaMed = efficas.CreateFromDocument(xml)
#SchemaMed.alimenteCata(self.cata)
+ def dumpXsd(self):
+ from Efi2Xsd.dumpToXsd import dumpXsd
+ print ('dumpToXsd : ', self)
+ dumpXsd(self)