qt_translator = QTranslator()
eficas_translator = QTranslator()
-def localise(application, locale=None ):
+def localise(application, locale=None,file=None ):
"""
localise(QApplication) -> None
# print "Unable to load Qt base translator!"
global eficas_translator
+ print locale
if locale=="ang" : locale="en"
#print "eficas_" + locale, monPath
+ if file != None :
+ print 'chagrement de ', file,monPath
+ print eficas_translator.load(file,monPath)
+ print QApplication.installTranslator(eficas_translator)
+ return
+
+
if eficas_translator.load("eficas_" + locale, monPath):
QApplication.installTranslator(eficas_translator)
print "chargement eficas_", locale, monPath
if self.jdc.appli.appliEficas.dict_reels[clefobj].has_key(self.valeur):
txt=self.jdc.appli.appliEficas.dict_reels[clefobj][self.valeur]
elif type(self.valeur) in (types.ListType,types.TupleType) :
- if self.valeur==[]: return str(self.valeur)
+ if self.valeur==[] or self.valeur == (): return str(self.valeur)
# Traitement des listes
txt='('
sep=''
#if maDefinition.into != [] and maDefinition.into != None:
# Attention pas fini --> on attend une liste de ASSD avec ordre
if self.item.wait_assd() and self.item.is_list_SansOrdreNiDoublon():
- #print 1
from monWidgetPlusieursInto import MonWidgetPlusieursInto
widget=MonWidgetPlusieursInto(self,maDefinition,monNom,monObjet,parentQt,maCommande)
elif self.item.wait_assd() :
widget=MonWidgetPlusieursASSDIntoOrdonne(self,maDefinition,monNom,monObjet,parentQt,maCommande)
elif self.item.wait_tuple() :
if self.item.object.definition.type[0].ntuple == 2:
- #print 3
from monWidgetPlusieursTuple2 import MonWidgetPlusieursTuple2
widget=MonWidgetPlusieursTuple2(self,maDefinition,monNom,monObjet,parentQt,maCommande)
elif self.item.object.definition.type[0].ntuple == 3 :
- #print 4
from monWidgetPlusieursTuple3 import MonWidgetPlusieursTuple3
widget=MonWidgetPlusieursTuple3(self,maDefinition,monNom,monObjet,parentQt,maCommande)
else :
print "Prevenir la maintenance "
elif self.item.has_into():
if self.item.is_list_SansOrdreNiDoublon():
- #print 6
+ print 6
+ print self.editor.listeDesListesOuvertes
+ print self.item in self.editor.listeDesListesOuvertes
+ print self.editor.afficheListesPliees
if self.item in self.editor.listeDesListesOuvertes or not(self.editor.afficheListesPliees) :
from monWidgetPlusieursInto import MonWidgetPlusieursInto
widget=MonWidgetPlusieursInto(self,maDefinition,monNom,monObjet,parentQt,maCommande)
from monWidgetPlusieursPlie import MonWidgetPlusieursPlie
widget=MonWidgetPlusieursPlie(self,maDefinition,monNom,monObjet,parentQt,maCommande)
else :
- #print 7
+ print 7
# tres vite pour le tag mais devra etre gere dans configuration
if self.item in self.editor.listeDesListesOuvertes or not(self.editor.afficheListesPliees) :
from monWidgetPlusieursIntoOrdonne import MonWidgetPlusieursIntoOrdonne
from monWidgetPlusieursPlie import MonWidgetPlusieursPlie
widget=MonWidgetPlusieursPlie(self,maDefinition,monNom,monObjet,parentQt,maCommande)
else :
- #print 8
+ print 8
if self.item in self.editor.listeDesListesOuvertes or not(self.editor.afficheListesPliees) :
from monWidgetPlusieursBase import MonWidgetPlusieursBase
widget=MonWidgetPlusieursBase(self,maDefinition,monNom,monObjet,parentQt,maCommande)
etape.build_includeInclude(texte)
self.tree.racine.build_children()
-
+ def ajoutMC(self,etape,MCFils,valeurs):
+ print etape.nom
+ #print etape,MCFils,valeurs
+ print dir(etape)
+ #print 'etape' , etape
+ #print MCFils.valeur
+ #print MCFils.val
+ print etape.liste_mc_presents()
+ monMC= etape.addentite('TransfosList')
+ #print etape.append_child
+ #monMC=etape.append_child('TransfosList','last')
+ print etape.liste_mc_presents()
+ # Attention ne pas faire de setValeurs
+ monMC.valeur=valeurs
+ monMC.val=valeurs
+ print monMC.val
+ #print MCFils.valeur
+ #print MCFils.val
+ print etape.liste_mc_presents()
+ print "________"
#-------------------------------------#
from qtEficas import Appli
from Extensions import localisation
app = QApplication(sys.argv)
- #localisation.localise(app,langue)
+ localisation.localise(app,langue)
Eficas=Appli(code=code,ssCode=ssCode,multi=multi,langue=langue)
Eficas.show()
def setNom(self):
self.debutToolTip=""
- print "kkkkkkkkkkkkkkkkkk"
- print self.objSimp.nom
+ #print "kkkkkkkkkkkkkkkkkk"
+ #print self.objSimp.nom
nomTraduit=tr(self.objSimp.nom)
- print nomTraduit
+ #print nomTraduit
#if len(nomTraduit) >= nomMax :
# nom=nomTraduit[0:nomMax]+'...'
# self.label.setText(nomTraduit)
if mc.min == mc.max:
commentaire=tr("Entrez ")+str(mc.min)+tr(" valeurs ")+'\n'
else :
- commentaire=tr("Entrez entre ")+str(mc.min)+tr(" et ")+str(mc.max)+tr(" valeurs ")+'\n'
+ if mc.max != "**" :
+ commentaire=tr("Entrez entre ")+str(mc.min)+tr(" et ")+str(mc.max)+tr(" valeurs ")+'\n'
+ else :
+ commentaire=""
else :
if mc.min == mc.max:
commentaire=tr("Entrez ")+str(mc.min)+" "+tr(d_aides[type])+'\n'
#self.editor.affiche_infos(info)
def reaffiche(self):
- #print "dans reaffiche de feuille", self.nom
+ print "dans reaffiche de feuille", self.nom
if self.editor.jdc.aReafficher==True :
self.parentQt.reaffiche()
import traceback
from determine import monEnvQT5
if monEnvQT5 :
- from PyQt5.QtWidgets import QMessageBox, QFileDialog
+ from PyQt5.QtWidgets import QMessageBox, QFileDialog , QMenu
from PyQt5.QtGui import QIcon
- from PyQt5.QtCore import QFileInfo, Qt, QSize
+ from PyQt5.QtCore import QFileInfo, Qt, QSize, QVariant
else:
from PyQt4.QtGui import *
def setRun(self):
if hasattr(self.editor.appliEficas, 'mesScripts'):
if hasattr(self.editor,'tree') and self.editor.tree.currentItem().item.get_nom() in self.appliEficas.mesScripts.dict_commandes.keys() :
- print 'il faut programmer le self.ajoutScript()'
- print '#PNPNPNPN'
+ self.ajoutScript()
return
if hasattr(self,"RBRun"): self.RBRun.close()
+ if hasattr(self,"CBScripts"): self.CBScripts.close()
def aDetruire(self):
#newNode.fenetre.setFocus()
+ def ajoutScript(self):
+ # cochon mais je n arrive pas a faire mieux avec le mecanisme de plugin
+ listeCommandes=self.appliEficas.mesScripts.dict_commandes[self.node.item.get_nom()]
+ if type(listeCommandes) != types.TupleType: listeCommandes=(listeCommandes,)
+ numero=-1
+ for commande in listeCommandes :
+ numero+=1
+ conditionSalome=commande[3]
+ if (self.appliEficas.salome == 0 and conditionSalome == True): continue
+ self.CBScripts.addItem(commande[1])
+ #self.CBScripts.addItem(commande[1],QVariant((numero)))
+ return
+ if 1 :
+ label=commande[1]
+ tip=commande[5]
+ self.action=QAction(label,self.tree)
+ self.action.setStatusTip(tip)
+ if monEnvQT5 :
+ if numero==4:
+ self.action.triggered.connect(self.AppelleFonction4)
+ if numero==3:
+ self.action.triggered.connect(self.AppelleFonction3)
+ numero=4
+ if numero==2:
+ self.action.triggered.connect(self.AppelleFonction2)
+ numero=3
+ if numero==1:
+ self.action.triggered.connect(self.AppelleFonction1)
+ numero=2
+ if numero==0:
+ self.action.triggered.connect(self.AppelleFonction0)
+ numero=1
+ else:
+ if numero==4:
+ self.tree.connect(self.action,SIGNAL("triggered()"),self.AppelleFonction4)
+ if numero==3:
+ self.tree.connect(self.action,SIGNAL("triggered()"),self.AppelleFonction3)
+ numero=4
+ if numero==2:
+ self.tree.connect(self.action,SIGNAL("triggered()"),self.AppelleFonction2)
+ numero=3
+ if numero==1:
+ self.tree.connect(self.action,SIGNAL("triggered()"),self.AppelleFonction1)
+ numero=2
+ if numero==0:
+ self.tree.connect(self.action,SIGNAL("triggered()"),self.AppelleFonction0)
+ numero=1
+ self.menu.addAction(self.action)
+
class ContientIcones:
def BFichierVisu(self):
def gereIconePlier(self):
if not(hasattr(self,'BFermeListe')) : return
+ self.editor.listeDesListesOuvertes.add(self.node.item)
repIcon=self.node.editor.appliEficas.repIcon
if not (self.editor.afficheListesPliees):
fichier=os.path.join(repIcon, 'empty.png')
def verifieInstall(self):
self.groupCodes=QButtonGroup(self.groupBox)
vars=os.environ.items()
- listeCode=('Aster','Adao','Carmel3D','CarmelCND','CF','MAP','MT','PSEN','Telemac','ZCracks',)
+ listeCode=('Aster','Adao','Carmel3D','CarmelCND','CF','MAP','MT','PSEN','PSEN_N1','Telemac','ZCracks',)
i=1
for code in listeCode:
nom='rB_'+code
# Modules Eficas
from desSelectVal import Ui_DSelVal
+from determine import monEnvQT5
-fromm determine import monEnvQT5
if monEnvQT5:
from PyQt5.QtWidgets import QDialog
from PyQt5.QtCore import QTimer
self.file=str(file)
self.readVal()
self.initVal()
- self.connecterSignaux()
+ if monEnvQT5: self.connecterSignaux()
+ else : self.connecterSignauxQT4()
def connecterSignaux(self) :
self.Bespace.clicked.connect(self.SelectEsp)
self.Bvirgule.clicked.connect(self.SelectVir)
self.BImportSel.clicked.connect(self.BImportSelPressed)
self.BImportTout.clicked.connect(self.BImportToutPressed)
- self.parent.editor.sb.messageChanged(self.messageAChanger)
+ self.parent.editor.sb.messageChanged.connect(self.messageAChanger)
def connecterSignauxQT4(self) :
self.connect(self.Bespace,SIGNAL("clicked()"),self.SelectEsp)
--- /dev/null
+# -*- 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
+#
+# Modules Python
+# Modules Eficas
+
+from monSelectVal import MonSelectVal
+
+class MonSelectValPSEN(MonSelectVal):
+ """
+ Classe definissant le panel associe aux mots-cles qui demandent
+ a l'utilisateur de choisir une seule valeur parmi une liste de valeurs
+ discretes
+ """
+ def __init__(self,file,parent,name = None,fl = 0):
+ self.MonSelectVal.__init__(file,parent,name = None,fl = 0):
+
+ def Traitement(self):
+ print "kkkkkkkkkkkkkkkkkkkllllllllllllllllll"
+ liste1=self.textTraite.split(self.separateur)
+ print liste1
+ #self.parent.ajoutNValeur(liste)
+
+
maPolice= QFont("Times", 10,)
self.setFont(maPolice)
- print 'jjjjjjjjjjjjjjjjjjjjjjjjj'
- print self.obj.nom
- print tr(self.obj.nom)
- print tr("TITLE")
- print 'jjjjjjjjjjjjjjjjjjjjjjjjj'
self.labelNomCommande.setText(tr(self.obj.nom))
self.commandesLayout.addStretch()
# Modules Eficas
from determine import monEnvQT5
if monEnvQT5:
- from PyQt5.QtWidgets import QCheckBox, QScrollBar, QFrame, QApplication
- from PyQt5.QtGui import QPalette
+ from PyQt5.QtWidgets import QCheckBox, QScrollBar, QFrame, QApplication, QLabel
+ from PyQt5.QtWidgets import QSizePolicy,QSpacerItem
+ from PyQt5.QtGui import QPalette, QFont
from PyQt5.QtCore import Qt
else :
from PyQt4.QtGui import *
self.index=1
self.alpha=0
self.listeCB=[]
- self.toto=0
self.listeCbRouge=[]
self.listeValeursCourantes=node.item.GetListeValeurs()
if self.listeValeursCourantes == None : self.listeValeursCourantes=[]
else : self.connect(self.CBCheck, SIGNAL('stateChanged(int)'),self.changeTout)
self.gereIconePlier()
+ self.editor.listeDesListesOuvertes.add(self.node.item)
self.inhibe=False
self.finCommentaireListe()
+ if self.listeAAfficher== None or self.listeAAfficher==[] :
+ spacerItem = QSpacerItem(30, 20, QSizePolicy.Fixed, QSizePolicy.Minimum)
+ self.CBLayout.addItem(spacerItem)
+ nouveauCommentaire=QLabel()
+ maPolice= QFont("Times", 16)
+ nouveauCommentaire.setFont(maPolice);
+ nouveauCommentaire.setText(tr('Pas de valeurs possibles'))
+ self.CBLayout.addWidget(nouveauCommentaire)
+ spacerItem2 = QSpacerItem(40, 70, QSizePolicy.Fixed, QSizePolicy.Minimum)
+ self.CBLayout.addItem(spacerItem2)
+
# try except si la liste des possibles est vide
# prevoir qqchose
try :
else :
self.listeAAfficher=self.node.item.get_liste_possible([])
- maListe=[]
- for i in self.listeAAfficher: maListe.append(i)
- if self.alpha==1 : maListe.sort()
+ if self.objSimp.wait_assd() :
+ self.listeAAfficher=self.node.item.get_sd_avant_du_bon_type()
+ if self.listeAAfficher== None or self.listeAAfficher==[] : self.listeAAfficher=[]
+
if len(self.listeAAfficher)*20 > 400 : self.setMinimumHeight(400)
else : self.setMinimumHeight(len(self.listeAAfficher)*30)
-
self.PourEtreCoche=[]
if self.objSimp.wait_assd() :
- self.listeAAfficher=self.node.item.get_sd_avant_du_bon_type()
- for concept in self.listeValeursCourantes:
- self.PourEtreCoche.append(concept.nom)
+ for concept in self.listeValeursCourantes: self.PourEtreCoche.append(concept.nom)
else :
- for val in self.listeValeursCourantes:
- self.PourEtreCoche.append(val)
- print self.PourEtreCoche
+ for val in self.listeValeursCourantes: self.PourEtreCoche.append(val)
+ maListe=[]
+ for i in self.listeAAfficher: maListe.append(i)
+ if self.alpha==1 : maListe.sort()
for i in range(1,len(maListe)+1): self.ajoutCB(i)
self.inhibe=True
def clearAll(self):
for cb in self.listeCB :
cb.setText("")
+
+
# Modules Eficas
from determine import monEnvQT5
if monEnvQT5:
- from PyQt5.QtWidgets import QFrame,QApplication
- from PyQt5.QtGui import QIcon, QFrame
- from PyQt5.QtCore import QSize
+ from PyQt5.QtWidgets import QFrame,QApplication, QFrame, QWidget
+ from PyQt5.QtGui import QIcon
+ from PyQt5.QtCore import QSize, Qt
else :
from PyQt4.QtGui import *
from PyQt4.QtCore import *
class MonWidgetPlusieursTuple(Feuille,GereListe):
def __init__(self,node,monSimpDef,nom,objSimp,parentQt,commande):
+ print "MonWidgetPlusieursTuple"
self.indexDernierLabel=0
self.nomLine="TupleVal"
self.listeAffichageWidget=[]
def RBListePush(self):
# PN a rendre generique avec un truc tel prerempli
if self.objSimp.valeur != None and self.objSimp.valeur != [] : return
+ if not hasattr(self.editor.readercata.cata[0],'sd_ligne') : self.editor.readercata.cata[0].sd_ligne=None
+ if not hasattr(self.editor.readercata.cata[0],'sd_generateur') : self.editor.readercata.cata[0].sd_generateur=None
+ if not hasattr(self.editor.readercata.cata[0],'sd_transfo') : self.editor.readercata.cata[0].sdtransfo=None
+ if not hasattr(self.editor.readercata.cata[0],'sd_charge') : self.editor.readercata.cata[0].sd_charge=None
+ if not hasattr(self.editor.readercata.cata[0],'sd_moteur') : self.editor.readercata.cata[0].sd_moteur=None
if self.objSimp.definition.validators.typeDesTuples[0]==self.editor.readercata.cata[0].sd_ligne :
val=[]
for k in self.objSimp.jdc.LineDico.keys() :
self.QWParent=None #(Pour lancement sans IHM)
self.code=code
self.indice=0
+ self.first=1
self.dict_reels={}
if monEnvQT5 : self.recent = []
else : self.recent = QStringList()
self.ficRecents={}
self.listeAEnlever=[]
- self.ListeCode=['Aster','Carmel3D','Cuve2dg','Openturns_Study','Openturns_Wrapper','MAP','ZCracks', 'CarmelCND','MT']
+ self.ListeCode=['Aster','Carmel3D','Cuve2dg','Openturns_Study','Openturns_Wrapper','MAP','ZCracks', 'CarmelCND','MT','PSEN','PSEN_N1']
self.repIcon=os.path.join( os.path.dirname(os.path.abspath(__file__)),'..','Editeur','icons')
if self.salome:
Accas.SalomeEntry = eficasSalome.SalomeEntry
self.multi=multi
+ self.demande=multi # specifique PSEN
if self.multi == False :
self.definitCode(code,ssCode)
if code==None: return
- if not self.salome and hasattr(self.CONFIGURATION,'lang') : langue=self.CONFIGURATION.lang
+ if not self.salome and hasattr (self, 'CONFIGURATION') and hasattr(self.CONFIGURATION,'lang') : langue=self.CONFIGURATION.lang
if langue=='fr': self.langue=langue
else : self.langue="ang"
- from Extensions import localisation
- app=QApplication
- localisation.localise(app,langue)
+ #from Extensions import localisation
+ #app=QApplication
+ #localisation.localise(app,langue)
+ #print tr('FORTRAN_FILE')
+ #localisation.localise(app,langue,'titi_fr.qm')
+ #print tr('titi1')
+ #localisation.localise(app,langue,'toto.qm')
+ #print tr('titi1')
+ #print pomu
self.setupUi(self)
if self.code in ['MAP',] : self.resize(1440,self.height())
self.initPatrons()
self.initRecents()
self.initAides()
- for intituleMenu in ("menuTraduction","menuOptions","menuMesh","menuExecution"):
+ for intituleMenu in ("menuTraduction","menuOptions","menuMesh","menuExecution","menuN1"):
if hasattr(self,intituleMenu):
menu=getattr(self,intituleMenu)
menu.setAttribute(Qt.WA_DeleteOnClose)
self.actionCode.setEnabled(True)
self.menuAide.addAction(self.actionCode)
+ def newN1(self):
+ ssCode=None
+ code="PSEN_N1"
+ self.cleanPath()
+ dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
+ sys.path.insert(0,dirCode)
+ self.code=code
+ self.definitCode(code,ssCode)
+ self.multi=True
+ self.demande=False
+ self.fileNew()
+
+ def newPSEN(self):
+ ssCode=None
+ code="PSEN"
+ self.cleanPath()
+ dirCode=os.path.abspath(os.path.join(os.path.abspath(__file__),'../..',code))
+ sys.path.insert(0,dirCode)
+ self.code=code
+ self.definitCode(code,ssCode)
+ self.multi=True
+ self.demande=False
+ self.fileNew()
+
+ def ajoutN1(self):
+ self.menuN1 = self.menubar.addMenu(tr("Etude N-1"))
+ self.actionN1 = QAction(self)
+ self.actionN1.setText(tr("Etude N1"))
+ self.menuN1.addAction(self.actionN1)
+ if monEnvQT5 : self.actionN1.triggered.connect(self.newN1)
+ else : self.connect(self.actionN1,SIGNAL("triggered()"),self.newN1)
def ajoutExecution(self):
self.menuExecution = self.menubar.addMenu(tr("Execution"))
self.menuOptions.setTitle(tr("Options"))
def PSEN(self):
+ if self.first:
+ self.first=0
+ if monEnvQT5:
+ self.action_Nouveau.triggered.disconnect(self.fileNew)
+ self.action_Nouveau.triggered.connect(self.newPSEN)
+ self
+ else :
+ self.disconnect(self.action_Nouveau,SIGNAL("triggered()"),self.fileNew)
+ self.connect(self.action_Nouveau,SIGNAL("triggered()"),self.newPSEN)
self.enleverActionsStructures()
self.enleverParametres()
self.enleverRechercherDsCatalogue()
self.enleverNewInclude()
self.ajoutExecution()
+ self.ajoutN1()
self.ajoutHelpPSEN()
self.ajoutIcones()
# self.cree_rubrique(e,self.dico,0)
#print self.dicoInverse
- from Extensions import localisation
- app=QApplication
+ #from Extensions import localisation
+ #app=QApplication
# tres dommage A Revoir
- localisation.localise(app,"fr")
+ #localisation.localise(app,"fr")
self.dicoInverseFrancais={}
self.dicoFrancaisAnglais={}
self.dicoAnglaisFrancais={}
self.dicoInverseFrancais[tr(k)]=listefr
#print tr(k),listefr
if self.appliEficas.langue=="ang" : localisation.localise(app,"en")
+
def traite_entite(self,e):
--- /dev/null
+# 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
+#
+import re, string
+from Extensions.i18n import tr
+from Accas.A_BLOC import BLOC
+from Accas import *
+
+
+from convert_python import PythonParser
+
+pattern_comment_slash = re.compile(r"^\s*/")
+pattern_eta = re.compile(r".*&ETA.*")
+pattern_fin = re.compile(r".*&FIN.*")
+pattern_blanc = re.compile(r"^ *$")
+pattern_OUI = re.compile(r"^ *OUI *")
+pattern_oui = re.compile(r"^ *oui *")
+pattern_NON = re.compile(r"^ *NON *")
+pattern_non = re.compile(r"^ *non *")
+pattern_vide = re.compile(r"^ *$")
+pattern_texte =re.compile(r"^[\w*'-]+[ *[\w*'-]* *]*[:=] *['](?P<texte>.*)[']")
+# le pattern texte reconnait
+#nom1 nom 2 : ou = chaine entre '
+# avec eventuellement des quotes au milieu par exemple
+# TITRE = 'TELEMAC 2D : GOUTTE D''EAU DANS UN BASSIN$'
+# m.group("texte") va rendre 'TELEMAC 2D : GOUTTE D''EAU DANS UN BASSIN$'
+
+
+#Si le code n est pas Telemac
+try :
+ from aideAuxConvertisseurs import DicoEficasToCas, ListeSupprimeCasToEficas
+ from aideAuxConvertisseurs import ListeCalculCasToEficas, DicoAvecMajuscules
+ from enumDicoTelemac2 import DicoEnumCasEn
+except :
+ pass
+
+from Extensions import localisation
+
+from determine import monEnvQT5
+
+
+
+def entryPoint():
+ """
+ Return a dictionary containing the description needed to load the plugin
+ """
+ return {
+ 'name' : 'TELEMAC',
+ 'factory' : TELEMACParser
+ }
+
+class TELEMACParser(PythonParser):
+ """
+ This converter works like PythonParser, except that it also initializes all
+ model variables to None in order to avoid Python syntax errors when loading
+ a file with a different or inexistent definition of variables.
+ """
+
+ def convert(self, outformat, appli=None):
+ self.dicoInverseFrancais=appli.readercata.dicoInverseFrancais
+ self.dicoAnglaisFrancais=appli.readercata.dicoAnglaisFrancais
+ self.dicoFrancaisAnglais=appli.readercata.dicoFrancaisAnglais
+ self.dicoMC=appli.readercata.dicoMC
+ self.Ordre_Des_Commandes=appli.readercata.Ordre_Des_Commandes
+
+
+ #print self.dicoInverseFrancais
+ #text = PythonParser.convert(self, outformat, appli)
+
+ text=""
+ l_lignes = string.split(self.text,'\n')
+ self.dictSimp={}
+ lignesATraiter=[]
+ for ligne in l_lignes :
+ if pattern_comment_slash.match(ligne) : continue
+ if pattern_eta.match(ligne) : continue
+ if pattern_fin.match(ligne) : continue
+ if pattern_texte.match(ligne) :
+ lignesATraiter.append(l)
+ continue
+
+ for l in ligne.split('\t'):
+ lignesATraiter.append(l)
+
+ for ligne in lignesATraiter :
+ if pattern_blanc.match(ligne) : continue
+ ligneInitiale=ligne
+
+ if pattern_texte.match(ligne) :
+ self.traiteLigneTexte(ligne)
+ continue
+
+
+ ligne=re.sub("'",' ',ligne)
+ ligne=re.sub(":",'=',ligne)
+ if ligne.count('=') != 1 :
+ print "pb avec la ligne " , ligne
+ continue
+
+
+ motsInLigne=string.split(ligne,' ')
+ listeMotsSimp=()
+ simp=""
+ for mot in motsInLigne:
+ if mot == "" : continue
+ if mot == "=" :
+ simp=simp[0:-1]
+ while simp[-1] == " " : simp=simp[0:-1]
+ if simp.find('-') > 0 : simp=self.redecoupeSimp(simp)
+ break
+
+ mot=mot.replace('_','__')
+ simp=simp+mot[0].upper() +mot[1:].lower()+'_'
+ valeur=ligne.split('=')[1]
+ self.dictSimp[simp]=valeur
+
+
+
+ #print dictSimp
+ #print self.dicoInverseFrancais
+
+ dicoParMC={}
+ #print ListeCalculCasToEficas
+
+ print self.dictSimp.keys()
+ if 'Title' not in self.dictSimp.keys():
+ import os
+ self.dictSimp['Titre']=os.path.basename(self.filename)
+
+ for simp in self.dictSimp.keys():
+ if simp in TELEMACParser.__dict__.keys() : apply(TELEMACParser.__dict__[simp],(self,))
+
+ for simp in self.dictSimp.keys():
+ if simp in ListeSupprimeCasToEficas: continue
+ if simp not in self.dicoInverseFrancais.keys() :
+ print "************"
+ print "pb avec ", simp,'------'
+ print "************"
+ continue
+ listeGenea=self.dicoInverseFrancais[simp]
+ listeGeneaReverse=[]
+ for (u,v) in listeGenea :
+ if isinstance(v,BLOC): continue
+ listeGeneaReverse.append(u)
+ listeGeneaReverse.reverse()
+ dicoTravail=dicoParMC
+ i=0
+ #print (listeGeneaReverse[0:-1])
+ while i < len(listeGeneaReverse[0:-1]) :
+ mot=listeGeneaReverse[i]
+ i=i+1
+ if mot not in dicoTravail.keys(): dicoTravail[mot]={}
+ dicoTravail=dicoTravail[mot]
+ dicoTravail[simp]=self.dictSimp[simp]
+
+ self.textePy=""
+ #print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ #print dicoParMC
+ #print "%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%"
+ listeMC=self.tri(dicoParMC.keys())
+ for k in listeMC :
+ #print "----------- traitement de " , k
+ self.textePy += self.dicoFrancaisAnglais[k] + "("
+ self.traiteMC(dicoParMC[k])
+ self.textePy += ");\n"
+ #print "----------- "
+
+
+ print self.textePy
+ return self.textePy
+
+ def traiteLigneTexte(self,ligne):
+ m=pattern_texte.match(ligne)
+ valeur=m.group("texte")
+ ligne=ligne[0:ligne.find(valeur)]
+ ligne=re.sub("'",' ',ligne)
+ ligne=re.sub(":",'=',ligne)
+ motsInLigne=string.split(ligne,' ')
+ simp=""
+ for mot in motsInLigne:
+ if mot == "" : continue
+ if mot == "=" :
+ simp=simp[0:-1]
+ while simp[-1] == " " : simp=simp[0:-1]
+ if simp.find('-') > 0 : simp=self.redecoupeSimp(simp)
+ break
+
+ mot=mot.replace('_','__')
+ simp=simp+mot[0].upper() +mot[1:].lower()+'_'
+ self.dictSimp[simp]=valeur
+
+ def traiteMC(self,dico) :
+ for k in dico.keys() :
+ valeur= dico[k]
+ if k not in self.dicoMC.keys() : kA=self.dicoFrancaisAnglais[k]
+ else : kA=k
+ obj=self.dicoMC[kA]
+ if isinstance(obj,FACT): self.generFACT(obj,kA,valeur)
+ elif isinstance(obj,BLOC): self.generBLOC(obj,kA,valeur)
+ elif isinstance(obj,SIMP): self.generSIMP(obj,kA,valeur)
+ else : print "%%%%%%%%%%%\n", "pb generation pour", k, obj, "\n%%%%%%%%%%%"
+
+ #print "_____________"
+
+ def generFACT(self,obj,nom,valeur):
+ if nom in TELEMACParser.__dict__.keys() :
+ apply(TELEMACParser.__dict__[nom],(self,))
+ return
+ self.textePy += nom + "=_F( "
+ self.traiteMC(valeur)
+ self.textePy += '),\n'
+
+
+ def generBLOC(self,obj,nom,valeur):
+ print "BLOC "
+ print nom
+
+ def generSIMP(self,obj,nom,valeur):
+ if nom in ("Prescribed_Flowrates", "Prescribed_Velocities", "Prescribed_Elevations" ): return
+ if obj.max==1 :
+ if 'TXM' in obj.type :
+ valeur=str(valeur)
+ while valeur[-1] == " " : valeur=valeur[0:-1]
+ while valeur[0] == " " : valeur=valeur[1:]
+ valeur=valeur[0].upper()+valeur[1:].lower()
+ valeur=tr(valeur)
+ try : valeur=eval(valeur,{})
+ except : pass
+ if nom in DicoEnumCasEn.keys():
+ try : valeur=DicoEnumCasEn[nom][valeur]
+ except : pass
+ if 'Fichier' in obj.type or 'TXM' in obj.type or 'Repertoire' in obj.type :
+ valeur=str(valeur)
+ while valeur[-1] == " " : valeur=valeur[0:-1]
+ while valeur[0] == " " : valeur=valeur[1:]
+ self.textePy += nom + "= '" + str(valeur) +"' ,"
+ return
+ if bool in obj.type :
+ if pattern_OUI.match(valeur) or pattern_oui.match(valeur) : self.textePy += nom + "= True,"
+ if pattern_NON.match(valeur) or pattern_non.match(valeur) : self.textePy += nom + "= False,"
+ return
+ self.textePy += nom + "=" + str(valeur) +","
+ else :
+ if pattern_vide.match(valeur) : return
+ while valeur[-1] == " " : valeur=valeur[0:-1]
+ while valeur[0] == " " : valeur=valeur[1:]
+
+ if ";" in valeur : valeur=valeur.split(';')
+ elif "," in valeur : valeur=valeur.split(',')
+
+ if valeur == None : return
+ newVal=[]
+ for v in valeur :
+ try : v==eval(v,{})
+ except : pass
+ if nom in DicoEnumCasEn.keys():
+ try : v=DicoEnumCasEn[nom][v]
+ except : pass
+ newVal.append(v)
+ self.textePy += nom + "=" + str(newVal) +","
+
+
+
+ def tri(self, listeIn):
+ if len(listeIn) == 1 : return listeIn
+ if self.Ordre_Des_Commandes == None : return listeIn
+ #print self.Ordre_Des_Commandes
+ listeOut=[listeIn[0],]
+ for kF in listeIn[1:]:
+ k=str(self.dicoFrancaisAnglais[kF])
+ ordreK=self.Ordre_Des_Commandes.index(k)
+ i=0
+ while i < len(listeOut):
+ ordreI=self.Ordre_Des_Commandes.index(self.dicoFrancaisAnglais[listeOut[i]])
+ if ordreK < ordreI : break
+ i=i+1
+ listeOut.insert(i,kF)
+ return listeOut
+
+ def Processeurs_Paralleles(self):
+ #YOANN
+ if self.dictSimp["Processeurs_Paralleles"] == 0 : del self.dictSimp["Processeurs_Paralleles"]
+ else : self.dictSimp["Parallel_Computation"]="Parallel"
+
+ def decoupeSUPG(self,valeurs,label):
+ i=0
+ for prefixe in ('_U_And_V','_H'):
+ labelComplet=label+prefixe
+ self.dictSimp["labelComplet"]=valeurs[i]
+ i=i+1
+ if len(valeurs)==2 : return
+ for prefixe in ('_K_And_Epsilon','_Tracers'):
+ labelComplet=label+prefixe
+ self.dictSimp["labelComplet"]=valeurs[i]
+ i=i+1
+
+ def Option_De_Supg(self):
+ print "ds Option_De_Supg"
+ self.decoupeSUPG( self.dictSimp["Option_De_Supg"],"Option_De_Supg")
+ del self.dictSimp["Option_De_Supg"]
+
+ def Forme_De_La_Convection(self):
+ self.decoupeSUPG( self.dictSimp["Forme_De_La_Convection"],"Forme_De_La_Convection")
+ del self.dictSimp["Forme_De_La_Convection"]
+
+ def redecoupeSimp(self,simp):
+ # replace('-','_') uniquement dans les identifiants
+ while simp.find('-') > 0 :
+ ind=simp.find('-')
+ if ind==len(simp)-1 : break
+ simp=simp[0:ind]+'_'+simp[ind+1].upper()+simp[ind+2:]
+ return simp
+
+
+
+ def Liquid_Boundaries(self):
+ texte_Boundaries="Liquid_Boundaries=( "
+ premier=0
+ if 'Prescribed_Elevations' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Prescribed_Elevations"].split(";")
+ elif 'Cotes_Imposees' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Cotes_Imposees"].split(";")
+ else : valeurs=()
+ for e in range(len(valeurs)):
+ if valeurs[e] == "" or valeurs[e] == "\n" : continue
+ if eval(valeurs[e],{})==0 : continue
+ if not premier : premier=1
+ texte_Boundaries += "_F(Type_Condition = 'Prescribed Elevations',\n"
+ texte_Boundaries += "Prescribed_Elevations = " + str(valeurs[e]) + "),\n"
+
+ if 'Prescribed_Flowrates' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Prescribed_Flowrates"].split(";")
+ elif 'Debits_Imposes' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Debits_Imposes"].split(";")
+ else : valeurs=()
+ for e in range(len(valeurs)):
+ if valeurs[e] == "" or valeurs[e] == "\n" : continue
+ if eval(valeurs[e],{})==0 : continue
+ if not premier : premier=1
+ texte_Boundaries += "_F(Type_Condition = 'Prescribed Flowrates',\n"
+ texte_Boundaries += "Prescribed_Flowrates = " + str(valeurs[e]) + "),\n"
+
+ if 'Prescribed_Velocity' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Prescribed_Velocity"].split(";")
+ elif 'Vitesses_Imposees' in self.dictSimp.keys():
+ valeurs=self.dictSimp["Vitesses_Imposees"].split(";")
+ else : valeurs=()
+ for e in range(len(valeurs)):
+ if valeurs[e] == "" or valeurs[e] == "\n" : continue
+ if eval(valeurs[e],{})==0 : continue
+ if not premier : premier=1
+ texte_Boundaries += "_F(Type_Condition = 'Prescribed Velocity',\n"
+ texte_Boundaries += "Prescribed_Velocity = " + str(valeurs[e]) + "),\n"
+ if premier : texte_Boundaries +="),\n"
+ else : texte_Boundaries="" ; print "pb texte_Boundaries "
+ self.textePy += texte_Boundaries
+
self.ajoutScript()
def ajoutScript(self):
+
# cochon mais je n arrive pas a faire mieux avec le mecanisme de plugin
listeCommandes=self.appliEficas.mesScripts.dict_commandes[self.tree.currentItem().item.get_nom()]
if type(listeCommandes) != types.TupleType: listeCommandes=(listeCommandes,)
def handleOpen(self,fichier=None,patron=0,units=None):
result = None
if fichier is None:
- if self.appliEficas.multi==True :
+ if self.appliEficas.demande==True :
self.appliEficas.definitCode(None,None)
if self.appliEficas.code == None:return
editor.handleSupprimer()
def newEditor(self,include=0):
- if self.appliEficas.multi==True :
+ if self.appliEficas.demande==True :
self.appliEficas.definitCode(None,None)
if self.appliEficas.code == None:return
maPage=self.getEditor(include=include)
--- /dev/null
+def exportToCsv(editor,cmd) :
+ #from PyQt4.QtGui import QFileDialog
+ # selection fichier
+ #fn = QFileDialog.getOpenFileName()
+ #if not fn : return
+ #FichieraTraduire=str(fn)
+ print "je suis la"
+ print editor
+ print cmd
+
+def importFromCsv(editor,cmd) :
+ print "et ici"
+
+# le dictionnaire des commandes a la structure suivante :
+# la clef est la commande qui va proposer l action
+# puis un tuple qui contient
+# - la fonction a appeler
+# - le label dans le menu du clic droit
+# - un tuple contenant les parametres attendus par la fonction
+# - appelable depuis Salome uniquement -)
+# - appelable depuis un item valide uniquement
+# - toolTip
+dict_commandes={
+ 'N_1_GENERATORS':(
+ (exportToCsv,"exportToCsv",('editor','self'),False,False,"export values to cvs File"),
+ (importFromToCsv,"importFromToCsv",('editor','self'),False,False,"import values from cvs File"),
+ )
+ }
# See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
#
-from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico
-#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2
+#from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico
+from ExtractGeneratorLoadLineandTransfoDico import ExtractGeneratorLoadLineandTransfoDico2
def INCLUDE(self,PSSE_path,sav_file,**args):
"""
name='prefs_'+prefs.code
__import__(name)
-from PyQt4.QtCore import *
from InterfaceQT4 import eficas_go
eficas_go.lance_eficas(code=prefs.code)
</property>
</widget>
</item>
+ <item>
+ <widget class="QComboBox" name="CBScripts">
+ <property name="frame">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
<item>
<widget class="QToolButton" name="RBInfo">
<property name="minimumSize">
<x>0</x>
<y>0</y>
<width>938</width>
- <height>236</height>
+ <height>200</height>
</rect>
</property>
<property name="sizePolicy">
<property name="minimumSize">
<size>
<width>0</width>
- <height>60</height>
+ <height>200</height>
</size>
</property>
<property name="windowTitle">
<number>2</number>
</property>
<property name="rightMargin">
- <number>2</number>
+ <number>0</number>
</property>
<property name="bottomMargin">
- <number>0</number>
+ <number>5</number>
</property>
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_5">
+ <property name="spacing">
+ <number>0</number>
+ </property>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3"/>
+ </item>
<item>
<widget class="QLineEdit" name="LEFiltre">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="minimumSize">
+ <size>
+ <width>250</width>
+ <height>0</height>
+ </size>
+ </property>
+ <property name="maximumSize">
+ <size>
+ <width>250</width>
+ <height>16777215</height>
+ </size>
+ </property>
<property name="styleSheet">
<string notr="true">background:rgb(255,255,255)
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_3">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeType">
+ <enum>QSizePolicy::Fixed</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>5</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
<item>
<widget class="QToolButton" name="PBFind">
<property name="minimumSize">
</size>
</property>
<property name="toolTip">
- <string>Détruit une ligne</string>
+ <string>Cherche la valeur</string>
</property>
<property name="styleSheet">
<string notr="true">border : 0px</string>
</property>
<property name="icon">
<iconset theme="find">
- <normaloff>.</normaloff>.</iconset>
+ <normaloff/>
+ </iconset>
</property>
<property name="iconSize">
<size>
</property>
</widget>
</item>
+ <item>
+ <spacer name="horizontalSpacer_2">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</item>
<item>
<x>0</x>
<y>0</y>
<width>300</width>
- <height>122</height>
+ <height>92</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_2">
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="horizontalSpacing">
<number>0</number>
</property>
- <property name="horizontalSpacing">
+ <property name="margin">
<number>0</number>
</property>
<item row="0" column="0">
<string notr="true">background : rgb(247,247,247)</string>
</property>
<property name="frameShape">
- <enum>QFrame::Box</enum>
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="frameShadow">
+ <enum>QFrame::Plain</enum>
</property>
<property name="lineWidth">
<number>1</number>
<rect>
<x>0</x>
<y>0</y>
- <width>419</width>
- <height>230</height>
+ <width>424</width>
+ <height>193</height>
</rect>
</property>
<property name="sizePolicy">
<property name="spacing">
<number>0</number>
</property>
- <property name="leftMargin">
- <number>0</number>
- </property>
- <property name="topMargin">
- <number>0</number>
- </property>
- <property name="rightMargin">
- <number>0</number>
- </property>
- <property name="bottomMargin">
+ <property name="margin">
<number>0</number>
</property>
+ <item>
+ <spacer name="verticalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Vertical</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>40</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
</layout>
</widget>
</widget>
<zorder>horizontalSpacer</zorder>
<zorder>scrollArea</zorder>
<zorder></zorder>
+ <zorder></zorder>
</widget>
<customwidgets>
<customwidget>