From: pascale.noyret Date: Thu, 5 Apr 2018 08:51:06 +0000 (+0200) Subject: maj du 5 avril X-Git-Tag: V8_5_0rc2a2~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=11dbef23bf3b42666a1ab2610e62353871869847;p=modules%2Feficas.git maj du 5 avril --- diff --git a/Atmo/Cata_V0.py b/Atmo/Cata_V0.py deleted file mode 100755 index 6e841feb..00000000 --- a/Atmo/Cata_V0.py +++ /dev/null @@ -1,79 +0,0 @@ -# -*- 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 . - -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), - ), - ), - -) diff --git a/Atmo/cata_V0.py b/Atmo/cata_V0.py new file mode 100755 index 00000000..91f3589a --- /dev/null +++ b/Atmo/cata_V0.py @@ -0,0 +1,85 @@ +# -*- 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 . + +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'), + ), +) diff --git a/Atmo/cata_atmo_test1.py b/Atmo/cata_atmo_test1.py new file mode 100755 index 00000000..e846e382 --- /dev/null +++ b/Atmo/cata_atmo_test1.py @@ -0,0 +1,43 @@ +# -*- 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 . + +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'), + ), + ), +) + diff --git a/Atmo/cata_reduit.py b/Atmo/cata_reduit.py new file mode 100755 index 00000000..7c2ec736 --- /dev/null +++ b/Atmo/cata_reduit.py @@ -0,0 +1,35 @@ +# -*- 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 . + +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'), +) diff --git a/Atmo/creeAtmo.py b/Atmo/creeAtmo.py new file mode 100644 index 00000000..9301c918 --- /dev/null +++ b/Atmo/creeAtmo.py @@ -0,0 +1,3 @@ +import atmo_reduit +monElt=atmo_reduit.Wind_Speed(3) +monAtmo=atmo_reduit.Atmos(monElt) diff --git a/Atmo/modele_atmo_reduit.xsd b/Atmo/modele_atmo_reduit.xsd new file mode 100755 index 00000000..e6446526 --- /dev/null +++ b/Atmo/modele_atmo_reduit.xsd @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/Atmo/modele_atmo_test1.xsd b/Atmo/modele_atmo_test1.xsd index b765f8d0..65e701a7 100755 --- a/Atmo/modele_atmo_test1.xsd +++ b/Atmo/modele_atmo_test1.xsd @@ -32,13 +32,13 @@ - + - + diff --git a/Atmo/prefs_Atmo.py b/Atmo/prefs_Atmo.py index 57481bd9..12f59438 100644 --- a/Atmo/prefs_Atmo.py +++ b/Atmo/prefs_Atmo.py @@ -34,8 +34,9 @@ lang='fr' 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 diff --git a/Efi2Xsd/mapDesTypes.py b/Efi2Xsd/mapDesTypes.py index 50d6d81a..e5547d4a 100755 --- a/Efi2Xsd/mapDesTypes.py +++ b/Efi2Xsd/mapDesTypes.py @@ -1,3 +1,22 @@ +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 = {} @@ -10,7 +29,7 @@ def inverseDico(dicoSource) : dicoInverse[elt][att]=clef return dicoInverse -dictSIMPEficasXML= { 'typ' : 'typeAttendu', +dictSIMPEficasXML= { 'typ' : 'nomTypeAttendu', 'statut' : 'statut', 'min' : 'minOccurences', 'max' : 'maxOccurences', @@ -37,11 +56,21 @@ dictFACTEficasXML = { 'statut' : 'statut', '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'), @@ -56,12 +85,16 @@ dictPROCEficasXML = { 'nom' : 'nom', 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 diff --git a/Efi2Xsd/mesAgregats.py b/Efi2Xsd/mesAgregats.py new file mode 100755 index 00000000..19d55a1a --- /dev/null +++ b/Efi2Xsd/mesAgregats.py @@ -0,0 +1,92 @@ +#!/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') diff --git a/Efi2Xsd/readerEfficas.py b/Efi2Xsd/readerEfficas.py index 3d169fc3..5e0112a9 100755 --- a/Efi2Xsd/readerEfficas.py +++ b/Efi2Xsd/readerEfficas.py @@ -9,16 +9,17 @@ sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..'))) 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 # ------------------------------ @@ -53,8 +54,8 @@ class objetDefinitionAccas: 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 : @@ -63,9 +64,6 @@ class objetDefinitionAccas: # En 2.7 a revoir en 3 ? necessaire self.nomObj=str(self.nom) - - - def getAccasEquivalent(self): # --------------------------- return self.nomObj, self.objAccas @@ -74,7 +72,7 @@ class objetDefinitionAccas: # --------------------------------------------------------- class objetComposeDefinitionAccas (objetDefinitionAccas): # --------------------------------------------------------- - def exploreArbre(self): + def exploreArbre(self,cata): # -------------------------- liste=[] for obj in self.content(): liste.append(obj) @@ -82,7 +80,7 @@ class objetComposeDefinitionAccas (objetDefinitionAccas): # 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 @@ -91,9 +89,9 @@ class objetComposeDefinitionAccas (objetDefinitionAccas): 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() @@ -102,42 +100,96 @@ class monSIMP (efficas.T_SIMP, objetDefinitionAccas): 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) @@ -151,13 +203,13 @@ class monSIMP (efficas.T_SIMP, objetDefinitionAccas): # ------------------------------------------------------- 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) @@ -169,13 +221,49 @@ class monPROC(efficas.T_PROC, objetComposeDefinitionAccas): 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): # ------------------------------ @@ -196,6 +284,8 @@ 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__": @@ -203,7 +293,7 @@ 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() diff --git a/InterfaceQT4/browser.py b/InterfaceQT4/browser.py index 67eda81b..dea6627f 100644 --- a/InterfaceQT4/browser.py +++ b/InterfaceQT4/browser.py @@ -78,10 +78,10 @@ class JDCTree( QTreeWidget,GereRegles ): 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 : @@ -135,7 +135,7 @@ class JDCTree( QTreeWidget,GereRegles ): 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 @@ -169,7 +169,7 @@ class JDCTree( QTreeWidget,GereRegles ): 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() @@ -182,7 +182,13 @@ class JDCTree( QTreeWidget,GereRegles ): 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() @@ -337,7 +343,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): 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) @@ -852,10 +858,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): 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 @@ -876,7 +879,7 @@ class JDCNode(QTreeWidgetItem,GereRegles): 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 diff --git a/InterfaceQT4/configuration.py b/InterfaceQT4/configuration.py index 977694e4..ccf73063 100644 --- a/InterfaceQT4/configuration.py +++ b/InterfaceQT4/configuration.py @@ -116,6 +116,8 @@ class configBase(object): self.nombreDeBoutonParLigne=0 self.translatorFichier=None self.dicoImages= {} + self.dicoIcones= {} + self.afficheCommandesPliees = True self.simpleClic= False self.afficheOptionnelVide=False self.afficheListesPliees=True diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index fc82e638..37811e64 100755 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -76,7 +76,6 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): 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() @@ -93,8 +92,7 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): #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 @@ -109,8 +107,9 @@ class JDCEditor(JDCEditorSsIhm,Ui_baseWidget,QWidget): 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 diff --git a/InterfaceQT4/editorSsIhm.py b/InterfaceQT4/editorSsIhm.py index 3b15c280..13df2807 100755 --- a/InterfaceQT4/editorSsIhm.py +++ b/InterfaceQT4/editorSsIhm.py @@ -63,6 +63,7 @@ class JDCEditorSsIhm : self.appliEficas = appli self.appli = appli self.fichier = fichier + self.fichierComplet = fichier self.jdc = jdc self.first = True self.jdc_item = None diff --git a/InterfaceQT4/feuille.py b/InterfaceQT4/feuille.py index f6bd6526..d3800d89 100644 --- a/InterfaceQT4/feuille.py +++ b/InterfaceQT4/feuille.py @@ -77,7 +77,7 @@ class Feuille(QWidget,ContientIcones,SaisieValeur,FacultatifOuOptionnel): self.setIconesFichier() self.setIconesSalome() self.setIconesGenerales() - #self.setCommentaire() + self.setCommentaire() self.setZoneInfo() diff --git a/InterfaceQT4/monChoixCommande.py b/InterfaceQT4/monChoixCommande.py index 168a9449..5ebb70c4 100644 --- a/InterfaceQT4/monChoixCommande.py +++ b/InterfaceQT4/monChoixCommande.py @@ -134,7 +134,7 @@ class MonChoixCommande(Ui_ChoixCommandes,QWidget): 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 : @@ -144,7 +144,7 @@ class MonChoixCommande(Ui_ChoixCommandes,QWidget): #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() diff --git a/InterfaceQT4/monWidgetCommande.py b/InterfaceQT4/monWidgetCommande.py index b4295874..b28021e4 100644 --- a/InterfaceQT4/monWidgetCommande.py +++ b/InterfaceQT4/monWidgetCommande.py @@ -115,6 +115,7 @@ class MonWidgetCommande(Ui_WidgetCommande,Groupe): 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) diff --git a/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py b/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py index d23b6487..88a80fd1 100644 --- a/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py +++ b/InterfaceQT4/monWidgetCommandeDeplie1Niveau.py @@ -94,6 +94,7 @@ class MonWidgetCommandeDeplie1Niveau(MonWidgetCommande): def setDepliePourNode(self): noeudCourant=self.node.tree.itemCourant noeudCourant.setDeplieChildren() + if self.editor.fenetreCentraleAffichee == noeudCourant.fenetre : return noeudCourant.afficheCeNiveau() pass @@ -142,5 +143,5 @@ class MonWidgetCommandeDeplie1Niveau(MonWidgetCommande): def getPanel (self): - print ('surcharge ds getPanel') + #print ('surcharge ds getPanel') pass diff --git a/InterfaceQT4/monWidgetNiveauFact.py b/InterfaceQT4/monWidgetNiveauFact.py index 8cb60966..2bfc28e7 100644 --- a/InterfaceQT4/monWidgetNiveauFact.py +++ b/InterfaceQT4/monWidgetNiveauFact.py @@ -45,6 +45,9 @@ class MonWidgetNiveauFact(Ui_WidgetNiveauFact,Groupe): 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 diff --git a/InterfaceQT4/readercata.py b/InterfaceQT4/readercata.py index 348daf1a..a1cec75d 100644 --- a/InterfaceQT4/readercata.py +++ b/InterfaceQT4/readercata.py @@ -230,6 +230,7 @@ class ReaderCata (ReaderCataCommun): 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): @@ -343,10 +344,13 @@ class ReaderCata (ReaderCataCommun): 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)