From: pascale.noyret Date: Thu, 24 Jun 2021 12:17:36 +0000 (+0200) Subject: creation de la branche web X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7167d2bb97502024dc68cae471a53657259c3561;p=tools%2Feficas.git creation de la branche web --- diff --git a/Accas/CMakeLists.txt b/Accas/CMakeLists.txt deleted file mode 100644 index e3ce0580..00000000 --- a/Accas/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py - PATTERN CVS EXCLUDE - ) - - -### Local Variables: -### mode: cmake -### End: diff --git a/Editeur/CMakeLists.txt b/Editeur/CMakeLists.txt deleted file mode 100644 index 3be146e4..00000000 --- a/Editeur/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 2007 - 2012 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python, texte et images du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py PATTERN *.txt PATTERN *.gif PATTERN *.png PATTERN *.ppm - PATTERN CMakeLists.txt EXCLUDE - PATTERN Patrons EXCLUDE - PATTERN CVS EXCLUDE - ) - -### Local Variables: -### mode: cmake -### End: diff --git a/Editeur/Patrons/ASTER/AnalyseModale.salome.comm b/Editeur/Patrons/ASTER/AnalyseModale.salome.comm deleted file mode 100644 index 898d5715..00000000 --- a/Editeur/Patrons/ASTER/AnalyseModale.salome.comm +++ /dev/null @@ -1,64 +0,0 @@ -DEBUT(); - -# 1 - MISE EN DONNEES : -# LECTURE DU MAILLAGE MED - -MAIL=LIRE_MAILLAGE(UNITE=21, - FORMAT='MED',); -# -# DEFINITION DES ELEMENTS FINIS UTILISES - -MODELE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); -# -# DEFINITION DU MATERIAU UTILISE - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.1E11, - NU=0.3, - RHO=7800.0,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - MATER=ACIER,),); - -# -# DEFINITION DES CONDITIONS AUX LIMITES - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODELE, - DDL_IMPO=_F(GROUP_MA='ABB1A1', - DX=0.0, - DY=0.0, - DZ=0.0,),); - -# 2 - CALCUL DES CINQ PREMIERS MODES PROPRES -# -# CALCUL DES MATRICES ASSEMBLEES K ET M - -MACRO_MATR_ASSE(MODELE=MODELE, - CHAM_MATER=CHMAT, - CHARGE=BLOQUAGE, - NUME_DDL=CO('NUMEDDL'), - MATR_ASSE=(_F(MATRICE=CO('RIGIDITE'), - OPTION='RIGI_MECA',), - _F(MATRICE=CO('MASSE'), - OPTION='MASS_MECA',),),); -# - -MODES=MODE_ITER_SIMULT(MATR_A=RIGIDITE, - MATR_B=MASSE, - CALC_FREQ=_F( - OPTION='PLUS_PETITE', - NMAX_FREQ=5,),); -# -# ECRITURE DES MODES AU FORMAT MED - -IMPR_RESU(MODELE=MODELE, - FORMAT='MED', - RESU=_F(MAILLAGE=MAIL, - RESULTAT=MODES, - NOM_CHAM='DEPL',),); - -FIN(); -# diff --git a/Editeur/Patrons/ASTER/elasticite.salome.comm b/Editeur/Patrons/ASTER/elasticite.salome.comm deleted file mode 100644 index 454762be..00000000 --- a/Editeur/Patrons/ASTER/elasticite.salome.comm +++ /dev/null @@ -1,55 +0,0 @@ -DEBUT(); - -MA=DEFI_MATERIAU(ELAS=_F(E=210000000000, - NU=0.3,),); - - - -MAIL=LIRE_MAILLAGE(UNITE=21, - FORMAT='MED', - INFO_MED=2,); - -MODE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - PHENOMENE='MECANIQUE', - MODELISATION= '3D',),); - - - -MATE=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - MATER=MA,),); - -CHAR=AFFE_CHAR_MECA(MODELE=MODE, - FACE_IMPO=( - _F(GROUP_MA='ABB1A1', - DX=0, - DY=0, - DZ=0,),), - PRES_REP=( - _F(GROUP_MA='CDD1C1', - PRES=10000,),),); - -RESU=MECA_STATIQUE(MODELE=MODE, - CHAM_MATER=MATE, - EXCIT=_F(CHARGE=CHAR,),); - -RESU=CALC_ELEM(reuse =RESU, - MODELE=MODE, - CHAM_MATER=MATE, - RESULTAT=RESU, - OPTION=('SIGM_ELNO_DEPL','EQUI_ELNO_SIGM',), - EXCIT=_F( - CHARGE=CHAR,),); - -RESU=CALC_NO(reuse =RESU, - RESULTAT=RESU, - OPTION=('SIGM_NOEU_DEPL', 'EQUI_NOEU_SIGM', ),); - -IMPR_RESU(FORMAT='MED', - UNITE=80, - RESU=_F(MAILLAGE=MAIL, - RESULTAT=RESU, - NOM_CHAM=('SIGM_NOEU_DEPL','EQUI_NOEU_SIGM','DEPL',),),); - -FIN(); \ No newline at end of file diff --git a/Editeur/Patrons/ASTER/limaillage.comm b/Editeur/Patrons/ASTER/limaillage.comm deleted file mode 100644 index bb12c443..00000000 --- a/Editeur/Patrons/ASTER/limaillage.comm +++ /dev/null @@ -1,11 +0,0 @@ - - -DEBUT(CODE=_F(NOM='VIDE', - NIV_PUB_WEB='INTERNET',),); -# - -MA=LIRE_MAILLAGE(); - - -FIN(); -# diff --git a/Editeur/Patrons/ASTER/modes_3D.comm b/Editeur/Patrons/ASTER/modes_3D.comm deleted file mode 100644 index aafe1f2a..00000000 --- a/Editeur/Patrons/ASTER/modes_3D.comm +++ /dev/null @@ -1,57 +0,0 @@ - -# PATRON -# ANALYSE MODALE -# 3D - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MODELE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); -# MATERIAU - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.1E11, - NU=0.3, - RHO=7800.0,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - MATER=ACIER,),); - -# CONDITIONS AUX LIMITES ET CHARGEMENT -# CONDITIONS AUX LIMITES - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODELE, - DDL_IMPO=_F(GROUP_MA='ENCAST', - LIAISON='ENCASTRE',),); -# CALCUL DES MATRICES ASSEMBLEES K ET M - -MACRO_MATR_ASSE(MODELE=MODELE, - CHAM_MATER=CHMAT, - CHARGE=BLOQUAGE, - NUME_DDL=CO('NUMEDDL'), - MATR_ASSE=(_F(MATRICE=CO('RIGIDITE'), - OPTION='RIGI_MECA',), - _F(MATRICE=CO('MASSE'), - OPTION='MASS_MECA',),),); -# CALCUL DES CINQ PREMIERS MODES - -MODES=MODE_ITER_SIMULT(MATR_A=RIGIDITE, - MATR_B=MASSE, - CALC_FREQ=_F( - OPTION='PLUS_PETITE', - NMAX_FREQ=5,),); -# ECRITURE DES MODES AU FORMAT GMSH - -IMPR_RESU(MODELE=MODELE, - FORMAT='GMSH', - UNITE=19, - RESU=_F(MAILLAGE=MAIL, - RESULTAT=MODES, - NOM_CHAM='DEPL',),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/modes_pou.comm b/Editeur/Patrons/ASTER/modes_pou.comm deleted file mode 100644 index fc72e239..00000000 --- a/Editeur/Patrons/ASTER/modes_pou.comm +++ /dev/null @@ -1,63 +0,0 @@ - -# PATRON -# ANALYSE MODALE -# POUTRE - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MODELE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); -# MATERIAU - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.1E11, - NU=0.3, - RHO=7800.0,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - MATER=ACIER,),); - -CARELEM=AFFE_CARA_ELEM(MODELE=MODELE, - POUTRE=_F(GROUP_MA='OBJET', - SECTION='CERCLE', - CARA=('R','EP',), - VALE=(1.0,0.01,),),); -# CONDITIONS AUX LIMITES - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODELE, - DDL_IMPO=_F(GROUP_MA='ENCAST', - LIAISON='ENCASTRE',),); -#MATRICES ASSEMBLEES K, M -# - -MACRO_MATR_ASSE(MODELE=MODELE, - CHAM_MATER=CHMAT, - CARA_ELEM=CARELEM, - CHARGE=BLOQUAGE, - NUME_DDL=CO('NUMEDDL'), - MATR_ASSE=(_F(MATRICE=CO('RIGIDITE'), - OPTION='RIGI_MECA',), - _F(MATRICE=CO('MASSE'), - OPTION='MASS_MECA',),),); -#5 PREMIERS MODES - -MODES=MODE_ITER_SIMULT(MATR_A=RIGIDITE, - MATR_B=MASSE, - CALC_FREQ=_F( - OPTION='PLUS_PETITE', - NMAX_FREQ=5,),); -# MODES AU FORMAT GMSH - -IMPR_RESU(MODELE=MODELE, - FORMAT='GMSH', - UNITE=19, - RESU=_F(MAILLAGE=MAIL, - RESULTAT=MODES, - NOM_CHAM='DEPL',),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/statlin_3D.comm b/Editeur/Patrons/ASTER/statlin_3D.comm deleted file mode 100644 index 39f7057f..00000000 --- a/Editeur/Patrons/ASTER/statlin_3D.comm +++ /dev/null @@ -1,57 +0,0 @@ - -# PATRON -# ANALYSE STATIQUE -# 3D - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MAIL=DEFI_GROUP(reuse =MAIL, - MAILLAGE=MAIL, - CREA_GROUP_MA=_F(NOM='TOUT', - TOUT='OUI',),); - -MODMECA=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='TOUT', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.E11, - NU=0.3,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - MATER=ACIER,),); -# CONDITIONS AUX LIMITES ET CHARGEMENT -#POINT A : ENCASTREMENT - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODMECA, - DDL_IMPO=_F(GROUP_MA='ENCAST', - LIAISON='ENCASTRE',),); -#POINT B : FORCE IMPOSEE - -CHARGT=AFFE_CHAR_MECA(MODELE=MODMECA, - FORCE_NODALE=_F(GROUP_NO='PB', - FY=1000.0,),); -# RESOLUTION DU PROBLEME ELASTIQUE - -RESU1=MECA_STATIQUE(MODELE=MODMECA, - CHAM_MATER=CHMAT, - EXCIT=(_F(CHARGE=BLOQUAGE,), - _F(CHARGE=CHARGT,),),); -# CALCUL DES EFFORTS - -RESU1=CALC_ELEM(reuse =RESU1, - RESULTAT=RESU1, - OPTION='EFGE_ELNO_DEPL',); -# RESULTATS FORMAT GMSH - -IMPR_RESU(MODELE=MODMECA, - FORMAT='GMSH', - RESU=_F(MAILLAGE=MAIL, - RESULTAT=RESU1, - NOM_CHAM=('DEPL','EFGE_ELNO_DEPL',),),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/statlin_pou.comm b/Editeur/Patrons/ASTER/statlin_pou.comm deleted file mode 100644 index 0dd06eb4..00000000 --- a/Editeur/Patrons/ASTER/statlin_pou.comm +++ /dev/null @@ -1,70 +0,0 @@ - -# PATRON -# ANALYSE STATIQUE -# POUTRE - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MAIL=DEFI_GROUP(reuse =MAIL, - MAILLAGE=MAIL, - CREA_GROUP_MA=_F(NOM='TOUT', - TOUT='OUI',),); - -MODMECA=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='TOUT', - PHENOMENE='MECANIQUE', - MODELISATION='POU_D_T',),); - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.E10, - NU=0.3,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(TOUT='OUI', - MATER=ACIER,),); -R1 = 1.0; - -EP1 = 0.001; - - -CARA_POU=AFFE_CARA_ELEM(MODELE=MODMECA, - POUTRE=_F(GROUP_MA='TOUT', - SECTION='CERCLE', - CARA=('R','EP',), - VALE=(R1,EP1,),),); - -# CONDITIONS AUX LIMITES ET CHARGEMENT - -#POINT A : ENCASTREMENT - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODMECA, - DDL_IMPO=_F(GROUP_NO='PA', - LIAISON='ENCASTRE',),); -#POINT B : FORCE IMPOSEE - -CHARGT=AFFE_CHAR_MECA(MODELE=MODMECA, - FORCE_NODALE=_F(GROUP_NO='PB', - FY=1000.0,),); -# RESOLUTION DU PROBLEME ELASTIQUE - -RESU1=MECA_STATIQUE(MODELE=MODMECA, - CHAM_MATER=CHMAT, - CARA_ELEM=CARA_POU, - EXCIT=(_F(CHARGE=BLOQUAGE,), - _F(CHARGE=CHARGT,),),); -# CALCUL DES EFFORTS - -RESU1=CALC_ELEM(reuse =RESU1, - RESULTAT=RESU1, - OPTION='EFGE_ELNO_DEPL',); -# RESULTATS FORMAT GMSH - -IMPR_RESU(MODELE=MODMECA, - FORMAT='GMSH', - RESU=_F(MAILLAGE=MAIL, - RESULTAT=RESU1, - NOM_CHAM=('DEPL','EFGE_ELNO_DEPL',),),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/thermique.salome.comm b/Editeur/Patrons/ASTER/thermique.salome.comm deleted file mode 100644 index 61c6fa16..00000000 --- a/Editeur/Patrons/ASTER/thermique.salome.comm +++ /dev/null @@ -1,34 +0,0 @@ - - -DEBUT(); - -MESH=LIRE_MAILLAGE(UNITE=21, - FORMAT='MED',); - -MATER=DEFI_MATERIAU(THER=_F(LAMBDA=1.2,),); - -MODEL=AFFE_MODELE(MAILLAGE=MESH, - AFFE=_F(TOUT='OUI', - PHENOMENE='THERMIQUE', - MODELISATION='3D',),); - -MATFIELD=AFFE_MATERIAU(MAILLAGE=MESH, - AFFE=_F(TOUT='OUI', - MATER=MATER,),); - -LOADING=AFFE_CHAR_THER(MODELE=MODEL, - TEMP_IMPO=_F(GROUP_MA='Bloq', - TEMP=23.,), - FLUX_REP=_F(GROUP_MA='Press', - FLUN=2.,), - SOURCE=_F(GROUP_MA='Source', - SOUR=2.,),); - -TEMP=THER_LINEAIRE(MODELE=MODEL, - CHAM_MATER=MATFIELD, - EXCIT=_F(CHARGE=LOADING,),); - -IMPR_RESU(FORMAT='MED', - RESU=_F(RESULTAT=TEMP,),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/tradir_3D.comm b/Editeur/Patrons/ASTER/tradir_3D.comm deleted file mode 100644 index 41d17e57..00000000 --- a/Editeur/Patrons/ASTER/tradir_3D.comm +++ /dev/null @@ -1,72 +0,0 @@ - -# PATRON -# ANALYSE MODALE -# 3D - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MODELE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); -# MATERIAU - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.1E11, - NU=0.3, - RHO=7800.0,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - MATER=ACIER,),); -# CONDITIONS AUX LIMITES ET CHARGEMENT -# CONDITIONS AUX LIMITES - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODELE, - DDL_IMPO=_F(GROUP_MA='ENCAST', - LIAISON='ENCASTRE',),); -# CALCUL DES MATRICES ASSEMBLEES K ET M - -MACRO_MATR_ASSE(MODELE=MODELE, - CHAM_MATER=CHMAT, - CHARGE=BLOQUAGE, - NUME_DDL=CO('NUMEDDL'), - MATR_ASSE=(_F(MATRICE=CO('RIGIDITE'), - OPTION='RIGI_MECA',), - _F(MATRICE=CO('MASSE'), - OPTION='MASS_MECA',),),); -# CALCUL DES CINQ PREMIERS MODES - -MODES=MODE_ITER_SIMULT(MATR_A=RIGIDITE, - MATR_B=MASSE, - CALC_FREQ=_F( - OPTION='PLUS_PETITE', - NMAX_FREQ=5,),); -#CHARGEMENT - -EXCIT=AFFE_CHAR_MECA(MODELE=MODELE, - PRES_REP=_F(GROUP_MA='PRESSE', - PRES=100.e5,),); - -EXCEL=CALC_VECT_ELEM(OPTION='CHAR_MECA', - CHARGE=EXCIT,); - -EXCASS=ASSE_VECTEUR(VECT_ELEM=EXCEL, - NUME_DDL=NUMEDDL,); -OMEGA = 10.0; - - -SINU = FORMULE(VALE='sin(OMEGA*INST)', - NOM_PARA='INST',); -#CALCUL TRANSITOIRE - -TRADIR=DYNA_LINE_TRAN(MATR_MASS=MASSE, - MATR_RIGI=RIGIDITE, - NEWMARK=_F(), - EXCIT=_F(VECT_ASSE=EXCASS,), - INCREMENT=_F(PAS=.01, - INST_FIN=10.,),); - -FIN(); diff --git a/Editeur/Patrons/ASTER/tramod_3D.comm b/Editeur/Patrons/ASTER/tramod_3D.comm deleted file mode 100644 index 9a68bc5d..00000000 --- a/Editeur/Patrons/ASTER/tramod_3D.comm +++ /dev/null @@ -1,86 +0,0 @@ - -# PATRON -# ANALYSE MODALE -# 3D - -DEBUT(); -# MISE EN DONNEES - -MAIL=LIRE_MAILLAGE(); - -MODELE=AFFE_MODELE(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - PHENOMENE='MECANIQUE', - MODELISATION='3D',),); -# MATERIAU - -ACIER=DEFI_MATERIAU(ELAS=_F(E=2.1E11, - NU=0.3, - RHO=7800.0,),); - -CHMAT=AFFE_MATERIAU(MAILLAGE=MAIL, - AFFE=_F(GROUP_MA='OBJET', - MATER=ACIER,),); -# CONDITIONS AUX LIMITES ET CHARGEMENT -# CONDITIONS AUX LIMITES - -BLOQUAGE=AFFE_CHAR_MECA(MODELE=MODELE, - DDL_IMPO=_F(GROUP_MA='ENCAST', - LIAISON='ENCASTRE',),); -# CALCUL DES MATRICES ASSEMBLEES K ET M - -MACRO_MATR_ASSE(MODELE=MODELE, - CHAM_MATER=CHMAT, - CHARGE=BLOQUAGE, - NUME_DDL=CO('NUMEDDL'), - MATR_ASSE=(_F(MATRICE=CO('RIGIDITE'), - OPTION='RIGI_MECA',), - _F(MATRICE=CO('MASSE'), - OPTION='MASS_MECA',),),); - -P=POST_ELEM(MASS_INER=_F(TOUT='OUI', - GROUP_MA='M',),); -# CALCUL DES CINQ PREMIERS MODES - -MODES=MODE_ITER_SIMULT(MATR_A=RIGIDITE, - MATR_B=MASSE, - CALC_FREQ=_F( - OPTION='PLUS_PETITE', - NMAX_FREQ=5,),); -#CHARGEMENT - -EXCIT=AFFE_CHAR_MECA(MODELE=MODELE, - PRES_REP=_F(GROUP_MA='PRESSE', - PRES=100.e5,),); - -EXCEL=CALC_VECT_ELEM(OPTION='CHAR_MECA', - CHARGE=EXCIT,); - -EXCASS=ASSE_VECTEUR(VECT_ELEM=EXCEL, - NUME_DDL=NUMEDDL,); -OMEGA = 10.0; - - -SINU = FORMULE(VALE='sin(OMEGA*INST)', - NOM_PARA='INST',); -#PROJECTION - -MACRO_PROJ_BASE(BASE=MODES, - MATR_ASSE_GENE=(_F(MATRICE=CO('MASSPROJ'), - MATR_ASSE=MASSE,), - _F(MATRICE=CO('RIGIPROJ'), - MATR_ASSE=RIGIDITE,),), - VECT_ASSE_GENE=_F(VECTEUR=CO('EXCPROJ'), - VECT_ASSE=EXCASS,),); -#CALCUL TRANSITOIRE - -TRAMOD=DYNA_TRAN_MODAL(MASS_GENE=MASSPROJ, - RIGI_GENE=RIGIPROJ, - AMOR_REDUIT=(.02,.01,), - INCREMENT=_F(INST_INIT=0.0, - INST_FIN=10.0, - PAS=.001,), - EXCIT=_F(VECT_GENE=EXCPROJ, - FONC_MULT=SINU,),); - -FIN(); diff --git a/Editeur/Patrons/CMakeLists.txt b/Editeur/Patrons/CMakeLists.txt deleted file mode 100644 index a9788deb..00000000 --- a/Editeur/Patrons/CMakeLists.txt +++ /dev/null @@ -1,44 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Question : Doit-on installer le repertoire Patrons meme s'il est vide ? - -# Installation des fichiers d'aide : Open TURNS -#if (WITH_OPENTURNS) -# install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/OPENTURNS_STUDY -# DESTINATION ${CMAKE_INSTALL_PREFIX}/Editeur/Patrons -# FILES_MATCHING PATTERN *.comm -# PATTERN CVS EXCLUDE -# ) -#endif (WITH_OPENTURNS) - -# Installation des fichiers d'aide : Aster -if (WITH_ASTER) - install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/ASTER - DESTINATION ${CMAKE_INSTALL_PREFIX}/Editeur/Patrons - FILES_MATCHING PATTERN *.comm - PATTERN CVS EXCLUDE - ) -endif (WITH_ASTER) - -### Local Variables: -### mode: cmake -### End: diff --git a/Extensions/CMakeLists.txt b/Extensions/CMakeLists.txt deleted file mode 100644 index e3ce0580..00000000 --- a/Extensions/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py - PATTERN CVS EXCLUDE - ) - - -### Local Variables: -### mode: cmake -### End: diff --git a/Extensions/CreeTraductions/eficas.pro b/Extensions/CreeTraductions/eficas.pro deleted file mode 100644 index 58884b7b..00000000 --- a/Extensions/CreeTraductions/eficas.pro +++ /dev/null @@ -1,246 +0,0 @@ - convert/autre_parseur.py \ - convert/convert_ini.py \ - convert/convert_map.py \ - convert/convert_python.py \ - convert/parseur_python.py \ - convert/convert_TELEMAC.py \ - Editeur/analyse_catalogue_initial.py \ - Editeur/analyse_catalogue.py \ - Editeur/autre_analyse_cata.py \ - Editeur/basestyle.py \ - Editeur/catadesc.py \ - Editeur/comploader.py \ - Editeur/fontes.py \ - Editeur/import_code.py \ - Editeur/listePatrons.py \ - Editeur/Objecttreeitem.py \ - Editeur/session.py \ - Editeur/styles.py \ - Editeur/TroisDPal.py \ - Editeur/uiinfo.py \ - Extensions/commande_comm.py \ - Extensions/commentaire.py \ - Extensions/eficas_exception.py \ - Extensions/etape_niveau.py \ - Extensions/interpreteur_formule.py \ - Extensions/jdc_include.py \ - Extensions/jdc.py \ - Extensions/localisation.py \ - Extensions/mcnuplet.py \ - Extensions/niveau.py \ - Extensions/nuplet.py \ - Extensions/param2.py \ - Extensions/parametre_eval.py \ - Extensions/parametre.py \ - Extensions/pluginloader.py \ - generator/Formatage.py \ - generator/generator_aplat.py \ - generator/generator_dicoImbrique.py \ - generator/generator_dico.py \ - generator/generator_GroupMA.py \ - generator/generator_map.py \ - generator/generator_modification.py \ - generator/generator_python.py \ - generator/generator_vers3DSalome.py \ - Ihm/CONNECTOR.py \ - Ihm/I_A_CLASSER.py \ - Ihm/I_ASSD.py \ - Ihm/I_AVANT.py \ - Ihm/I_ENTITE.py \ - Ihm/I_ETAPE.py \ - Ihm/I_EVAL.py \ - Ihm/I_EXCLUS.py \ - Ihm/I_FONCTION.py \ - Ihm/I_FORM_ETAPE.py \ - Ihm/I_JDC_CATA.py \ - Ihm/I_JDC.py \ - Ihm/I_LASSD.py \ - Ihm/I_MACRO_ETAPE.py \ - Ihm/I_MCBLOC.py \ - Ihm/I_MCCOMPO.py \ - Ihm/I_MCFACT.py \ - Ihm/I_MCLIST.py \ - Ihm/I_MCSIMP.py \ - Ihm/I_OBJECT.py \ - Ihm/I_PRESENT_ABSENT.py \ - Ihm/I_PRESENT_PRESENT.py \ - Ihm/I_PROC_ETAPE.py \ - Ihm/I_REGLE.py \ - Ihm/I_UN_PARMI.py \ - Ihm/I_VALIDATOR.py \ - InterfaceQT4/browser.py \ - InterfaceQT4/compobloc.py \ - InterfaceQT4/compocommandecomm.py \ - InterfaceQT4/compocomm.py \ - InterfaceQT4/compofact.py \ - InterfaceQT4/compoformule.py \ - InterfaceQT4/compojdc.py \ - InterfaceQT4/compomacro.py \ - InterfaceQT4/compomclist.py \ - InterfaceQT4/compooper.py \ - InterfaceQT4/compoparam.py \ - InterfaceQT4/compoproc.py \ - InterfaceQT4/composimp.py \ - InterfaceQT4/configuration.py \ - InterfaceQT4/editor.py \ - InterfaceQT4/eficas_go.py \ - InterfaceQT4/feuille.py \ - InterfaceQT4/gereIcones.py \ - InterfaceQT4/gereListe.py \ - InterfaceQT4/gereRegles.py \ - InterfaceQT4/gereTraduction.py \ - InterfaceQT4/getVersion.py \ - InterfaceQT4/groupe.py \ - InterfaceQT4/monBoutonValide.py \ - InterfaceQT4/monChoixCata.py \ - InterfaceQT4/monChoixCode.py \ - InterfaceQT4/monChoixCommande.py \ - InterfaceQT4/monChoixLangue.py \ - InterfaceQT4/monFonctionPanel.py \ - InterfaceQT4/monLabelClic.py \ - InterfaceQT4/monRecherche.py \ - InterfaceQT4/monRechercheCatalogue.py \ - InterfaceQT4/monSelectVal.py \ - InterfaceQT4/monViewTexte.py \ - InterfaceQT4/monViewRegle.py \ - InterfaceQT4/monVisu.py \ - InterfaceQT4/monWidget4a6RadioButton.py \ - InterfaceQT4/monWidget4a6RadioButtonSD.py \ - InterfaceQT4/monWidgetBloc.py \ - InterfaceQT4/monWidgetCB.py \ - InterfaceQT4/monWidgetCBSD.py \ - InterfaceQT4/monWidgetCommande.py \ - InterfaceQT4/monWidgetCommentaire.py \ - InterfaceQT4/monWidgetCreeParam.py \ - InterfaceQT4/monWidgetDate.py \ - InterfaceQT4/monWidgetFactPlie.py \ - InterfaceQT4/monWidgetFact.py \ - InterfaceQT4/monWidgetFormule.py \ - InterfaceQT4/monWidgetHeure.py \ - InterfaceQT4/monWidgetInfo.py \ - InterfaceQT4/monWidgetInactif.py \ - InterfaceQT4/monWidgetMatrice.py \ - InterfaceQT4/monWidgetOptionnel.py \ - InterfaceQT4/monWidgetParam.py \ - InterfaceQT4/monWidgetPlusieursBase.py \ - InterfaceQT4/monWidgetPlusieursASSDIntoOrdonne.py \ - InterfaceQT4/monWidgetPlusieursIntoOrdonne.py \ - InterfaceQT4/monWidgetPlusieursInto.py \ - InterfaceQT4/monWidgetPlusieursTuple2.py \ - InterfaceQT4/monWidgetPlusieursTuple3.py \ - InterfaceQT4/monWidgetPlusieursTuple.py \ - InterfaceQT4/monWidgetPlusieursPlie.py \ - InterfaceQT4/monWidgetRadioButton.py \ - InterfaceQT4/monWidgetSDCOInto.py \ - InterfaceQT4/monWidgetSimpBase.py \ - InterfaceQT4/monWidgetSimpBool.py \ - InterfaceQT4/monWidgetSimpComplexe.py \ - InterfaceQT4/monWidgetSimpFichier.py \ - InterfaceQT4/monWidgetSimpTuple2.py \ - InterfaceQT4/monWidgetSimpTuple3.py \ - InterfaceQT4/monWidgetSimpTuple.py \ - InterfaceQT4/monWidgetSimpSalome.py \ - InterfaceQT4/monWidgetSimpTxt.py \ - InterfaceQT4/monWidgetUniqueSDCO.py \ - InterfaceQT4/monWidgetVide.py \ - InterfaceQT4/politiquesValidation.py \ - InterfaceQT4/qtEficas.py \ - InterfaceQT4/qtEficas_with_log.py \ - InterfaceQT4/qtSaisie.py \ - InterfaceQT4/readercata.py \ - InterfaceQT4/ssIhm.py \ - InterfaceQT4/typeNode.py \ - InterfaceQT4/viewManager.py \ - Traducteur/calcG.py \ - Traducteur/changeValeur.py \ - Traducteur/dictErreurs.py \ - Traducteur/inseremocle.py \ - Traducteur/load.py \ - Traducteur/log.py \ - Traducteur/mocles.py \ - Traducteur/movemocle.py \ - Traducteur/parseur.py \ - Traducteur/regles.py \ - Traducteur/removemocle.py \ - Traducteur/renamemocle.py \ - Traducteur/traduitV7V8.py \ - Traducteur/traduitV8V9.py \ - Traducteur/traduitV9V10.py \ - Traducteur/utils.py \ - Traducteur/visiteur.py \ - Noyau/N_VALIDATOR.py \ - Noyau/N_JDC.py \ - Validation/V_A_CLASSER.py \ - Validation/V_AU_MOINS_UN.py \ - Validation/V_AU_PLUS_UN.py \ - Validation/V_ENSEMBLE.py \ - Validation/V_ETAPE.py \ - Validation/V_EXCLUS.py \ - Validation/V_JDC.py \ - Validation/V_MACRO_ETAPE.py \ - Validation/V_MCBLOC.py \ - Validation/V_MCCOMPO.py \ - Validation/V_MCFACT.py \ - Validation/V_MCLIST.py \ - Validation/V_MCSIMP.py \ - Validation/V_MEME_NOMBRE.py \ - Validation/V_PRESENT_ABSENT.py \ - Validation/V_PRESENT_PRESENT.py \ - Validation/V_PROC_ETAPE.py \ - Validation/V_UN_PARMI.py - -FORMS = \ - UiQT5/desBaseWidget.ui \ - UiQT5/desChoixCata.ui \ - UiQT5/desChoixCode.ui \ - UiQT5/desChoixCommandes.ui \ - UiQT5/desChoixLangue.ui \ - UiQT5/desGroupeOptionnel.ui \ - UiQT5/desPBOptionnelMT.ui \ - UiQT5/desRechercheCatalogue.ui \ - UiQT5/desRecherche.ui \ - UiQT5/desSelectVal.ui \ - UiQT5/desViewRegles.ui \ - UiQT5/desViewTexte.ui \ - UiQT5/desVisu.ui \ - UiQT5/desWidget4a6RadioButton.ui \ - UiQT5/desWidgetBloc.ui \ - UiQT5/desWidgetCB.ui \ - UiQT5/desWidgetCommande.ui \ - UiQT5/desWidgetCommentaire.ui \ - UiQT5/desWidgetCreeParam.ui \ - UiQT5/desWidgetDate.ui \ - UiQT5/desWidgetFactHorizon.ui \ - UiQT5/desWidgetFactPlie.ui \ - UiQT5/desWidgetFact.ui \ - UiQT5/desWidgetFormule.ui \ - UiQT5/desWidgetHeure.ui \ - UiQT5/desWidgetInactif.ui \ - UiQT5/desWidgetInformation.ui \ - UiQT5/desWidgetIntoSug.ui \ - UiQT5/desWidgetMatrice.ui \ - UiQT5/desWidgetOptionnelMC.ui \ - UiQT5/desWidgetOptionnel.ui \ - UiQT5/desWidgetParam.ui \ - UiQT5/desWidgetPlusieursBase.ui \ - UiQT5/desWidgetPlusieursIntoOrdonne.ui \ - UiQT5/desWidgetPlusieursInto.ui \ - UiQT5/desWidgetPlusieursPlie.ui \ - UiQT5/desWidgetPlusieursTuple.ui \ - UiQT5/desWidgetRadioButton.ui \ - UiQT5/desWidgetSDCOInto.ui \ - UiQT5/desWidgetSimpBase.ui \ - UiQT5/desWidgetSimpBool.ui \ - UiQT5/desWidgetSimpComplexe.ui \ - UiQT5/desWidgetSimpFichier.ui \ - UiQT5/desWidgetSimpSalome.ui \ - UiQT5/desWidgetSimpTxt.ui \ - UiQT5/desWidgetTuple2.ui \ - UiQT5/desWidgetTuple3.ui \ - UiQT5/desWidgetUniqueSDCO.ui \ - UiQT5/desWidgetVide.ui \ - UiQT5/myMain.ui \ - UiQT5/Tuple2.ui \ - UiQT5/Tuple3.ui - -TRANSLATIONS = UiQT5/eficas_fr.ts UiQT5/eficas_en.ts diff --git a/Extensions/CreeTraductions/pourValidation.py b/Extensions/CreeTraductions/pourValidation.py deleted file mode 100644 index c0a80678..00000000 --- a/Extensions/CreeTraductions/pourValidation.py +++ /dev/null @@ -1,4 +0,0 @@ -print tr("Mot-clé : %s obligatoire non valorisé") -print tr("None n'est pas ujjjjjjjjjne valeur autorisée") -print tr("Mot-cle simple : ") -print tr("Fin Mot-clé simple : ") diff --git a/Ihm/CMakeLists.txt b/Ihm/CMakeLists.txt deleted file mode 100644 index e3ce0580..00000000 --- a/Ihm/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py - PATTERN CVS EXCLUDE - ) - - -### Local Variables: -### mode: cmake -### End: diff --git a/InterfaceSsIhm/.qtEficasSsIhm.py.swp b/InterfaceSsIhm/.qtEficasSsIhm.py.swp new file mode 100644 index 00000000..fa214f5f Binary files /dev/null and b/InterfaceSsIhm/.qtEficasSsIhm.py.swp differ diff --git a/InterfaceSsIhm/editorSsIhm.py b/InterfaceSsIhm/editorSsIhm.py new file mode 100644 index 00000000..bd5efb7d --- /dev/null +++ b/InterfaceSsIhm/editorSsIhm.py @@ -0,0 +1,1100 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2013 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str + from builtins import range +except : pass + +import types,sys,os, re +import subprocess +import traceback + +import six +from six.moves import range + +import traceback + +# Modules Eficas + +import convert, generator +from Editeur import session +from Editeur import comploader +from Editeur import Objecttreeitem + +DictExtensions= {"MAP" : ".map", "TELEMAC" : '.cas'} +debug = False + + + +class JDCEditorSsIhm : +# ------------------- # + """ + Editeur de jdc + """ + +# --------------------------------------------- +# Methodes Communes ou appelees depuis avec Ihm +# --------------------------------------------- + + def __init__ (self,appli,fichier = None, jdc = None, units = None, include=0 ): + #------------------------------------------------------------------------------# + # paticularisee avec Ihm + + if debug : print ('dans le init de JDCEditorSsIhm') + self.appliEficas = appli + self.appli = appli + self.fichier = fichier + self.fichierComplet = fichier + self.jdc = jdc + self.first = True + self.jdc_item = None + self.dicoNouveauxMC = {} + self.dicoNouveauxFact = {} + self.dict_reels = {} + self.liste_simp_reel = [] + + if appli != None : self.salome = self.appliEficas.salome + else : self.salome = 0 + + # ces attributs sont mis a jour par definitCode appelee par newEditor + self.code = self.appliEficas.maConfiguration.code + self.maConfiguration = self.appliEficas.maConfiguration + + self.version_code = session.d_env.cata + + + if not hasattr ( self.appliEficas, 'readercata') or self.appliEficas.readercata.demandeCatalogue==True or self.appliEficas.multi==True: + if self.maConfiguration.typeDeCata == 'XML' : + from . import readercataXML as readercata + else : + from . import readercata + self.readercata = readercata.ReaderCata( self, self.appliEficas ) + self.appliEficas.readercata=self.readercata + self.appliEficas.code=self.code + else : + self.readercata=self.appliEficas.readercata + if self.readercata.fic_cata == None : return #Sortie Salome + self.titre=self.readercata.titre + + self.format = self.appliEficas.format_fichier + + if self.appliEficas.maConfiguration.dumpXSD==True : self.appliEficas.dumpXsd() + self.dict_reels={} + self.liste_simp_reel=[] + self.dicoNouveauxMC={} + self.dicoNouveauxFact={} + + + try: + self.maConfiguration.generator_module + _module = __import__(self.maConfiguration.generator_module) + info = _module.entryPoint() + generator.plugins.addEntryPoint(info) + except: + pass + + try: + self.maConfiguration.convert_module + #print self.maConfiguration.convert_module + _module = __import__(self.maConfiguration.convert_module) + info = _module.entryPoint() + convert.plugins.addEntryPoint(info) + except : + pass + + self.maConfiguration.mesGenerators = generator + self.maConfiguration.mesconvertisseurs = convert + + self.fileInfo = None + self.lastModified = 0 + + self.modified = False + self.isReadOnly = False + + #------- construction du jdc -------------- + + + self.nouveau=0 + if self.fichier is not None: # fichier jdc fourni + if jdc==None : + #print ('PNPN : chgt try en if') + try : + #if 1 : + self.jdc = self.readFile(self.fichier) + except : + print ("mauvaise lecture du fichier") + if self.salome : + try : + self.appliEficas.addJdcInSalome( self.fichier) + except : + print ("mauvais enregistrement dans Salome") + else : + self.jdc=jdc + + if self.jdc is not None and units is not None: + self.jdc.recorded_units=units + self.jdc.old_recorded_units=units + + else: + if not self.jdc: # nouveau jdc + if not include : + self.jdc = self._newJDC(units=units) + else : + self.jdc = self._newJDCInclude(units=units) + self.nouveau=1 + + if self.jdc: + self.jdc.appli = self # a resorber + self.jdc.editor = self + self.jdc.lang = self.appli.langue + self.jdc.aReafficher=False + txt_exception = None + if not jdc: + self.jdc.analyse() + txt_exception = self.jdc.cr.getMessException() + if txt_exception : + self.jdc = None + self.informe('pb chargement jdc',txt_exception) + else: + #comploader.chargerComposants() + #cette ligne devrait etre dans editor ??? + self.jdc_item=Objecttreeitem.makeObjecttreeitem( self, "nom", self.jdc ) + + #-------------------------------# + def readFile(self, fn): + #--------------------------------# + """ + Public slot to read the text from a file. + @param fn filename to read from (string or QString) + """ + + # charge un JDC + # paticularisee avec Ihm + + fn = six.text_type(fn) + jdcName=os.path.basename(fn) + + # Il faut convertir le contenu du fichier en fonction du format + if self.appliEficas.format_fichier_in in convert.plugins: + # Le convertisseur existe on l'utilise + + p=convert.plugins[self.appliEficas.format_fichier_in]() + p.readfile(fn) + + if p.text=="" : self.nouveau=1 + #print ('PNPN --> CIST a faire') + + pareil,texteNew=self.verifieChecksum(p.text) + if not pareil : + self.informe(("fichier modifie"),("Attention! fichier change hors EFICAS"),False) + + p.text=texteNew + memeVersion,texteNew=self.verifieVersionCataDuJDC(p.text) + if memeVersion == 0 : texteNew=self.traduitCatalogue(texteNew) + p.text=texteNew + + text=p.convert('exec',self.appliEficas) + + if not p.cr.estvide(): self.afficheInfos("Erreur a la conversion",'red') + else : + self.afficheInfos("Type de fichier non reconnu",'red') + self.informe( "Type de fichier non reconnu", + "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.format_fichier_in) + return None + + CONTEXT.unsetCurrentStep() + + #jdc=self.readercata.cata[0].JdC(procedure=text, + jdc=self.readercata.cata.JdC(procedure=text, + appli=self, + cata=self.readercata.cata, + cata_ord_dico=self.readercata.cata_ordonne_dico, + nom=jdcName, + rep_mat=self.maConfiguration.rep_mat + ) + self.modified = False + return jdc + + + #--------------------------------# + def _newJDC( self ,units = None): + #--------------------------------# + """ + Initialise un nouveau JDC vierge + """ + self.modified=1 + CONTEXT.unsetCurrentStep() + + texte="" + if self.code == "CARMELCND" : texte=self._newJDCCND() + if self.code == "ZCRACKS" : texte=self._newZCRACKS() + if self.code == "PSEN" : texte = self._newPSEN() + if self.code == "PSEN_N1" : texte = self._newPSEN_N1() + + #if hasattr(self.readercata.cata[0],'TEXTE_NEW_JDC') : texte=self.readercata.cata[0].TEXTE_NEW_JDC + if hasattr(self.readercata.cata,'TEXTE_NEW_JDC') : texte=self.readercata.cata.TEXTE_NEW_JDC + + + #jdc=self.readercata.cata[0].JdC( procedure =texte, + #print (self.readercata.cata) + jdc=self.readercata.cata.JdC( procedure =texte, + appli=self, + cata=self.readercata.cata, + cata_ord_dico=self.readercata.cata_ordonne_dico, + rep_mat=self.maConfiguration.rep_mat + ) + + jdc.lang = self.appli.langue + if units is not None: + jdc.recorded_units=units + jdc.old_recorded_units=units + ## PNPN est ce que la ligne suivante est bien utile ? + # elle positionne le contexte + # est ce qu on ne doit pas changer le format en Accas si on vient d accas ? + if self.format == 'xml' : return jdc + if texte == "" : + jdc.editor=self + jdc.analyse() + return jdc + + #--------------------------------# + def _newJDCInclude( self ,units = None): + #--------------------------------# + """ + Initialise un nouveau JDC vierge + """ + import Extensions.jdc_include + JdC_aux=Extensions.jdc_include.JdC_include + CONTEXT.unsetCurrentStep() + + #jaux=self.readercata.cata[0].JdC( procedure="", + jaux=self.readercata.cata.JdC( procedure="", + appli=self, + cata=self.readercata.cata, + cata_ord_dico=self.readercata.cata_ordonne_dico, + rep_mat=self.maConfiguration.rep_mat, + ) + jaux.analyse() + + J=JdC_aux( procedure="", + appli=self, + cata=self.readercata.cata, + cata_ord_dico=self.readercata.cata_ordonne_dico, + jdc_pere=jaux, + rep_mat=self.maConfiguration.rep_mat, + ) + J.analyse() + if units is not None: + J.recorded_units=units + J.old_recorded_units=units + return J + + + + #-----------------------# + def getSource(self,file): + #-----------------------# + + # Il faut convertir le contenu du fichier en fonction du format + if self.format in convert.plugins : + # Le convertisseur existe on l'utilise + p=convert.plugins[self.format]() + p.readfile(file) + text=p.convert('execnoparseur') + if not p.cr.estvide(): + self.afficheInfos("Erreur a la conversion",'red') + return text + else: + # Il n'existe pas c'est une erreur + self.afficheInfos("Type de fichier non reconnu",'red') + self.informe( "Type de fichier non reconnu", + "EFICAS ne sait pas ouvrir le type de fichier " + self.appliEficas.format_fichier_in) + return None + + #----------------------------------------------# + def __generateTempFilename(self, prefix, suffix): + #----------------------------------------------# + import tempfile + (fd, filename) = tempfile.mkstemp(prefix=prefix, suffix=suffix) + os.close(fd) + return filename + + #-----------------------# + def generDico(self): + #-----------------------# + if 'dico' in generator.plugins: + self.generator=generator.plugins['dico']() + #print (self.generator) + jdc_formate=self.generator.gener(self.jdc) + #print (jdc_formate) + dico=self.generator.Dico + #print (dico) + return dico + + #-----------------------# + def viewJdcSource(self): + #-----------------------# + if self.fichier == None : return + f=open(self.fichier,'r') + texteSource=f.read() + f.close() + self._viewText(texteSource, "JDC_SOURCE") + + #-----------------------# + def viewJdcPy(self): + #-----------------------# + strSource = str( self.getTextJDC(self.format) ) + self._viewText(strSource, "JDC_RESULTAT") + + #-----------------------# + def viewJdcRapport(self): + #-----------------------# + # on ajoute les regles + strRapport = six.text_type( self.jdc.report() ) + self._viewText(strRapport, "JDC_RAPPORT") + + #-----------------------# + def viewJdcRegles(self): + #-----------------------# + # on ajoute les regles + texte_global, test_global = self.jdc.verifRegles() + self._viewText(texte_global, "JDC_REGLES") + + #-----------------------# + def getJdcRapport(self): + #-----------------------# + # on ajoute les regles + strRapport = six.text_type( self.jdc.report() ) + return strRapport + + #---------------------# + def getFileName(self): + #---------------------# + return self.fichier + + #-------------------# + def initModif(self): + #-------------------# + """ + Met l'attribut modified a 'o' : utilise par Eficas pour savoir + si un JDC doit etre sauvegarde avant destruction ou non + """ + self.modified = True + + + #--------------------------------------------------# + def writeFile(self, fn, txt = None,formatLigne="beautifie"): + #--------------------------------------------------# + """ + Public slot to write the text to a file. + + @param fn filename to write to string + @return flag indicating success + """ + + fn = six.text_type(fn) + + if txt == None : + txt = self.getTextJDC(self.format,formatLigne=formatLigne) + eol = '\n' + if len(txt) >= len(eol): + if txt[-len(eol):] != eol: + txt += eol + else: + txt += eol + txt=self.ajoutVersionCataDsJDC(txt) + if self.code != 'PSEN' and self.code != 'PSEN_N1' : checksum=self.getChecksum(txt) + else : checksum='' + txt=txt+checksum + if self.code=="TELEMAC" : return 1 + try: + f = open(fn, 'w') + f.write(txt) + f.close() + return 1 + except IOError as why: + self.afficheInfos('Sauvegarde du Fichier', 'Le fichier'+str(fn) + 'n a pas pu etre sauvegarde :' + str(why)) + return 0 + + #-----------------------------------------------------------# + def getTextJDC(self,format,pourRun=0,formatLigne="beautifie"): + #-----------------------------------------------------------# + if self.code == "MAP" and not(format in generator.plugins): format = "MAP" + if format in generator.plugins: + + # Le generateur existe on l'utilise + self.generator=generator.plugins[format]() + try : + jdc_formate=self.generator.gener(self.jdc,format=formatLigne,config=self.appliEficas.maConfiguration,appli=self.appliEficas) + if pourRun : jdc_formate=self.generator.textePourRun + if self.code == 'TELEMAC' : jdc_formate=self.generator.texteDico + except ValueError as e: + self.informe( "Erreur a la generation",str(e),'red') + return + + if not self.generator.cr.estvide(): + self.informe("Erreur a la generation","EFICAS ne sait pas convertir ce JDC",'red') + return "" + else: + return jdc_formate + else: + # Il n'existe pas c'est une erreur + self.informe("Format inconnu", self.format + " non reconnu" ) + return "" + + #------------------------------# + def verifieChecksum(self,text): + #------------------------------# + # Attention : souci sous Windows + # + indexDeb=text.find("#CHECKSUM:") + if indexDeb < 0 : return 1, text + indexFin=text.find(":FIN CHECKSUM") + checkAvant=text[indexDeb:indexFin+13] + textJDC=text[0:indexDeb]+text[indexFin+13:-1] + if self.code != 'PSEN' and self.code != 'PSEN_N1': + checksum=self.getChecksum(textJDC) + pareil=(checkAvant==checksum) + else : + pareil=1 + return pareil, textJDC + + #---------------------------# + def getChecksum(self,texte): + #---------------------------# + try : + import haslib + newtexte=texte.replace('"','\\"') + hash_checksum = hashlib.md5() + hash_checksum.update(newtexte.encode('utf-8')) + checksum = hash_checksum.hexdigest() + ligne = "#CHECKSUM:"+checksum+":FIN CHECKSUM" + except : + try : + newtexte=texte.replace('"','\\"') + commande='echo "'+newtexte+'"|md5sum' + a=os.popen(commande) + checksum=a.read() + a.close() + except : + checksum='Fichier trop long \n' + ligne="#CHECKSUM:"+checksum[0:-1]+":FIN CHECKSUM" + return ligne + + #----------------------# + def getDico(self): + #---------------------# + if 'dicoImbrique' in generator.plugins: + self.generator=generator.plugins['dicoImbrique']() + #print (self.generator) + jdc_formate=self.generator.gener(self.jdc) + dico=self.generator.Dico + return dico + else : + self.afficheInfos(tr("Format %s non reconnu" , self.format),Qt.red) + return "" + + #-----------------------------------------# + def chercheGroupes(self): + #-----------------------------------------# + listeMA,listeNO=self.getTextJDC("GroupMA") + return listeMA,listeNO + + #-----------------------------------------# + def chercheDico(self): + #-----------------------------------------# + dicoCourant={} + format = self.appliEficas.format_fichier + if format in generator.plugins: + # Le generateur existe on l'utilise + self.generator=generator.plugins[format]() + jdc_formate=self.generator.gener(self.jdc,format='beautifie',config=self.appliEficas.maConfiguration) + dicoCourant=self.generator.dico + return dicoCourant + + #-----------------------------------------------------------------# + def saveFileLegerAs(self, fileName = None) : + #-----------------------------------------------------------------# + if fileName != None : + self.fichier = fileName + return self.saveFileLeger(fileName) + return self.saveFileLeger() + + #-----------------------------------------------------------------# + def saveFileComplet(self, fichier = None, formatLigne="beautifie"): + #-----------------------------------------------------------------# + fn = fichier + self.generator=generator.plugins[self.format]() + print (self.generator) + if hasattr(self.generator, "writeComplet"): + self.generator.writeComplet(fichier,self.jdc,config=self.appliEficas.maConfiguration,appli=self.appliEficas) + + +# --------------------------------------------- +# Methodes Surchargees par avecIhm +# --------------------------------------------- + + #--------------------------------# + def ajoutCommentaire(self): + #--------------------------------# + print ('pas programme sans Ihm') + print ('prevenir la maintenance du besoin') + + + #--------------------------------------# + def informe(self,titre,txt,critique=True): + #--------------------------------------# + # methode differenre avec et sans ihm + if critique : print ('!!!!!!!!!!!!!!!!!!!!!!!!!!!') + print (titre) + print (txt) + if critique : print ('!!!!!!!!!!!!!!!!!!!!!!!!!!!') + + #--------------------------------------# + def afficheInfos(self,txt,couleur=None): + #--------------------------------------# + # methode differenre avec et sans ihm + print (txt) + + #-----------------------------------------------------------------------# + def _viewText(self, txt, caption = "FILE_VIEWER",largeur=1200,hauteur=600): + #--------------------------------------------------------------------# + print ('_____________________________') + print (txt) + print ('_____________________________') + + + #-----------------------------------------------------------------# + def saveFile(self, fichier, formatLigne="beautifie"): + #-----------------------------------------------------------------# + """ + Public slot to save the text to a file. + + @param path directory to save the file in (string or QString) + @return tuple of two values (boolean, string) giving a success indicator and + the name of the saved file + """ + + + if not (self.writeFile(fichier,formatLigne=formatLigne)): return (0, None) + self.fichierOut = fichier + + if self.jdc.isValid() != 0 and hasattr(self.generator, "writeDefault"): + self.generator.writeDefault(fichier) + elif self.code=="TELEMAC" and hasattr(self.generator, "writeDefault"): + self.generator.writeDefault(fichier) + + self.modified = 0 + + return (1, self.fichier) +# + + #----------------------------------------------# + def sauveLigneFile(self): + #----------------------------------------------# + self.modified=1 + return self.saveFile(formatLigne="Ligne") + + + #-----------------------------------# + def updateJdc(self, itemApres,texte): + #------------------------------------# + # ajoute une etape de JdC a partir d un texte + monItem=itemApres + etape=monItem.item.object + CONTEXT.setCurrentStep(etape) + etape.buildIncludeInclude(texte) + self.tree.racine.buildChildren() + + #-----------------------------------# + def updateJdcEtape(self, itemApres,texte): + #------------------------------------# + # ajoute une etape de JdC a partir d un texte + monItem=itemApres + etape=monItem.item.object + CONTEXT.set_current_step(etape) + try : + ok=etape.build_includeEtape(texte) + except : + ok=0 + if not ok : + QMessageBox.information( self, + tr("Import texte"), + tr("Impossible d importer le texte")) + self.tree.racine.build_children() + return ok + + + + #-------------------------------------# + def deleteEtape(self,etape): + #-------------------------------------# + # dans le JDC + self.jdc.suppentite(etape) + + #-------------------------------------# + def deleteMC(self,etape,MCFils,listeAvant=()): + #-------------------------------------# + # dans le JDC + ouChercher=etape + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + monMC=ouChercher.getChild(MCFils,restreint="oui") + if monMC != None : ouChercher.suppentite(monMC) + ouChercher.state='changed' + ouChercher.isvalid() + + #--------------------------------------------------------# + def ajoutMC(self,etape,MCFils,valeurs,listeAvant=()): + #--------------------------------------------------------# + # dans le JDC + debug=False + if debug : print ('ajoutMC', etape,MCFils,valeurs,listeAvant) + ouChercher=etape + if debug : print (ouChercher) + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui", debug=1) + monMC=ouChercher.getChild(MCFils,restreint="oui") + if monMC == None : monMC = ouChercher.addEntite(MCFils) + monMC.valeur=valeurs + monMC.val=valeurs + monMC.state='changed' + monMC.isvalid() + return 1 + + #--------------------------------------------------------# + def ajoutMCinMCFactUnique(self,etape,MCFils,valeurs,listeAvant=()): + # Attention si +sieursMCFACT + #--------------------------------------------------------# + # dans le JDC + debug=False + if debug : print ('ajoutMC', etape,MCFils,valeurs,listeAvant) + ouChercher=etape + if debug : print (ouChercher) + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui", debug=1) + # Attention si +sieursMCFACT + ouChercher=ouChercher[0] + if debug : print (ouChercher) + monMC=ouChercher.getChild(MCFils,restreint="oui") + if monMC == None : monMC = ouChercher.addEntite(MCFils) + monMC.valeur=valeurs + monMC.val=valeurs + monMC.state='changed' + monMC.isValid() + return 1 + + #----------------------------------------------# + def ajoutMCFact(self,etape,MCFils,listeAvant=()): + #----------------------------------------------# + # dans le JDC + ouChercher=etape + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + monMC=etape.getChild(ouChercher,restreint="oui") + if monMC== None : monMC= ouChercher.addEntite(MCFils) + monMC.isvalid() + + #-----------------------------------------------------------------# + def setValeurMCSimpInEtape(self,etape,listeAvant,valeur): + #-----------------------------------------------------------------# + # pour VP + monObj=etape + for mot in listeAvant : + monObj=monObj.getChild(mot,restreint="oui") + if monObj==None : return False + if monObj == None : return False + if monObj.valeur != valeur : + # PNPN le setValeur fait des bugs --> pourquoi + #monObj.setValeur(valeur) + monObj.valeur=valeur + monObj.isValid() + return True + + #-------------------------------------------------# + def getValeur(self,nomEtape,MCFils,listeAvant=()): + #-------------------------------------------------# + # dans le JDC + + debug=0 + ouChercher=None + for e in self.jdc.etapes: + if e.nom == nomEtape : ouChercher=e; break + if debug : print ('etape trouvee', ouChercher) + if ouChercher==None : return None + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + if debug : print (mot, ouChercher) + if ouChercher==None : return None + monMC=ouChercher.getChild(MCFils,restreint="oui") + if debug : print ('monMC', monMC) + if monMC== None : return None + return monMC.valeur + + #-------------------------------------------------# + def getMCDsEtape(self,etape,MCFils,listeAvant=()): + #-------------------------------------------------# + # dans le JDC + + if etape==None : return None + ouChercher=etape + debug=0 + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + if debug : print (mot, ouChercher) + if ouChercher==None : return None + monMC=ouChercher.getChild(MCFils,restreint="oui") + if debug : print ('monMC', monMC) + return monMC + + #-----------------------------------------------------------# + def setValeur(self,nomEtape,MCFils,valeur,listeAvant=()): + #--------------------------------------------------------# + # dans le JDC + + ouChercher=None + for e in self.jdc.etapes: + if e.nom == nomEtape : ouChercher=e; break + if ouChercher==None : return None + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + #print (mot, ouChercher) + if ouChercher==None : return None + monMC=ouChercher.getChild(MCFils,restreint="oui") + monMC.set_valeur(valeur) + monMC.isvalid() + + #-----------------------------------------------------------# + def changeIntoMC(self,etape,MCFils,valeurs, listeAvant=()): + #-----------------------------------------------------------# + # dans le JDC + ouChercher=etape + if isinstance (etape, str): + ouChercher=None + for e in self.jdc.etapes: + if e.nom == etape : ouChercher=e; break + if ouChercher==None : return + + for mot in listeAvant : + ouChercher=ouChercher.getChild(mot,restreint="oui") + if ouChercher==None : return + monMC=ouChercher.getChild(MCFils,restreint="oui") + if monMC== None : monMC= ouChercher.addEntite(MCFils) + + monMC.definition.into=valeurs + from Noyau.N_VALIDATOR import IntoProtocol + monMC.definition.intoProto = IntoProtocol("into", into=monMC.definition.into, val_min=monMC.definition.val_min, val_max=monMC.definition.val_max) + monMC.state='changed' + monMC.isvalid() + + #-------------------------------------------------------------------# + def reCalculeValiditeMCApresChgtInto(self,nomEtape,MCFils,listeAvant=()): + #-------------------------------------------------------------------# + # dans le JDC + for e in self.jdc.etapes: + if e.nom == nomEtape : ouChercher=e; break + + for mot in listeAvant : + try : + ouChercher=ouChercher.getChild(mot,restreint="oui") + # Le mot clef n est pas la + except : return 0 + try : + monMC=ouChercher.getChild(MCFils,restreint="oui") + # Le mot clef n est pas la + except : return 0 + if monMC == None : return 0 + + if hasattr(monMC.definition,'into') : + if type(monMC.definition.into) ==types.FunctionType : maListeDeValeur=monMC.definition.into() + else : maListeDeValeur=monMC.definition.into + else : + return 0 + + monMC.state='changed' + return 1 + + #-------------------------------------# + def changeDefautDefMC(self,nomEtape,listeMC,valeurs): + #-------------------------------------# + # dans le MDD + + #if isinstance (etape, str): + # for e in self.jdc.etapes: + # if e.nom == etape : etape=e; break + #if etape == None : return + definitionEtape=getattr(self.jdc.cata,nomEtape) + #definitionEtape=getattr(self.jdc.cata[0],nomEtape) + ouChercher=definitionEtape + if len(listeMC) > 1 : + + for mc in listeMC[0:-1]: + mcfact=ouChercher.entites[mc] + ouChercher=mcfact + + mcAccas=ouChercher.entites[listeMC[-1]] + mcAccas.defaut=valeurs + return 1 + + #------------------------------------------------# + def changeIntoDefMC(self,etape,listeMC,valeurs): + #------------------------------------------------# + # dans le MDD + #definitionEtape=getattr(self.jdc.cata[0],nomEtape) + #definitionEtape=getattr(self.jdc.cata,nomEtape) + print ( 'changeIntoDefMC ',etape,listeMC,valeurs) + ouChercher=getattr(self.jdc.cata,etape.nom) + + #if len(listeMC) > 1 : + # for mc in listeMC[0:-1]: + # mcfact=ouChercher.entites[mc] + # ouChercher=mcfact + #mcAccas=ouChercher.entites[listeMC[-1]] + + for mc in listeMC : + mcAccas=ouChercher.entites[mc] + ouChercher=mcAccas + if ouChercher == None : return 0 + + if hasattr(mcAccas,'into') : oldValeurs=mcAccas.into + else : oldValeurs=None + + if oldValeurs==valeurs : return 1 + mcAccas.into=valeurs + from Noyau.N_VALIDATOR import IntoProtocol + mcAccas.intoProto = IntoProtocol("into", into=valeurs, val_min=mcAccas.val_min, val_max=mcAccas.val_max) + return 1 + + #-------------------------------------------------------------# + def deleteDefinitionMC(self,etape,listeAvant,nomDuMC): + #-------------------------------------------------------------# + # dans le MDD + #print 'in deleteDefinitionMC', etape,listeAvant,nomDuMC + if isinstance (etape, str): + for e in self.jdc.etapes: + if e.nom == etape : etape=e; break + if etape == None : return + #definitionEtape=getattr(self.jdc.cata[0],etape) + definitionEtape=getattr(self.jdc.cata,etape) + ouChercher=definitionEtape + for k in listeAvant : + ouChercher=ouChercher.entites[k] + MCADetruire=ouChercher.entites[nomDuMC] + ouChercher.ordre_mc.remove(nomDuMC) + print ('remove de ', nomDuMC) + del ouChercher.entites[nomDuMC] + del self.dicoNouveauxMC[nomDuMC] + + + #-------------------------------------------------------------# + def ajoutDefinitionMC(self,nomEtape,listeAvant,nomDuMC,typ,**args): + #-------------------------------------------------------------# + # dans le MDD + #definitionEtape=getattr(self.jdc.cata[0],nomEtape) + definitionEtape=getattr(self.jdc.cata,nomEtape) + ouChercher=definitionEtape + for k in listeAvant : + ouChercher=ouChercher.entites[k] + from Accas import A_SIMP + Nouveau=A_SIMP.SIMP(typ,**args) + Nouveau.pere=ouChercher + Nouveau.nom=nomDuMC + #Nouveau.ordre_mc=[] + ouChercher.entites[nomDuMC]=Nouveau + ouChercher.ordre_mc.append(nomDuMC) + #print ('ajout de ', nomDuMC) + #traceback.print_stack() + # ajout CIST sauvegarde + if nomDuMC in self.dicoNouveauxMC : del self.dicoNouveauxMC[nomDuMC] + self.dicoNouveauxMC[nomDuMC]=('ajoutDefinitionMC',nomEtape,listeAvant,nomDuMC,typ,args) + #print self.dicoNouveauxMC + + #---------------------------------------------------------------------# + def ajoutDefinitionMCFact(self,nomEtape,listeAvant,nomDuMC,listeMC,**args): + #---------------------------------------------------------------------# + # dans le MDD + print ('ajoutDefinitionMCFact', nomDuMC) + #definitionEtape=getattr(self.jdc.cata[0],nomEtape) + definitionEtape=getattr(self.jdc.cata,nomEtape) + ouChercher=definitionEtape + for k in listeAvant : + ouChercher=ouChercher.entites[k] + from Accas import A_SIMP + for mc in listeMC : + nomMC=mc[0] + typMC=mc[1] + argsMC=mc[2] + nouveauMC=A_SIMP.SIMP(typMC,**argsMC) + nouveauMC.nom=nomMC + args[nomMC]=nouveauMC + from Accas import A_FACT + nouveauFact=A_FACT.FACT(**args) + nouveauFact.pere=ouChercher + nouveauFact.nom=nomDuMC + from Editeur.autre_analyse_cata import traite_entite + traite_entite(nouveauFact,[]) + ouChercher.entites[nomDuMC]=nouveauFact + ouChercher.ordre_mc.append(nomDuMC) + self.dicoNouveauxFact[nomDuMC]=('ajoutDefinitionMC',nomEtape,listeAvant,nomDuMC,listeMC,args) + #print self.dicoNouveauxMC + + #----------------------------------------------------# + + #----------------------------------------------------# + def changeIntoMCandSet(self,etape,listeMC,into,valeurs): + #----------------------------------------------------# + # dans le MDD et le JDC + + self.changeIntoDefMC(etape,listeMC,into) + + if isinstance (etape, str): + for e in self.jdc.etapes: + if e.nom == etape : etape=e; break + if etape == None : return + + ouChercher = etape + for mot in listeMC[:-1] : + ouChercher=ouChercher.getChild(mot,restreint="oui") + if ouChercher==None : return + MCFils=listeMC[-1] + monMC=ouChercher.getChild(MCFils,restreint="oui") + if monMC== None : monMC= etape.addEntite(MCFils) + + monMC.definition.into=into + monMC.valeur=valeurs + monMC.val=valeurs + monMC.state='changed' + monMC.isvalid() + + #-------------------------------------# + def ajoutVersionCataDsJDC(self,txt): + #-------------------------------------# + #if not hasattr(self.readercata.cata[0],'VERSION_CATALOGUE'): return txt + if not hasattr(self.readercata.cata,'VERSION_CATALOGUE'): return txt + ligneVersion="#VERSION_CATALOGUE:"+self.readercata.cata.VERSION_CATALOGUE+":FIN VERSION_CATALOGUE\n" + texte=txt+ligneVersion + return texte + + #-------------------------------------# + def verifieVersionCataDuJDC(self,text): + #-------------------------------------# + memeVersion=False + indexDeb=text.find("#VERSION_CATALOGUE:") + indexFin=text.find(":FIN VERSION_CATALOGUE") + if indexDeb < 0 : + self.versionCataDuJDC="sans" + textJDC=text + else : + self.versionCataDuJDC=text[indexDeb+19:indexFin] + textJDC=text[0:indexDeb]+text[indexFin+23:-1] + + self.versionCata="sans" + if hasattr(self.readercata.cata,'VERSION_CATALOGUE'): self.versionCata=self.readercata.cata.VERSION_CATALOGUE + + if self.versionCata==self.versionCataDuJDC : memeVersion=True + return memeVersion,textJDC + + #-------------------------------# + def traduitCatalogue(self,texte): + #-------------------------------# + nomTraducteur="traduit"+self.readercata.code+self.versionCataDuJDC+"To"+self.versionCata + sys.path.append(os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../Traducteur"))) + try : + traducteur=__import__(nomTraducteur) + monTraducteur=traducteur.MonTraducteur(texte) + nouveauTexte=monTraducteur.traduit() + return nouveauTexte + except : + return texte + + +# Methodes a resorber +# il faut mettre a jour les catalogues avec +# TEXTE_NEW_JDC +# + + #---------------------------# + def _new_CF(self): + #---------------------------# + texte="CONDUITE_FORCEE();" + return texte + + #---------------------------# + def _newPSEN(self): + #---------------------------# + texte="DIRECTORY() ; PSSE_PARAMETERS() ; SIMULATION() ; sansnom=DISTRIBUTION() ; sansnom=DISTRIBUTION() ; CORRELATION() ;" + #texte="" + return texte + + #---------------------------# + def _newPSEN_N1(self): + #---------------------------# + texte="CASE_SELECTION();N_PROCESSING_OPTIONS();CONTINGENCY_OPTIONS();CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " + #texte="CONTINGENCY_SELECTION();\nCONTINGENCY_PROCESSING(); " + return texte + + #---------------------------# + def _newZCRACKS(self): + #---------------------------# + texte="MAILLAGES();REMESHING();" + return texte + + + #---------------------------# + def _newJDCCND(self): + #---------------------------# + extensions=tr('Fichiers Med (*.med);;''Tous les Fichiers (*)') + + #if self.salome == 0 : + QMessageBox.information( self, + tr("Fichier Med"), + tr("Veuillez selectionner un fichier Med")) + QSfichier = QFileDialog.getOpenFileName(self.appliEficas, + caption='Fichier Med', + filter=extensions) + QSfichier=QSfichier[0] + self.fichierMED=QSfichier + from acquiertGroupes import getGroupes + erreur,self.listeGroupes,self.nomMaillage,self.dicoCoord=getGroupes(self.fichierMED) + if erreur != "" : print ("a traiter") + texteComm="COMMENTAIRE(u'Cree - fichier : "+self.fichierMED +" - Nom Maillage : "+self.nomMaillage+"');\nPARAMETRES()\n" + texteSources="" + texteCond="" + texteNoCond="" + texteVcut="" + texteZs="" + for groupe in self.listeGroupes : + if groupe[0:8]=='CURRENT_': + texteSources +=groupe[8:]+"=SOURCE(" + texteSources +="VecteurDirecteur=(1.0,2.0,3.0,),);\n" + if groupe[0:5]=='COND_': texteCond +=groupe[5:]+"=CONDUCTEUR();\n" + if groupe[0:7]=='NOCOND_': texteNoCond +=groupe[7:]+"=NOCOND();\n" + if groupe[0:5]=='VCUT_': texteVcut +='V_'+groupe[5:]+"=VCUT();\n" + if groupe[0:3]=='ZS_': texteZs +=groupe[3:]+"=ZS();\n" + texte=texteComm+texteSources+texteCond+texteNoCond+texteVcut+texteZs + self.newTexteCND=texte + self.modified=1 + return texte + + +if __name__ == "__main__": + print ('a faire') diff --git a/InterfaceSsIhm/eficas_go.py b/InterfaceSsIhm/eficas_go.py new file mode 100755 index 00000000..a4ef937b --- /dev/null +++ b/InterfaceSsIhm/eficas_go.py @@ -0,0 +1,243 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +# Modules Python +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str +except : pass + + +import sys,os +repIni=os.path.abspath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"..")) +ihmQTDir=os.path.join(repIni,"UiQT5") +editeurDir=os.path.join(repIni,"Editeur") +ihmDir=os.path.join(repIni,"InterfaceQT4") + +if ihmDir not in sys.path : sys.path.append(ihmDir) +if ihmQTDir not in sys.path : sys.path.append(ihmQTDir) +if editeurDir not in sys.path :sys.path.append(editeurDir) + +def getEficasSsIhm(code=None,fichier=None,ssCode=None,multi=False,langue='en',versionCode=None): + #print (versionCode) + from .qtEficasSsIhm import AppliSsIhm + Eficas=AppliSsIhm(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue,versionCode=versionCode) + from Editeur import session + options=session.parse(['ssIhm','-k',code,'-v',versionCode]) + return Eficas + + +def lanceEficas(code=None,fichier=None,ssCode=None,multi=False,langue='en'): + """ + Lance l'appli EFICAS + """ + # Analyse des arguments de la ligne de commande + try : + from PyQt5.QtWidgets import QApplication + except : + print('Please, set qt environment') + return + + from Editeur import session + options=session.parse(sys.argv) + if options.code!= None : code=options.code + if options.ssCode!= None : ssCode=options.ssCode + + from InterfaceQT4.qtEficas import Appli + app = QApplication(sys.argv) + + #import cProfile, pstats, StringIO + #pr = cProfile.Profile() + #pr.enable() + + Eficas=Appli(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue) + #pr.disable() + #s = StringIO.StringIO() + #sortby = 'cumulative' + #ps = pstats.Stats(pr, stream=s).sort_stats(sortby) + #ps.print_stats() + #print (s.getValue()) + + Eficas.show() + + res=app.exec_() + sys.exit(res) + + +def lanceEficas_ssIhm(code=None,fichier=None,ssCode=None,version=None,debug=False,langue='en'): + """ + Lance l'appli EFICAS pour trouver les noms des groupes + """ + # Analyse des arguments de la ligne de commande + from Editeur import session + options=session.parse(sys.argv) + if version!=None and options.cata==None : options.cata=version + if fichier==None : fichier=options.comm[0] + if code == None : code=options.code + + from .qtEficas import Appli + Eficas=Appli(code=code,salome=0,ssCode=ssCode,ssIhm=True,langue=langue) + + from .ssIhm import QWParentSSIhm + parent=QWParentSSIhm(code,Eficas,version) + + from . import readercata + if not hasattr ( Eficas, 'readercata'): + monreadercata = readercata.ReaderCata( parent, Eficas ) + Eficas.readercata=monreadercata + + from .editor import JDCEditor + monEditeur=JDCEditor(Eficas,fichier) + return monEditeur + +def lanceEficas_ssIhm_chercheGroupes(code=None,fichier=None,ssCode=None,version=None): + monEditeur=lanceEficas_ssIhm(code,fichier,ssCode,version) + print((monEditeur.chercheGroupes())) + +def lanceEficas_ssIhm_cherche_cr(code=None,fichier=None,ssCode=None,version=None): + monEditeur=lanceEficas_ssIhm(code,fichier,ssCode,version) + print((monEditeur.jdc.cr)) + +def lanceEficas_ssIhm_reecrit(code=None,fichier=None,ssCode=None,version=None,ou=None,cr=False,debug=False,leger=False,langue='ang'): + #print 'lanceEficas_ssIhm_reecrit', fichier + monEditeur=lanceEficas_ssIhm(code,fichier,ssCode,version,langue=langue) + if ou == None : + fileName=fichier.split(".")[0]+"_reecrit.comm" + fn=fichier.split(".")[0]+"_cr.txt" + else : + f=fichier.split(".")[0]+"_reecrit.comm" + f1=os.path.basename(f) + fn=fichier.split(".")[0]+"_cr.txt" + f2=os.path.basename(fn) + fileName=os.path.join(ou,f1) + fileCr=os.path.join(ou,f2) + debut=False + if debug : + import cProfile, pstats, StringIO + pr = cProfile.Profile() + pr.enable() + monEditeur.saveFileAs(fileName=fileName) + pr.disable() + s = StringIO.StringIO() + sortby = 'cumulative' + ps = pstats.Stats(pr, stream=s).sort_stats(sortby) + ps.print_stats() + print (s.getValue()) + + elif not leger : monEditeur.saveFileAs(fileName=fileName) + else : monEditeur.saveFileLegerAs(fileName=fileName) + if cr: + f = open(fileCr, 'w') + f.write(str(monEditeur.jdc.report())) + f.close() + +def lanceEficas_param(code='Adao',fichier=None,version='V0',macro='ASSIMILATION_STUDY'): + """ + Lance l'appli EFICAS pour trouver les noms des groupes + """ + # Analyse des arguments de la ligne de commande + from Editeur import session + options=session.parse(sys.argv) + + from .qtEficas import Appli + #app = QApplication(sys.argv) + #Eficas=Appli(code=code,ssCode=None,salome=0) + + from .ssIhm import QWParentSSIhm + Eficas=QWParentSSIhm(code,version) + + from . import readercata + if not hasattr ( Eficas, 'readercata'): + monreadercata = readercata.ReaderCata( parent, Eficas ) + Eficas.readercata=monreadercata + + from .editor import JDCEditor + monEditeur=JDCEditor(Eficas,fichier) + texte=loadJDC(fichier) + parameters=getJdcParameters(texte,macro) + return parameters + +#def getEficasSsIhm(code='Adao',versionCode='V0'): +# from .qtEficasSsIhm import AppliSsIhm +# Eficas=AppliSsIhm(code=code,ssCode=None,salome=0) +# return Eficas + +def getJdcParameters(jdc,macro): + """ + This function converts the data from the specified macro of the + specified jdc text to a python dictionnary whose keys are the + names of the data of the macro. + """ + context = {} + source = "def args_to_dict(**kwargs): return kwargs \n" + source+= "%s = _F = args_to_dict \n"%macro + source+= "parameters="+jdc+" \n" + source+= "context['parameters'] = parameters \n" + code = compile(source, 'file.py', 'exec') + eval(code) + parameters = context['parameters'] + return parameters + +def loadJDC(filename): + """ + This function loads the text from the specified JdC file. A JdC + file is the persistence file of Eficas (*.comm). + """ + fcomm=open(filename,'r') + jdc = "" + for line in fcomm.readlines(): + if not (line[0]=='#'): + jdc+="%s"%line + + # Warning, we have to make sure that the jdc comes as a simple + # string without any extra spaces/newlines + return jdc.strip() + +def lanceEficas_Web(code=None,fichier=None,ssCode=None,version=None,debug=False,langue='en',multi=False,versionCode=None): + from Editeur import session + options=session.parse(sys.argv) + if version!=None and options.cata == None : options.cata=version + if fichier==None and options.comm != [] : fichier=options.comm[0] + if code == None : code=options.code + + from .qtEficasSsIhm import AppliSsIhm + Eficas=AppliSsIhm(code=code,salome=0,ssCode=ssCode,multi=multi,langue=langue,versionCode=versionCode) + + from .ssIhm import QWParentSSIhm + parent=QWParentSSIhm(code,Eficas,version) + + from . import readercata + if not hasattr ( Eficas, 'readercata'): + monreadercata = readercata.ReaderCata( parent, Eficas ) + Eficas.readercata=monreadercata + + from .editor import JDCEditor + monEditeur=JDCEditor(Eficas,fichier) + return monEditeur + + +if __name__ == "__main__": + import sys + sys.path.insert(0,os.path.abspath(os.path.join(os.getcwd(),'..'))) + lanceEficas(code=None,fichier=None,ssCode=None,multi=True) + + diff --git a/InterfaceSsIhm/getVersion.py b/InterfaceSsIhm/getVersion.py new file mode 100644 index 00000000..a4976d08 --- /dev/null +++ b/InterfaceSsIhm/getVersion.py @@ -0,0 +1,55 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +# Management of EFICAS version numbering. +# A version has at least major and minor numbers, for easier comparison. + +__version = { + 'major': 9, + 'minor': 3 + } + +def getEficasVersion(): + """ + Return the EFICAS current version number. + """ + return "%s.%s"%(getMajor(),getMinor()) +# + +def getSalomeVersion(): + """ + Return the SALOME version number to which current EFICAS version is related. + """ + return getEficasVersion() +# + +def getMajor(): + return __version['major'] +# + +def getMinor(): + return __version['minor'] +# + +def getBaseVersion(): + """ + Returns [ major, minor ] array of integers. + """ + return [ getMajor(), getMinor() ] +# diff --git a/InterfaceSsIhm/qtEficasSsIhm.py b/InterfaceSsIhm/qtEficasSsIhm.py new file mode 100755 index 00000000..af26c198 --- /dev/null +++ b/InterfaceSsIhm/qtEficasSsIhm.py @@ -0,0 +1,172 @@ +# -*- coding: iso-8859-1 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str +except : pass + +import os, sys +import six + +from Extensions.eficas_exception import EficasException +from Extensions import param2 + +from .getVersion import getEficasVersion +from .viewManagerSsIhm import MyViewManagerSsIhm + + +class AppliSsIhm: + """ + Class implementing the main user interface. + """ + def __init__(self,code=None,salome=1,parent=None,ssCode=None,multi=False,langue='fr',ssIhm=True,versionCode=None): + """ + Constructor + """ + version=getEficasVersion() + self.VERSION_EFICAS="Eficas QT5 Salome " + version + self.versionCode=versionCode + + self.salome=salome + self.ssIhm=True + self.code=code + + self.dict_reels={} + self.fichierIn=None + self.fichierOut=None + + self.recent = [] + self.ficRecents={} + self.mesScripts={} + self.listeAEnlever=[] + self.ListePathCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + self.listeCode=['Adao','ADAO','Carmel3D','Telemac','CF','MAP','ZCracks', 'SEP','SPECA','PSEN_Eficas','PSEN_N1'] + self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons') + + if self.salome: + import Accas + try : + import eficasSalome + Accas.SalomeEntry = eficasSalome.SalomeEntry + except : + print ('eficas hors salome') + + self.multi=multi + if self.multi : + print ('pas de multi sans ihm') + + + if langue=='fr': self.langue=langue + else : self.langue="ang" + + if self.multi == False : + self.definitCode(code,ssCode) + if code==None: return + + self.suiteTelemac=False + self.viewmanager=MyViewManagerSsIhm(self) + + + def definitCode(self,code,ssCode) : + self.code=code + self.ssCode=ssCode + if self.code == None:return # pour le cancel de la fenetre choix code + + name='prefs_'+self.code + prefsCode=__import__(name) + + self.repIni=prefsCode.repIni + if ssCode != None : + self.format_fichier= ssCode #par defaut + prefsCode.NAME_SCHEME=ssCode + else : + self.format_fichier="python" #par defaut + + nameConf='configuration_'+self.code + configuration=__import__(nameConf) + self.maConfiguration = configuration.make_config(self,prefsCode.repIni) + + if hasattr (self,'maConfiguration') and self.maConfiguration.translatorFichier : + from Extensions import localisation + localisation.localise(None,self.langue,translatorFichier=self.maConfiguration.translatorFichier) + + + def getSource(self,file): + # appele par Editeur/session.py + import convert + p=convert.plugins['python']() + p.readfile(file) + texte=p.convert('execnoparseur') + return texte + + + def initEditor(self,fichier = None,jdc = None, units = None,include=0): + if self.editor != None : + print ('un seul editeur par appli') + sys.Exit() + self.editor = JDCEditorSsIhm(self,fichier, jdc, self.myQtab,units=units,include=include) + + + def fileNew(self): + self.editor=initEditor(self) + + def getEditor(self): + return self.editor + + def fileOpen(self,fichier): + fichierIn = os.path.abspath(six.text_type(fichier)) + try: + monEditor=self.viewmanager.handleOpen(fichierIn) + except EficasException as exc: + print ('poum') + monEditor=None + return monEditor + + def fileSave(self): + if self.editor == None : return False + ok, newName = editor.saveFileAs() + print ('ok, newName ',ok, newName) + + def fileSaveAs(self,fileName): + if self.editor == None : return False + ok = editor.saveFileAs() + print ('ok ',ok) + + def dumpXsd(self): + current_cata = CONTEXT.getCurrentCata() + current_cata.dumpXsd() + if self.maConfiguration.afficheIhm==False : exit() + +#,self.fileSaveAs +#,self.fileClose +#,self.fileExit +#,self.jdcRapport +#,self.jdcRegles +#,self.jdcFichierSource +#,self.visuJdcPy + + + +if __name__=='__main__': + + # Modules Eficas + monEficas= AppliSsIhm(code='Adao',salome=0,versionCode='V83') diff --git a/InterfaceSsIhm/readercata.py b/InterfaceSsIhm/readercata.py new file mode 100644 index 00000000..a2ee29fa --- /dev/null +++ b/InterfaceSsIhm/readercata.py @@ -0,0 +1,445 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module sert a lire un catalogue et a construire + un objet CataItem pour Eficas. + Il s'appuie sur la classe READERCATA +""" +# Modules Python +from __future__ import absolute_import +from __future__ import print_function +try : + from builtins import str + from builtins import object +except : pass + +import os, sys + +# Modules Eficas +from Noyau.N_CR import CR +from Editeur.catadesc import CatalogDescription + +import analyse_catalogue +import analyse_catalogue_initial +import autre_analyse_cata +import uiinfo +from Extensions.i18n import tr +from Extensions.eficas_exception import EficasException + + +#------------------------------- +class ReaderCataCommun(object): +#------------------------------- + + def askChoixCatalogue(self, cataListeChoix): + # ____________________________________________ + """ + Ouvre une fenetre de selection du catalogue dans le cas où plusieurs + ont ete definis dans Accas/editeur.ini + """ + try : + from PyQt5.QtWidgets import QDialog + except : + print ('Pas de choix interactif sans qt') + return + + code = getattr(self.appliEficas.maConfiguration, "code", None) + if code != None : + title=tr("Choix d une version du code ")+str(code) + else : + title=tr("Choix d une version ") + + from InterfaceQT4.monChoixCata import MonChoixCata + widgetChoix = MonChoixCata(self.appliEficas, [cata.labelCode for cata in cataListeChoix], title) + ret=widgetChoix.exec_() + + + lab=str(self.VERSION_EFICAS)+" " + lab+=tr(" pour ") + lab+=str(self.code) + lab+=tr(" avec le catalogue ") + if ret == QDialog.Accepted: + cata = cataListeChoix[widgetChoix.CBChoixCata.currentIndex()] + self.fichierCata = cata.fichierCata + self.labelCode = cata.labelCode + self.appliEficas.formatFichierOut = cata.formatFichierOut + self.appliEficas.formatFichierIn = cata.formatFichierIn + lab+=self.labelCode + self.appliEficas.setWindowTitle(lab) + widgetChoix.close() + else: + widgetChoix.close() + raise EficasException() + + def choisitCata(self): + # ____________________ + + + listeCataPossibles=[] + self.Commandes_Ordre_Catalogue=[] + + + listeTousLesCatas = [] + for catalogue in self.appliEficas.maConfiguration.catalogues: + if isinstance(catalogue, CatalogDescription): listeTousLesCatas.append(catalogue) + elif isinstance(catalogue, tuple) : listeTousLesCatas.append(CatalogDescription.createFromTuple(catalogue)) + else: print(("Catalog description cannot be interpreted: ", catalogue)) + + # This filter is only useful for codes that have subcodes (like MAP). + # Otherwise, the "code" attribute of the catalog description can (should) be None. + if self.ssCode is None: listeCataPossibles = listeTousLesCatas + else: + for catalogue in listeTousLesCatas: + if catalogue.code == self.code and catalogue.ssCode == self.ssCode: listeCataPossibles.append(catalogue) + + # le catalogue est fixe dans la ligne de commande + if self.appliEficas.fichierCata != None : + trouve=False + for catalogue in listeTousLesCatas: + if os.path.abspath(catalogue.fichierCata) == (os.path.abspath(self.appliEficas.fichierCata)) : + listeCataPossibles=(catalogue,) + trouve=True + break + if not trouve: + catalogue=CatalogDescription.createFromTuple((self.code ,self.code,self.appliEficas.fichierCata,'python','python')) + listeCataPossibles=(catalogue,) + + + if len(listeCataPossibles)==0: + try : + from PyQt5.QtWidgets import QMessageBox, QDialog + QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + tr("Pas de catalogue defini pour le code ") + self.code) + except : + print ("Pas de catalogue defini pour le code " + self.code) + self.appliEficas.close() + if self.appliEficas.salome == 0 : sys.exit(1) + return + + + # le label est fixe dans la ligne de commande + if self.labelCode is not None: + # La version a ete fixee + for cata in listeCataPossibles: + if self.labelCode == cata.labelCode: + self.fichierCata = cata.fichierCata + self.appliEficas.formatFichierIn = cata.formatFichierIn + self.appliEficas.formatFichierOut = cata.formatFichierOut + else: + cataListeChoix = [] + for cata in listeCataPossibles: + if cata.default : cataListeChoix.insert(0, cata) + else : cataListeChoix.append(cata) + + if len(cataListeChoix) == 0: + try : + from PyQt5.QtWidgets import QMessageBox + QMessageBox.critical(self.QWParent, tr("Import du catalogue"), + tr("Aucun catalogue trouve")) + except : + print ("Pas de catalogue defini pour le code " + self.code) + self.appliEficas.close() + if self.appliEficas.salome == 0 : sys.exit(1) + + elif len(cataListeChoix) == 1: + self.fichierCata = cataListeChoix[0].fichierCata + self.labelCode = cataListeChoix[0].labelCode + self.appliEficas.formatFichierOut = cataListeChoix[0].formatFichierOut + self.appliEficas.formatFichierIn = cataListeChoix[0].formatFichierIn + + else: + # plusieurs catalogues sont disponibles : il faut demander a l'utilisateur + # lequel il veut utiliser ... + if self.appliEficas.ssIhm : + print ('Unable to know which catafile is choosen') + exit() + self.askChoixCatalogue(cataListeChoix) + self.demandeCatalogue=True + + if self.fichierCata == None : + if self.appliEficas.salome == 0 : + print(("Pas de catalogue pour code %s, version %s" %(self.code,self.labelCode))) + sys.exit(1) + else : + self.appliEficas.close() + return + + +#------------------------------------ +class ReaderCata (ReaderCataCommun): +#------------------------------------ + + def __init__(self,QWParent, appliEficas): + # _______________________________________ + + + self.QWParent=QWParent + self.appliEficas=self.QWParent.appliEficas + self.VERSION_EFICAS=self.appliEficas.VERSION_EFICAS + self.demandeCatalogue=False + self.code=self.appliEficas.code + self.ssCode=self.appliEficas.ssCode + # on positionne par defaut mais est-ce vraiment necessaire + self.appliEficas.formatFichierIn='python' + self.appliEficas.formatFichierOut='python' + self.labelCode=self.appliEficas.labelCode + self.fichierCata=self.appliEficas.fichierCata + self.openCata() + self.traiteIcones() + self.cataitem=None + self.creeDicoInverse() + if self.code=="TELEMAC": self.creeDicoCasToCata() + + + def openCata(self): + """ + Ouvre le catalogue standard du code courant, cad le catalogue present + dans le repertoire Cata + """ + # import du catalogue + self.choisitCata() + + self.cata = self.importCata(self.fichierCata) + if self.code == 'NonConnu' : self.code = self.cata.JdC.code + modeleMetier = None + dicoEltDif = {} + if not (self.appliEficas.genereXSD) : + if (self.appliEficas.maConfiguration.withXSD or self.appliEficas.withXSD) : + try : + import pyxb + except : + self.QWParent.informe('environnement', 'please source pyxb environment') + exit() + try : + nomCataXsd = os.path.splitext(os.path.basename(self.fichierCata))[0] + fichierCataTrunc=os.path.splitext(os.path.basename(self.fichierCata))[0] + nomCataXsd = fichierCataTrunc+'_driver' + pathCata = os.path.dirname(self.fichierCata)+'/raw/'+nomCataXsd+'.py' + print ('nomCataXsd , pathCata ',nomCataXsd,pathCata) + import imp + modeleMetier= imp.load_source(nomCataXsd,pathCata) + print ('nomCataXsd , pathCata ',nomCataXsd,pathCata) + try : + #if 1 : + #monObjetAnnotation = getattr(modeleMetier,'PNEFdico_'+self.code) + monObjetAnnotation = getattr(modeleMetier,'PNEFdico') + texte=monObjetAnnotation.__doc__ + except : + texte=None + if texte != None and texte != "": + l={} + texte='dicoEltDif = '+ texte + exec (texte, globals(),l) + dicoEltDif=l['dicoEltDif'] + #print ('dans readerCata _________', dicoEltDif) + + except : + if self.appliEficas.ssIhm == False :print ('______________ poum import cata_genere ') + self.QWParent.informe('XSD driver', 'unable to load xsd driver',critique=False) + modeleMetier = None + + self.cata.DicoNomTypeDifferentNomElt=dicoEltDif + + if hasattr(self.cata, 'implement'): self.cata.JdC.implement = self.cata.implement + else : self.cata.JdC.implement = "" + if hasattr(self.cata, 'importedBy'): self.cata.JdC.importedBy = self.cata.importedBy + else : self.cata.JdC.importedBy = [] + self.cata.JdC.labelCode = self.labelCode + if not(hasattr(self.cata, 'dict_condition')): self.cata.dict_condition = {} + + # pointeur pour le dumpXSD + self.cata.JdC.cata=self.cata + + self.cata.modeleMetier = modeleMetier + if not self.cata : + #try: + #from PyQt5.QtWidgets import QMessageBox, QDialog + #QMessageBox.critical( self.QWParent, tr("Import du catalogue"),tr("Impossible d'importer le catalogue ")+ self.fichierCata) + #except : + # print ("Impossible d'importer le catalogue "+ self.fichierCata) + self.QWParent.informe("Catalogue","Impossible d'importer le catalogue "+ self.fichierCata) + self.appliEficas.close() + if self.appliEficas.salome == 0 : + sys.exit(1) + # + # analyse du catalogue (ordre des mots-cles) + # + # retrouveOrdreCataStandard fait une analyse textuelle du catalogue + # remplace par retrouveOrdreCataStandardAutre qui utilise une numerotation + # des mots cles a la creation + #print (dir(self.cata)) + self.retrouveOrdreCataStandardAutre() + if self.appliEficas.maConfiguration.modeNouvCommande == "initial" : self.retrouveOrdreCataStandard() + if hasattr(self.cata, 'Ordre_Des_Commandes') : self.Ordre_Des_Commandes=self.cata.Ordre_Des_Commandes + else : self.Ordre_Des_Commandes=None + + if hasattr(self.cata, 'Classement_Commandes_Ds_Arbre') : + self.Classement_Commandes_Ds_Arbre=self.cata.Classement_Commandes_Ds_Arbre + else : self.Classement_Commandes_Ds_Arbre=() + if hasattr(self.cata,'enum'): + try : + _temp= __import__(self.cata.enum,globals(), locals(), ['DicoEnumCasFrToEnumCasEn', 'TelemacdicoEn'], 0) + self.DicoEnumCasFrToEnumCasEn = _temp.DicoEnumCasFrToEnumCasEn + self.TelemacdicoEn = _temp.TelemacdicoEn + except : pass + + #print self.cata.Ordre_Des_Commandes + + # + # analyse des donnees liees l'IHM : UIinfo + # + uiinfo.traite_UIinfo(self.cata) + + # + # traitement des clefs documentaires + # + + self.titre=self.VERSION_EFICAS+" "+tr( " avec le catalogue ") + os.path.basename(self.fichierCata) + if self.appliEficas.ssIhm == False : self.appliEficas.setWindowTitle(self.titre) + self.appliEficas.titre=self.titre + self.QWParent.titre=self.titre + + + def importCata(self,cata): + """ + Realise l'import du catalogue dont le chemin d'acces est donne par cata + """ + nom_cata = os.path.splitext(os.path.basename(cata))[0] + rep_cata = os.path.dirname(cata) + sys.path[:0] = [rep_cata] + self.appliEficas.listeAEnlever.append(rep_cata) + + # PNPNPN pas propre __ A reflechir + if 'cata_Vimmp' in list(sys.modules.keys()) : + del sys.modules['cata_Vimmp'] + + if nom_cata in list(sys.modules.keys()) : + del sys.modules[nom_cata] + + for k in sys.modules: + if k[0:len(nom_cata)+1] == nom_cata+'.': + del sys.modules[k] + + mesScriptsNomFichier='mesScripts_'+self.code.upper() + try : + self.appliEficas.mesScripts[self.code]=__import__(mesScriptsNomFichier) + except: + pass + + #if 1 : + try : + o=__import__(nom_cata) + return o + except Exception as e: + self.QWParent.informe('catalog', 'unable to load catalog file') + import traceback + traceback.print_exc() + return 0 + + + + def retrouveOrdreCataStandardAutre(self): + """ + Construit une structure de donnees dans le catalogue qui permet + a EFICAS de retrouver l'ordre des mots-cles dans le texte du catalogue. + Pour chaque entite du catlogue on cree une liste de nom ordre_mc qui + contient le nom des mots cles dans le bon ordre + """ + self.cata_ordonne_dico, self.appliEficas.liste_simp_reel=autre_analyse_cata.analyseCatalogue(self.cata) + #print ('_________________________________________', self) + #print (self.cata_ordonne_dico) + #self.appliEficas.liste_simp_reel = () + #self.cata_ordonne_dico = {} + + def retrouveOrdreCataStandard(self): + """ + Retrouve l'ordre des mots-cles dans le catalogue, cad : + Attention s appuie sur les commentaires + """ + nom_cata = os.path.splitext(os.path.basename(self.fichierCata))[0] + rep_cata = os.path.dirname(self.fichierCata) + self.Commandes_Ordre_Catalogue = analyse_catalogue_initial.analyseCatalogue(self.fichierCata) + #print self.Commandes_Ordre_Catalogue + + def traiteIcones(self): + if self.appliEficas.maConfiguration.ficIcones==None : return + try: + ficIcones=self.appliEficas.maConfiguration.ficIcones + fichierIcones = __import__(ficIcones, globals(), locals(), [], 0) + self.appliEficas.maConfiguration.dicoIcones=fichierIcones.dicoDesIcones.dicoIcones + self.appliEficas.maConfiguration.dicoImages=fichierIcones.dicoDesIcones.dicoImages + except: + print ("Pas de fichier associe contenant des liens sur les icones ") + self.appliEficas.maConfiguration.dicoIcones={} + + + + def creeDicoInverse(self): + self.dicoInverse={} + self.dicoMC={} + listeEtapes=self.cata.JdC.commandes + for e in self.cata.JdC.commandes: + self.traiteEntite(e) + + + def creeDicoCasToCata(self): + if hasattr(self.cata,'dicoCasEn'): + _temp= __import__(self.cata.dicoCasEn,globals(), locals(), ['DicoCasEnToCata'], 0) + if self.appliEficas.langue=="ang" : + self.dicoCasToCata=_temp.dicoCasEnToCata + else : + self.dicoCasToCata=_temp.dicoCasFrToCata + + + + def traiteEntite(self,e): + boolIn=0 + for (nomFils, fils) in list(e.entites.items()) : + self.dicoMC[nomFils]=fils + self.traiteEntite(fils) + boolIn=1 + if boolIn==0 : + liste=[] + moi=e + while hasattr(moi,'pere') : + liste.append((moi.nom,moi)) + moi=moi.pere + liste.append((moi.nom,moi)) + self.dicoInverse[e.nom]=liste + self.dicoInverse[tr(e.nom)]=liste + + def creeRubrique(self,e,dico, niveau): + from Accas import A_BLOC + decale=niveau*" " + #if niveau != 0 : + # if isinstance(e,A_BLOC.BLOC): print decale, e.condition + # else : print decale, e. nom + for (nom, fils) in list(e.entites.items()) : + if list(fils.entites.items()) != [] : self.creeRubrique(fils,dico,niveau+1) + #else : print (niveau+1)*" ", nom + + + #def dumpToXsdEficas(self): + # Pas sur qu on ait jamais besoin de cela + # pass + #from Efi2Xsd import readerEfficas + #newSchema= xml = open('Cata_MED_FAM.xml').read() + #SchemaMed = efficas.CreateFromDocument(xml) + #SchemaMed.alimenteCata(self.cata) diff --git a/InterfaceSsIhm/readercataXML.py b/InterfaceSsIhm/readercataXML.py new file mode 100644 index 00000000..c8baede1 --- /dev/null +++ b/InterfaceSsIhm/readercataXML.py @@ -0,0 +1,84 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module sert a lire un catalogue et a construire + un objet CataItem pour Eficas. + Il s'appuie sur la classe READERCATA +""" +# Modules Python +import sys, os +import autre_analyse_cata + + +# Modules Eficas + +from monChoixCata import MonChoixCata +from Extensions.i18n import tr +from Extensions.eficas_exception import EficasException +import uiinfo +from Efi2Xsd import readerEfiXsd +# ATtention pas teste depuis le chgt de nom + +from readercata import ReaderCataCommun + +class ReaderCata (ReaderCataCommun): + + def __init__(self,QWParent, appliEficas): + self.QWParent=QWParent + self.appliEficas=appliEficas + self.VERSION_EFICAS=self.appliEficas.VERSION_EFICAS + self.code=self.appliEficas.code + self.ssCode=self.appliEficas.ssCode + # PN ?? bizarre le 22/04/20 + self.appliEficas.formatfichierOut='python' + self.appliEficas.formatfichierIn ='xml' + self.modeNouvCommande=self.appliEficas.maConfiguration.modeNouvCommande + self.labelCode=self.appliEficas.labelCode + self.version_cata=None + self.ficCata=None + self.OpenCata() + self.cataitem=None + self.titre='Eficas XML' + self.Ordre_Des_Commandes=None + self.Classement_Commandes_Ds_Arbre=() + self.demandeCatalogue=False + + #self.traiteIcones() + #self.creeDicoInverse() + + + def OpenCata(self): + + #self.ficCata = 'Cata_MED_FAM.xml' + #xml = open('/home/A96028/QT5GitEficasTravail/eficas/Med/Cata_MED_FAM.xml').read() + #xml = open('/home/A96028/QT5GitEficasTravail/eficas/CataTestXSD/cata_test1.xml').read() + self.choisitCata() + xml=open(self.ficCata).read() + SchemaMed = readerEfiXsd.efficas.CreateFromDocument(xml) + SchemaMed.exploreCata() + self.cata=SchemaMed + uiinfo.traite_UIinfo(self.cata) + self.Commandes_Ordre_Catalogue=[] + self.cata_ordonne_dico,self.appliEficas.liste_simp_reel=autre_analyse_cata.analyseCatalogue(self.cata) + self.liste_groupes=None + + def dumpToXml(self): + # pour compatibilite + pass diff --git a/InterfaceSsIhm/viewManagerSsIhm.py b/InterfaceSsIhm/viewManagerSsIhm.py new file mode 100644 index 00000000..6d83df3c --- /dev/null +++ b/InterfaceSsIhm/viewManagerSsIhm.py @@ -0,0 +1,416 @@ +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# + +from __future__ import absolute_import +try : + from builtins import str + from builtins import object +except : pass + +import os +from Extensions.i18n import tr +import six +from PyQt5.QtWidgets import QFileDialog, QMessageBox +from PyQt5.QtCore import QFileInfo + +# -------------------------------- +class JdcSsIhmHandler(object): +# -------------------------------- +# retourne a l utilisateur + + def __init__(self,viewManager): +# -------------------------------------- + self.viewManagerSsIhm=viewManager + + def viewJdcPy(self) : +# --------------------- + self.viewManagerSsIhm.handleViewJdcPy(self) + + def viewJdcSource(self) : +# --------------------- + self.viewManagerSsIhm.handleViewJdcSource(self) + + def getFileName(self): +# --------------------- + self.viewManagerSsIhm.getFileName(self) + + def viewJdcRapport(self) : +# --------------------- + self.viewManagerSsIhm.handleViewJdcRapport(self) + + def getJdcRapport(self) : +# --------------------- + return self.viewManagerSsIhm.handleGetJdcRapport(self) + + def getDicoPython(self) : +# ------------------------- + return self.viewManagerSsIhm.generDico(self) + + def isJdcValid(self) : +# ------------------------- + return self.viewManagerSsIhm.isJdcValid(self) + + def fileSaveAs(self,fileName): +# ------------------------- + return self.viewManagerSsIhm.fileSaveAs(self,fileName) + + def fileLegerSaveAs(self,fileName): +# ----------------------------------- + return self.viewManagerSsIhm.fileLegerSaveAs(self,fileName) + + + +#-------------------------------- +class MyViewManagerSsIhm(object): +#-------------------------------- +# Symetrique de ViewManager mais pas d heritage entre les 2 +# dans le viewManager pas de souci pour savoir qui est le jdc sur lequel on travaille +# ici en revanche.... c est moins sur + +# -------------------------------- + def __init__(self,appliEficas): +# -------------------------------- + self.appliEficas=appliEficas + self.tabWidgets = [] + self.mesIndexes = {} + self.dictEditors={} + self.untitledCount = 0 + self.doubles = {} + +# ------------------------------------------------------ + def handleOpen(self,fichier=None, units=None): +# ------------------------------------------------------ + result = None + if fichier is None: + print ('nom de fichier obligatoire') + return None + + for handler in self.dictEditors : + editor=self.dictEditors[handler] + if self.samePath(fichier, editor.getFileName()): + print ('fichier deja ouvert . pas de nouvel editor') + return handler + + monNewHandler = self.getNewEditor(fichier,units) + return monNewHandler + +# ---------------------------------------------------------------------- + def getNewEditor(self,fichier = None,jdc = None, units = None,include=0): +# ---------------------------------------------------------------------- + + from .editorSsIhm import JDCEditorSsIhm + editor = JDCEditorSsIhm(self.appliEficas,fichier,jdc, units=units,include=include) + + if editor.jdc: # le fichier est bien un jdc + monHandler = JdcSsIhmHandler(self) + self.dictEditors[monHandler]=editor + return monHandler + else: + print ('impossible de construire le jdc') + return None + +# ----------------------------- + def samePath(self,f1, f2): +# ------------------------------ + """ + compare two paths. + """ + if f1 is None or f2 is None: return 0 + if os.path.normcase(os.path.normpath(f1)) == os.path.normcase(os.path.normpath(f2)) : return 1 + return 0 + +# --------------------------------- + def handleViewJdcPy(self,handler): +# --------------------------------- + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + self.dictEditors[handler].viewJdcPy() + +# --------------------------------- + def getFileName(self,handler): +# --------------------------------- + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + return self.dictEditors[handler].getFileName() + + +# --------------------------------------------- + def handleViewJdcSource(self,handler): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + self.dictEditors[handler].viewJdcSource() + + +# --------------------------------------------- + def handleViewJdcRapport(self,handler): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + self.dictEditors[handler].viewJdcRapport() + +# --------------------------------------------- + def handleGetJdcRapport(self,handler): +# --------------------------------------------- + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + return self.dictEditors[handler].getJdcRapport() + +# --------------------------------------------- + def handleViewJdcRapport(self,handler): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + self.dictEditors[handler].viewJdcRapport() + + +# --------------------------------------------- + def generDico(self,handler): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + return self.dictEditors[handler].generDico() + + +# --------------------------------------------- + def isJdcValid(self,handler): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + return self.dictEditors[handler].jdc.isValid() + + +# --------------------------------------------- + def fileSaveAs(self,handler,fileName): +# --------------------------------------------- + print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + return self.dictEditors[handler].saveFile(fileName) + +# --------------------------------------------- + def fileLegerSaveAs(self, handler,fileName): +# --------------------------------------------- +# print (handler) + if not (handler in self.dictEditors) : + print ('editor non trouve') + return + self.dictEditors[handler].saveFileLegerAs(fileName) + + +# def handleClose(self,doitSauverRecent = 1,texte=tr('&Quitter')): +# if doitSauverRecent : self.appliEficas.sauveRecents() +# index=self.myQtab.currentIndex() +# if index < 0 : return +# res=self.checkDirty(self.dict_editors[index],texte) +# if res == 2 : return 2 # l utilisateur a annule +# index=self.myQtab.currentIndex() +# idx=index +# while idx < len(self.dict_editors) -1 : +# self.dict_editors[idx]=self.dict_editors[idx+1] +# idx = idx + 1 +# del self.dict_editors[len (self.dict_editors) -1] +# try : +# del self.doubles[self.dict_editors[index]] +# except : +# pass +# self.myQtab.removeTab(index) +# return res +# + +# +# def handleCloseAll(self,texte=tr('Quitter')): +# res=0 +# self.appliEficas.sauveRecents() +# while len(self.dict_editors) > 0 : +# self.myQtab.setCurrentIndex(0) +# res=self.handleClose(0,texte) +# if res==2 : return res # l utilsateur a annule +# return res +# +# +# +# def newEditor(self,include=0): +# if self.appliEficas.demande==True : +# self.appliEficas.definitCode(None,None) +# if self.appliEficas.code == None:return +# maPage=self.getEditor(include=include) +# + +# +# def handleViewJdcRegles(self): +# index=self.myQtab.currentIndex() +# if index < 0 : return +# self.dict_editors[index].viewJdcRegles() +# +# def handleGestionParam(self): +# index=self.myQtab.currentIndex() +# if index < 0 : +# QMessageBox.warning( self.appliEficas,tr(u"Creation Parametre indisponible"),tr(u"les parametres sont lies a un jeu de donnees")) +# return +# self.dict_editors[index].gestionParam() +# +# +# +# def saveCurrentEditor(self): +# index=self.myQtab.currentIndex() +# if index < 0 : return +# editor=self.dict_editors[index] +# if editor in self.doubles : +# QMessageBox.warning( +# None, +# tr("Fichier Duplique"), +# tr("Le fichier ne sera pas sauvegarde."),) +# return +# ok, newName = editor.saveFile() +# if ok : +# fileName=os.path.basename(six.text_type(newName)) +# self.myQtab.setTabText(index,fileName) +# return ok +# +# def saveLegerCurrentEditor(self): +# index=self.myQtab.currentIndex() +# if index < 0 : return +# editor=self.dict_editors[index] +# ok, newName = editor.saveFileLeger() +# return ok +# +# def sauveLigneCurrentEditor(self): +# index=self.myQtab.currentIndex() +# if index < 0 : return +# editor=self.dict_editors[index] +# if editor in self.doubles : +# QMessageBox.warning( +# None, +# tr("Fichier Duplique"), +# tr("Le fichier ne sera pas sauvegarde."),) +# return +# ok, newName = editor.sauveLigneFile() +# if ok : +# fileName=os.path.basename(six.text_type(newName)) +# self.myQtab.setTabText(index,fileName) +# return ok +# +# +# def saveAsCurrentEditor(self): +# index=self.myQtab.currentIndex() +# editor=self.dict_editors[index] +# oldName=editor.fichier +# ok,newName = editor.saveFileAs() +# if ok : +# fileName=os.path.basename(six.text_type(newName)) +# self.myQtab.setTabText(index,fileName) +# if editor in self.doubles : +# if oldName != newName : +# del self.doubles[editor] +# return ok +# +# def displayJDC(self,jdc,fn=None): +# """ +# Public slot to display a file in an editor. +# @param fn name of file to be opened +# # insert filename into list of recently opened files +# """ +# titre=None +# if fn != None : titre=fn.split("/")[-1] +# editor = self.getEditor(fichier= fn, jdc = jdc ,include=1) +# self.appliEficas.addToRecentList(editor.getFileName()) +# + +##PNPNPNPN --> a affiner +# if fichier is None: +# self.untitledCount += 1 +# self.myQtab.addTab(win, tr("Fichier non encore nomme ", self.untitledCount)) +# #self.myQtab.addTab(win, str(self.appliEficas.code)) +# else: +# liste=fichier.split('/') +# txt = liste[-1] +# if not QFileInfo(fichier).isWritable(): +# txt = '%s (ro)' % txt +# self.myQtab.addTab(win,txt ) +# self.myQtab.setCurrentWidget(win) +# self.currentEditor=win +# win.setFocus() +# +# def getOpenStartDir(self) : +# #PN --> Les Preferences +# try : +# userDir=os.path.expanduser("~/Eficas_install/") +# return userDir +# except : +# return "" +# +# +# def checkDirty(self, editor,texte): +# """ +# Private method to check dirty status and open a message window. +# +# @param editor editor window to check +# @return flag indicating successful reset of the dirty flag (boolean) +# """ +# res=1 +# if (editor.modified) and (editor in self.doubles) : +# msgBox = QMessageBox(None) +# msgBox.setWindowTitle(tr("Fichier Duplique")) +# msgBox.setText(tr("Le fichier ne sera pas sauvegarde.")) +# msgBox.addButton(texte,0) +# msgBox.addButton(tr("&Annuler"),1) +# res=msgBox.exec_() +# if res == 0 : return 1 +# return 2 +# if editor.modified: +# fn = editor.getFileName() +# if fn is None: fn = tr('Noname') +# msgBox = QMessageBox(None) +# msgBox.setWindowTitle(tr("Fichier Modifie")) +# msgBox.setText(tr("Le fichier ne sera pas sauvegarde.")) +# msgBox.addButton(tr("&Sauvegarder"),1) +# msgBox.addButton(tr("&Quitter sans sauvegarder"),0) +# msgBox.addButton(tr("&Annuler"),2) +# res=msgBox.exec_() +# if res == 2 : return res +# if res == 0: +# (ok, newName) = editor.saveFile() +# if ok: +# fileName=os.path.basename(six.text_type(newName)) +# index=self.myQtab.currentIndex() +# self.myQtab.setTabText(index,fileName) +# return ok +# return res +# +# def handleAjoutGroup(self,listeGroup): +# index=self.myQtab.currentIndex() +# if index < 0 : return +# editor=self.dict_editors[index] +# editor.handleAjoutGroup(listeGroup) diff --git a/Noyau/CMakeLists.txt b/Noyau/CMakeLists.txt deleted file mode 100644 index e3ce0580..00000000 --- a/Noyau/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py - PATTERN CVS EXCLUDE - ) - - -### Local Variables: -### mode: cmake -### End: diff --git a/Validation/CMakeLists.txt b/Validation/CMakeLists.txt deleted file mode 100644 index e3ce0580..00000000 --- a/Validation/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -# Installation de tous les fichiers Python du repertoire et des sous-repertoires (sauf CVS) -install ( DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DESTINATION ${CMAKE_INSTALL_PREFIX} - FILES_MATCHING PATTERN *.py - PATTERN CVS EXCLUDE - ) - - -### Local Variables: -### mode: cmake -### End: diff --git a/WebTest/cata_essai.py b/WebTest/cata_essai.py new file mode 100644 index 00000000..6d14c596 --- /dev/null +++ b/WebTest/cata_essai.py @@ -0,0 +1,11 @@ +# coding: utf-8 -*- +# + +from Accas import * + +JdC = JDC_CATA(code='Test1',) + +MonProc = PROC(nom='MonProc', + param1 = SIMP(statut='o',typ='R'), +) + diff --git a/WebTest/prefs.py b/WebTest/prefs.py new file mode 100644 index 00000000..8eb6e5ee --- /dev/null +++ b/WebTest/prefs.py @@ -0,0 +1,22 @@ +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +code="Essai" +import sys, os +if os.path.dirname(os.path.abspath(__file__)) not in sys.path : + sys.path.insert(0,os.path.dirname(os.path.abspath(__file__))) diff --git a/WebTest/prefs_Essai.py b/WebTest/prefs_Essai.py new file mode 100644 index 00000000..bc38bb01 --- /dev/null +++ b/WebTest/prefs_Essai.py @@ -0,0 +1,40 @@ +# -*- coding: utf-8 -*- +# maConfiguration MANAGEMENT OF EDF VERSION +# ====================================================================== +# COPYRIGHT (C) 2007-2021 EDF R&D +# THIS PROGRAM 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 2 OF THE LICENSE, OR +# (AT YOUR OPTION) ANY LATER VERSION. +# +# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, +# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. +# +# +# ====================================================================== + +import os,sys +# repIni sert a localiser le fichier editeur.ini +# Obligatoire +repIni=os.path.dirname(os.path.abspath(__file__)) +INSTALLDIR=os.path.join(repIni,'..') +sys.path[:0]=[INSTALLDIR] + + +# lang indique la langue utilisee pour les chaines d'aide : fr ou ang +lang='ang' + +# Codage des strings qui accepte les accents (en remplacement de 'ascii') +encoding='iso-8859-1' +code = 'Essai' + +# +catalogues=( + ('Essai','Essai',os.path.join(repIni,'cata_essai.py'),'python','python'), +) diff --git a/WebTest/qtEficasEssai.py b/WebTest/qtEficasEssai.py new file mode 100755 index 00000000..90d308e4 --- /dev/null +++ b/WebTest/qtEficasEssai.py @@ -0,0 +1,35 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# Copyright (C) 2007-2021 EDF R&D +# +# This library is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 2.1 of the License. +# +# This library 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 +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public +# License along with this library; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# +# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +# +""" + Ce module sert a lancer EFICAS configure pour MAP +""" +# Modules Python +# Modules Eficas +import prefs +name='prefs_'+prefs.code +__import__(name) + +import os, sys +sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)),'..')) + +import prefs +from InterfaceSsIhm import eficas_go +eficas_go.lanceEficas_Web(code=prefs.code) diff --git a/convert/CMakeLists.txt b/convert/CMakeLists.txt deleted file mode 100644 index ca96efdc..00000000 --- a/convert/CMakeLists.txt +++ /dev/null @@ -1,32 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -install ( FILES __init__.py parseur_python.py convert_python.py convert_TELEMAC.py - convert_map.py - DESTINATION ${CMAKE_INSTALL_PREFIX}/convert - ) - - - - -### Local Variables: -### mode: cmake -### End: diff --git a/convert/Parserv5/Makefile b/convert/Parserv5/Makefile deleted file mode 100644 index d75ca643..00000000 --- a/convert/Parserv5/Makefile +++ /dev/null @@ -1,2 +0,0 @@ -tables.py:tables.tag - python Translate.py -force tables.tag diff --git a/convert/Parserv5/README b/convert/Parserv5/README deleted file mode 100644 index 57294e33..00000000 --- a/convert/Parserv5/README +++ /dev/null @@ -1,3 +0,0 @@ -Pour mettre à jour le parser de fichier au format Asterv5, il faut -recompiler le fichier tables.tag en faisant : - make diff --git a/convert/Parserv5/Translate.py b/convert/Parserv5/Translate.py deleted file mode 100644 index 016113de..00000000 --- a/convert/Parserv5/Translate.py +++ /dev/null @@ -1,2498 +0,0 @@ -# -*- coding: utf-8 -*- -# CONFIGURATION MANAGEMENT OF EDF VERSION -# ====================================================================== -# COPYRIGHT (C) 1991 - 2002 EDF R&D WWW.CODE-ASTER.ORG -# THIS PROGRAM 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 2 OF THE LICENSE, OR -# (AT YOUR OPTION) ANY LATER VERSION. -# -# THIS PROGRAM 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 THIS PROGRAM; IF NOT, WRITE TO EDF R&D CODE_ASTER, -# 1 AVENUE DU GENERAL DE GAULLE, 92141 CLAMART CEDEX, FRANCE. -# -# -# ====================================================================== - -#!/bin/env python -d -#!/tools/net/app/Python-1.5.2/bin/python1.5 - -"""Translate - a first attempt at parsing my little language - -Usage: Translate [switches] [] - - -stdout -- write to standard output instead of a file - -force -- write to the even if it already - exists (overwrite any existing file) - - -import -- import tag table from Translate_tags.py, - instead of using the internal table - - -compare -- compare the imported and internal tag tables - (development option!) - - -test -- use our internal test data and write to stdout - -pytag -- use the interpreted tagging engine - -debug -- if -pytag, enable its debugger - -diag -- enable general debugging - Beware that this currently also writes line - numbers to the start of each line in the output, - so it doesn't emit legal Python... - - -help -- show this text - -history -- show the module history - -version -- show the module version - -If is not specified, will be used with its extension -replaced by ".py". -""" - -__author__ = """Tibs (Tony J Ibbs) -tony@lsl.co.uk or tibs@tibsnjoan.demon.co.uk or tibs@bigfoot.com -http://www.tibsnjoan.demon.co.uk/ -""" -__version__ = "0.3 (tiepin) of 1999-11-15" -__history__ = """\ -Originally created 1999-08-13 - -First released version is 0.2 (bootstrap)/1999-09-09, which gave -an idea of how the thing would work, and nearly did. - -Second released version is 0.3 (tiepin)/1999-11-15, which is sufficient -to allow the parser used within this utility to be written in the little -language, translated and then used as such. -""" - -import sys -import os -import string - -# ............................................................ -# How we want to work things - this is fudge for me in initial development -if os.name == "posix": - # Unix at work - DEFAULT_DEBUG = 0 - DEFAULT_PYTAG = 0 -else: - # Windows 95 at home - TEXTTOOLS_PATH = "C:\\Program Files\\Python" - PYTAG_PATH = "C:\\Program Files\\Python\\TextTools\\Examples" - DEFAULT_DEBUG = 0 - DEFAULT_PYTAG = 0 - - if TEXTTOOLS_PATH not in sys.path: - print "Adding",TEXTTOOLS_PATH - sys.path.append(TEXTTOOLS_PATH) - - if PYTAG_PATH not in sys.path: - print "Adding",PYTAG_PATH - sys.path.append(PYTAG_PATH) -# ............................................................ - -# Import the TextTools themselves -# - I'm not personally too keen on import *, but it seems to be -# the recommended thing, so I'll leave it for now... -try: - from TextTools import * -except: - from mx.TextTools import * - #from TextTools.Constants.TagTables import * - #from TextTools.Constants.Sets import * - - -# ------------------------------------------------------------ -# Useful little constants for unpicking the parsed tuples -OBJECT = 0 -LEFT = 1 -RIGHT = 2 -SUBLIST = 3 - -# We want to align inline comments when possible - so this is -# the column at which we will try to place their "#" marks... -COMMENT_COLUMN = 40 - -# Are we (generally) debugging? -DEBUGGING = 0 - -# Do we want a comma after the last tuple (or item) in a table? -WANT_LAST_COMMA = 1 - - -# ------------------------------------------------------------ -def define_tagtable(): - """Returns our tag table, if we're not importing it.""" - - # We are not, initially, going to try for anything very sophisticated - # - just something that will get us bootstrapped, so that I can use the - # "little language" to write more sophisticated stuff (without having - # to worry about dropped commas between tuples, and so on!) - - - # Whitespace is always useful - t_whitespace = (None,AllIn,' \t') - t_opt_whitespace = t_whitespace + (+1,) - - # Comments are fairly simple - t_comment = ('comment',Table, - ((None,Is,'#'), - (None,AllNotIn,'\n\r',MatchOk)) - ) - - # We care about the "content" of the indentation at the start of a line, - # but note that it is optional - t_indent = ('indent',AllIn,' \t') - t_indentation = t_indent + (+1,) # zero indentation doesn't show - - # A string is text within single or double quotes - # (of course, this is an oversimplification, because we should also - # deal with things like "This is a \"substring\"", and it would be - # nice to be able to cope with triple-quoted strings too, but it - # will do for a start) - - # Major bug - doesn't recognised zero length strings... - # (since "AllNotIn" must match at least one character) - t_string = ('str',Table, - ((None,Is,"'",+3,+1), - ('text',AllNotIn,"'"), - (None,Is,"'",MatchFail,MatchOk), - (None,Is,'"'), - ('text',AllNotIn,'"'), - (None,Is,'"'), - )) - - # An integer is a series of digits... - t_integer = ('int',AllIn,number) - - t_signed_integer = ('signed_int',Table, - (('sign',Is,"+",+1,+2), - ('sign',Is,"-",+1,+1), - t_integer - )) - - # Remember to be careful to specify the LONGEST possible match first, - # so that we try for "IsIn" before we try for "Is" (because "IsIn" - # would *match* "Is", leaving us with a spurious "In" hanging around...) - t_operation = ('op',Table, - (('op',Word,"AllInSet", +1,MatchOk), - ('op',Word,"AllIn", +1,MatchOk), - ('op',Word,"AllNotIn", +1,MatchOk), - ('op',Word,"CallArg", +1,MatchOk), - ('op',Word,"Call", +1,MatchOk), - ('op',Word,"EOF", +1,MatchOk), - ('op',Word,"Fail", +1,MatchOk), - ('op',Word,"IsInSet", +1,MatchOk), - ('op',Word,"IsIn", +1,MatchOk), - ('op',Word,"IsNotIn", +1,MatchOk), - ('op',Word,"IsNot", +1,MatchOk), - ('op',Word,"Is", +1,MatchOk), - ('op',Word,"Jump", +1,MatchOk), - ('op',Word,"LoopControl",+1,MatchOk), - ('op',Word,"Loop", +1,MatchOk), - ('op',Word,"Move", +1,MatchOk), - ('op',Word,"NoWord", +1,MatchOk), # alias for WordStart - ('op',Word,"Skip", +1,MatchOk), - ('op',Word,"SubTableInList",+1,MatchOk), - ('op',Word,"SubTable", +1,MatchOk), - ('op',Word,"sFindWord", +1,MatchOk), - ('op',Word,"sWordStart", +1,MatchOk), - ('op',Word,"sWordEnd", +1,MatchOk), - ('op',Word,"TableInList",+1,MatchOk), - ('op',Word,"Table", +1,MatchOk), - ('op',Word,"WordStart", +1,MatchOk), - ('op',Word,"WordEnd", +1,MatchOk), - ('op',Word,"Word", MatchFail,MatchOk), - )) - - # Python keywords - t_keyword = ('keyword',Table, - ((None,Word,"and", +1,+28), - (None,Word,"assert", +1,+27), - (None,Word,"break", +1,+26), - (None,Word,"class", +1,+25), - (None,Word,"continue",+1,+24), - (None,Word,"def", +1,+23), - (None,Word,"del", +1,+22), - (None,Word,"elif", +1,+21), - (None,Word,"else", +1,+20), - (None,Word,"except", +1,+19), - (None,Word,"exec", +1,+18), - (None,Word,"finally", +1,+17), - (None,Word,"for", +1,+16), - (None,Word,"from", +1,+15), - (None,Word,"global", +1,+14), - (None,Word,"if", +1,+13), - (None,Word,"import", +1,+12), - (None,Word,"in", +1,+11), - (None,Word,"is", +1,+10), - (None,Word,"lambda", +1,+9), - (None,Word,"not", +1,+8), - (None,Word,"or", +1,+7), - (None,Word,"pass", +1,+6), - (None,Word,"print", +1,+5), - (None,Word,"raise", +1,+4), - (None,Word,"return", +1,+3), - (None,Word,"try", +1,+2), - (None,Word,"while", MatchFail,+1), - # In order to not recognise things like "in_THIS_CASE" - # we must check that the next character is not legitimate - # within an identifier - (None,IsIn,alpha+'_'+number,+1,MatchFail), - # If it wasn't another identifier character, we need to - # unread it so that it can be recognised as something else - # (so that, for instance, "else:" is seen as "else" followed - # by ":") - (None,Skip,-1) - )) - - # Do the same for mxText commands - t_mxkeyword = ('mxKeyword',Table, - (t_operation, - (None,IsIn,alpha+'_'+number,+1,MatchFail), - (None,Skip,-1) - )) - - # Traditional identifiers - t_identifier = ('identifier',Table, - (t_keyword + (+1,MatchFail), # don't allow Python keywords - t_mxkeyword + (+1,MatchFail), # don't allow mxText commands - (None,IsIn,alpha+'_'), # can't start with a digit - (None,AllIn,alpha+'_'+number,MatchOk)) - ) - - # We don't yet deal with the following with anything in parentheses, - # which means we can't handle functions or command lists, or other - # things which "look like" a tuple - t_argument = ('arg',Table, - (('arg',Word,"Here", +1,MatchOk), # EOF Here, Fail Here - ('arg',Word,"ToEOF", +1,MatchOk), # Move ToEOF - ('arg',Word,"To", +1,MatchOk), # Jump To - ('arg',Word,"ThisTable",+1,MatchOk), # [Sub]Table ThisTable - ('arg',Word,"back", +1,MatchOk), # Skip back - ('arg',Word,"Break", +1,MatchOk), # LoopControl Break - ('arg',Word,"Reset", +1,MatchOk), # LoopControl Reset - t_string + (+1,MatchOk), # e.g., Word "Fred" - t_signed_integer + (+1,MatchOk), # e.g., Skip -4, Move 3 - t_identifier # e.g., Table Fred - )) - - t_plus = ('plus',Table, - (t_opt_whitespace, - (None,Is,"+"), - t_opt_whitespace - )) - - # Arguments can contain "+" - t_plus_arg = ('plusarg',Table, - (t_argument, # start with a single argument - t_plus + (MatchOk,), # if we have a "+" - t_argument, # then we expect another argument - (None,Jump,To,-2), # then look for another "+" - )) - - # Match, for example: - # - t_label = ('label',Table, - ((None,Is,"<"), - t_identifier, - (None,Is,">") - )) - - # Targets for Jump and F:/T: - t_target = ('target',Table, - (('tgt',Word,"next", +1,MatchOk), - ('tgt',Word,"previous", +1,MatchOk), - ('tgt',Word,"repeat", +1,MatchOk), - ('tgt',Word,"MatchOk", +1,MatchOk), - ('tgt',Word,"MatchOK", +1,MatchOk), # For kindness sake - ('tgt',Word,"MatchFail",+1,MatchOk), - t_label - )) - - # A value is either an identifier, or a string, or an integer - t_value = ('val',Table, - (t_identifier +(+1,MatchOk), - t_string +(+1,MatchOk), - t_integer - )) - - # An assignment is (optionally) used in Tuple and Table definitions... - t_assignment = ('assignment',Table, - (t_value, - t_opt_whitespace, - (None,Is,'='), - )) - - # A common error when writing tuples is to miss off the "=" sign - # - the following is used in diagnosing that (see t_bad_tuple below) - # (it's useful to have something with identical structure to the - # "real thing") - t_bad_tagobj = ('tagobj',Table, - (t_string, - )) - - t_bad_assignment = ('assignment',Table, - (t_value, - )) - - # This is the line that starts the definition of a single tuple. - # For the moment, restrict what it gets assigned to to a simple identifier. - # Match, for example: - # Fred is: - t_tupleblock = ('tupleblock',Table, - (t_identifier, - t_whitespace, - (None,Word,"is:") - )) - - # This is the line that starts a new table or sub-table. - # For the moment, we only cope with full Tables. - # NOTE that this is used for the "outer" declaration of a tag table, - # and also for the "inner" declaration of an inner table or sub-table. - # The discrimination between these is done after initial parsing. - # Match, for example: - # 'keyword' = Table is: (inner) - # tagtable = Table is: (outer) - t_tableblock = ('tableblock',Table, - (t_assignment + (+2,+1), # left hand side is optional - t_opt_whitespace, - ('type',Word,"Table",+1,+2), # Either "Table" - ('type',Word,"SubTable"), # or "SubTable" is required - t_whitespace, # whitespace is required - (None,Word,"is:") # "is:" is required - )) - - # This is the line that starts an "if" block - # Match, for example: - # Is "Fred": - # controlsymbol: - t_ifblock = ('ifblock',Table, - (t_assignment + (+2,+1), # left hand side is optional - t_opt_whitespace, - t_operation + (+4,+1), - t_whitespace, - t_plus_arg, - (None,Is,":",MatchFail,MatchOk), - t_identifier, - (None,Is,":") - )) - - # Note that we don't allow spaces WITHIN our false and true thingies - - t_onfalse = ('onfalse',Table, - (t_whitespace, - (None,Word,"F:"), - t_target - )) - - t_ontrue = ('ontrue',Table, - (t_whitespace, - (None,Word,"T:"), - t_target - )) - - # Valid examples are things like: - # 'fred' = Is "xxx" F: T:MatchOk - # AllIn jim T: - # - # For the moment, we're not trying to recognise things in any detail - t_tuple = ('tuple',Table, - (t_assignment + (+2,+1), # left hand side is optional - t_opt_whitespace, - t_operation, # operation is required - t_whitespace, # for the moment, we always require space here - t_plus_arg, # argument is required - t_onfalse + (+1,+1), # F:target is optional - t_ontrue + (MatchOk,MatchOk) # T:target is also optional - )) - - # If the user has defined a "partial" tuple, they might use something - # of the form: - # match_fred F:MatchFalse T:MatchOk - t_tupleplus = ('tupleplus',Table, - (t_identifier, - t_onfalse + (+1,+1), # F:target is optional - t_ontrue + (MatchOk,MatchOk) # T:target is also optional - )) - - # Treat Jump To specially - for example: - # Jump To - # so that they don't have to do the less obvious "Jump To F: