global eficas_translator
if locale=="ang" : locale="en"
- print "eficas_" + locale, monPath
+
if file != None :
print 'chargement de ', file,monPath
print eficas_translator.load(file,monPath)
self.closeAutreCommande = False\r
self.closeFrameRechercheCommande = False\r
self.closeEntete = False\r
+ self.force_langue=False\r
\r
\r
#--------------------------------------\r
import browser
import readercata
-DictExtensions= {"MAP" : ".map"}
+DictExtensions= {"MAP" : ".map", "TELEMAC" : '.comm'}
txt=self.ajoutVersionCataDsJDC(txt)
checksum=self.get_checksum(txt)
txt=txt+checksum
+ if self.code=="TELEMAC" : return 1
try:
f = open(fn, 'wb')
f.write(txt)
#else :
pass
+ #-----------------------------------------------------------------#
+ def saveFileLeger(self, path = None, saveas= 0,formatLigne="beautifie"):
+ #-----------------------------------------------------------------#
+ extension='.casR'
+ fn = self.fichier
+ #saveas=True # Pour forcer le nom
+ self.generator=generator.plugins[self.format]()
+ if self.fichier is None or saveas:
+ if path is None: path=self.CONFIGURATION.savedir
+ bOK, fn=self.determineNomFichier(path,extension)
+ if bOK == 0 : return (0, None)
+ if fn == None : return (0, None)
+ if fn== '' : return (0, None)
+
+ ulfile = os.path.abspath(unicode(fn))
+ self.appliEficas.CONFIGURATION.savedir=os.path.split(ulfile)[0]
+ fn = unicode(QDir.toNativeSeparators(fn))
+
+ self.fichier = os.path.splitext(fn)[0]+extension
+
+ print self.fichier
+ if hasattr(self.generator, "writeLeger"):
+ self.generator.writeLeger(self.fichier,self.jdc,config=self.appliEficas.CONFIGURATION,appli=self.appliEficas)
+
+ if self.salome : self.appliEficas.addJdcInSalome( self.fichier)
+
+ self.modified = 0
+ nouveauTitre=self.titre+" "+str(os.path.basename(self.fichier))
+ self.appliEficas.setWindowTitle(nouveauTitre)
+ return (1, self.fichier)
+
#-----------------------------------------------------------------#
def saveFile(self, path = None, saveas= 0,formatLigne="beautifie"):
#-----------------------------------------------------------------#
if not self.modified and not saveas:
return (0, None) # do nothing if text wasn't changed
- extension='.py'
if DictExtensions.has_key(self.appli.code) :
extension=DictExtensions[self.appli.code]
else :
def mouseDoubleClickEvent(self,event):
#print self.editor.Classement_Commandes_Ds_Arbre
- if self.editor.Classement_Commandes_Ds_Arbre!= () : self.chercheOu()
+ #if self.editor.Classement_Commandes_Ds_Arbre!= () : self.chercheOu()
nodeCourrant=self.node.tree.currentItem()
if nodeCourrant==None: nodeCourrant=self.node.tree.racine
if self.name != None :
self.node.tree.setCurrentItem(nouveau)
event.accept()
- def chercheOu(self):
- if self.node.tree.racine.childrenComplete==[] : return None
- listeNoeud=[]
- for node in self.node.tree.racine.childrenComplete :
- listeNoeud.append(node.item.object.nom)
- indexAvant=-1
- indexStop=self.editor.Classement_Commandes_Ds_Arbre.index(self.name)
- for commande in self.editor.Classement_Commandes_Ds_Arbre[:indexStop]:
- if commande in listeNoeud: indexAvant=indexAvant+1
- if indexAvant==-1 : self.node.tree.setCurrentItem(None)
- else :
- nodeASelectionner=self.node.tree.racine.childrenComplete[indexAvant]
- self.node.tree.setCurrentItem(nodeASelectionner)
def creeListeCommande(self,filtre):
--- /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
+
+import os,sys,re
+from desChoixLangue import Ui_ChoixLangue
+from determine import monEnvQT5
+if monEnvQT5:
+ from PyQt5.QtWidgets import QDialog, QRadioButton, QGroupBox, QButtonGroup
+ from PyQt5.QtGui import QPalette
+ from PyQt5.QtCore import QProcess, QFileInfo, Qt, QSize
+else :
+ from PyQt4.QtGui import *
+ from PyQt4.QtCore import *
+
+
+# Import des panels
+
+class MonChoixLangue(Ui_ChoixLangue,QDialog):
+ """
+ Classe définissant le panel associé aux mots-clés qui demandent
+ à l'utilisateur de choisir une seule valeur parmi une liste de valeurs
+ discrètes
+ """
+ def __init__(self, parentAppli=None):
+ QDialog.__init__(self,parentAppli)
+ self.setModal(True)
+ self.setupUi(self)
+ self.parentAppli=parentAppli
+ self.installLangue()
+ self.code=None
+ if monEnvQT5: self.pB_OK.clicked.connect(self.choisitLangue)
+ else : self.connect(self.pB_OK,SIGNAL("clicked()"),self.choisitLangue)
+
+
+ def installLangue(self):
+ if self.parentAppli.langue == 'fr' : self.rbFrancais.setChecked(True)
+ else : self.rbEnglish.setChecked(True)
+
+ def choisitLangue(self):
+ if self.rbFrancais.isChecked() : self.parentAppli.langue='fr'
+ else : self.parentAppli.langue ='ang'
+ self.close()
+
nomLineEdit="lineEditVal"+str(index)
if hasattr(self,nomLineEdit) :
courant=getattr(self,nomLineEdit)
- courant.setText(str(val))
+ if 'R' in self.objSimp.definition.type and str(val) != repr(val) : courant.setText(repr(val))
+ else : courant.setText(str(val))
else :
self.ajoutLineEdit(val)
index=index+1
if code==None: return
+
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"
+ if self.CONFIGURATION.force_langue :
+ from monChoixLangue import MonChoixLangue
+ widgetLangue = MonChoixLangue(self)
+ ret=widgetLangue.exec_()
+
+
from Extensions import localisation
app=QApplication
- localisation.localise(None,langue)
+ localisation.localise(None,self.langue)
self.setupUi(self)
#if parent != None : self.parentCentralWidget = parent.centralWidget()
self.connect(self.actionRechercherDsCatalogue,SIGNAL("triggered()"),self.handleRechercherDsCatalogue)
def ajoutSortieLegere(self):
+ if hasattr(self,'actionSortieLegere') : return
self.actionSortieLegere = QAction(self)
self.actionSortieLegere.setText(tr("Sortie Legere"))
- self.menuFichier.addAction(self.actionSortieLegere)
+ self.menuFichier.insertAction(self.actionEnregistrer_sous,self.actionSortieLegere)
if monEnvQT5:
self.actionSortieLegere.triggered.connect(self.handleSortieLegere)
else :
monOption.show()
def handleSortieLegere(self):
- print "coucou"
+ return self.viewmanager.saveLegerCurrentEditor()
def handleShowRecentMenu(self):
"""
eficas_compile_ui ( desChoixCata.ui )
eficas_compile_ui ( desChoixCode.ui )
eficas_compile_ui ( desChoixCommandes.ui )
+eficas_compile_ui ( desChoixLangue.ui )
eficas_compile_ui ( desRecherche.ui )
eficas_compile_ui ( desRechercheCatalogue.ui )
eficas_compile_ui ( desSelectVal.ui )
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ChoixLangue</class>
+ <widget class="QWidget" name="ChoixLangue">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>191</width>
+ <height>119</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Langue</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <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>4</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="rbFrancais">
+ <property name="text">
+ <string>Français</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="rbEnglish">
+ <property name="text">
+ <string>English</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>rbEnglish</zorder>
+ <zorder>rbFrancais</zorder>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pB_OK">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Validate choice</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color:rgb(104,110,149);
+color :white;
+border-radius : 12px
+
+</string>
+ </property>
+ <property name="text">
+ <string>&OK</string>
+ </property>
+ <property name="shortcut">
+ <string/>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
.SUFFIXES : .ui .py .ts .qm
-PY_FILES = myMain.py desBaseWidget.py desChoixCata.py desChoixCode.py desChoixCommandes.py \
+PY_FILES = myMain.py desBaseWidget.py desChoixCata.py desChoixCode.py desChoixLangue.py desChoixCommandes.py \
desRecherche.py desRechercheCatalogue.py \
desSelectVal.py desViewTexte.py desViewRegles.py desVisu.py desWidgetCreeParam.py desWidgetCommande.py \
desWidgetOptionnel.py desWidgetOptionnelMC.py Tuple2.py Tuple3.py \
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ChoixLangue</class>
+ <widget class="QWidget" name="ChoixLangue">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>191</width>
+ <height>119</height>
+ </rect>
+ </property>
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="windowTitle">
+ <string>Langue</string>
+ </property>
+ <layout class="QGridLayout" name="gridLayout">
+ <item row="0" column="0">
+ <widget class="QGroupBox" name="groupBox">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Preferred" vsizetype="MinimumExpanding">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="title">
+ <string/>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <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>4</number>
+ </property>
+ <property name="bottomMargin">
+ <number>0</number>
+ </property>
+ <item>
+ <widget class="QRadioButton" name="rbFrancais">
+ <property name="text">
+ <string>Français</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="rbEnglish">
+ <property name="text">
+ <string>English</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ <zorder>rbEnglish</zorder>
+ <zorder>rbFrancais</zorder>
+ </widget>
+ </item>
+ <item row="1" column="0">
+ <layout class="QHBoxLayout" name="horizontalLayout">
+ <property name="sizeConstraint">
+ <enum>QLayout::SetFixedSize</enum>
+ </property>
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <property name="orientation">
+ <enum>Qt::Horizontal</enum>
+ </property>
+ <property name="sizeHint" stdset="0">
+ <size>
+ <width>20</width>
+ <height>20</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pB_OK">
+ <property name="minimumSize">
+ <size>
+ <width>60</width>
+ <height>30</height>
+ </size>
+ </property>
+ <property name="toolTip">
+ <string>Validate choice</string>
+ </property>
+ <property name="styleSheet">
+ <string notr="true">background-color:rgb(104,110,149);
+color :white;
+border-radius : 12px
+
+</string>
+ </property>
+ <property name="text">
+ <string>&OK</string>
+ </property>
+ <property name="shortcut">
+ <string/>
+ </property>
+ <property name="autoDefault">
+ <bool>true</bool>
+ </property>
+ <property name="default">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+</ui>
PY_FILES = myMain.py desBaseWidget.py desChoixCata.py desChoixCode.py desChoixCommandes.py \
- desRecherche.py desRechercheCatalogue.py\
+ desChoixLangue.py desRecherche.py desRechercheCatalogue.py\
desSelectVal.py desViewTexte.py desViewRegles.py desVisu.py desWidgetCreeParam.py desWidgetCommande.py \
desWidgetOptionnel.py desWidgetOptionnelMC.py Tuple2.py Tuple3.py \
desWidgetBloc.py desWidgetCB.py desWidgetCommentaire.py desWidgetDate.py \
pattern_ligne=re.compile(r'^\s*(?P<ident>[^=:]*)\s*[:=]\s*(?P<reste>.*)$')
-pattern_variables=re.compile (r"^\s*(?P<ident>VARIABLES FOR GRAPHIC PRINTOUTS)\s*[:=]\s*(?P<valeur>\w(,\w)*)\s*(?P<reste>.*)$")
+pattern_variables=re.compile (r"^\s*(?P<ident>VARIABLES FOR GRAPHIC PRINTOUTS|VARIABLES POUR LES SORTIES GRAPHIQUES)\s*[:=]\s*(?P<valeur>[A-Za-z]+(\d*|\*)(,[A-Za-z]+(\d*|\*))*)\s*(?P<reste>.*)$")
# Attention aux listes de flottants
pattern_liste=re.compile(r'^\s*(?P<valeur>[+-.\w]+(\s*;\s*[+-.\w]+)+)\s*(?P<reste>.*)$')
#Si le code n est pas Telemac
-#try :
-if 1 :
+try :
+#if 1 :
from aideAuxConvertisseurs import ListeSupprimeCasToEficas
from enumDicoTelemac import TelemacdicoEn
-#except :
-# pass
+except :
+ pass
from Extensions import localisation
text=""
self.dictSimp={}
- l_lignes_texte = string.split(self.text,'\n')
+ l_lignes_texte_all = string.split(self.text,'\n')
+ l_lignes_texte = []
+ for l in l_lignes_texte_all :
+ if not(pattern_comment_slash.match(l)): l_lignes_texte.append(l)
+
l_lignes=[]
i=0
while (i < len(l_lignes_texte)) :
for ligne in l_lignes :
- #print "traite ligne"
if pattern_comment_slash.match(ligne) : continue
if pattern_eta.match(ligne) : continue
if pattern_fin.match(ligne) : continue
while ident[0] == " " or ident[0] == '\t' : ident=ident[1:]
try : identCata=self.dicoCasToCata[ident]
except :
- print "---> ", "pb conversion type pour", ident
+ print "---> ", "pb mot clef pour", ident
identCata=None
return identCata
if valeursPF == None : valeursPF = listNulle
if valeursPV == None : valeursPV = listNulle
- print valeursPE,valeursPF,valeursPV
+ #print valeursPE,valeursPF,valeursPV
for e in range(len(valeursPE)):
if valeursPE[e] != "" or valeursPE[e] != "\n" :
return l
- def format_item(self,valeur,etape,obj):
+ def format_item(self,valeur,etape,obj,vientDeListe=0):
if (type(valeur) == types.FloatType or 'R' in obj.definition.type) and not(isinstance(valeur,Accas.PARAMETRE)) :
- # Pour un flottant on utilise str
+ # Pour un flottant on utilise str ou repr si on vient d une liste
# ou la notation scientifique
# On ajoute un . si il n y en a pas dans la valeur
s = str(valeur)
+ if vientDeListe and repr(valeur) != str(valeur) : s=repr(valeur)
if (s.find('.')== -1 and s.find('e')== -1 and s.find('E')==-1) : s=s+'.0'
clefobj=etape.get_sdname()
if self.appli.appliEficas and self.appli.appliEficas.dict_reels.has_key(clefobj):
else :
obj.valeurFormatee=[]
for val in obj.valeur :
- s =s +self.format_item(val,obj.etape,obj) + ','
+ s =s +self.format_item(val,obj.etape,obj,1) + ','
if obj.wait_TXM() :
obj.valeurFormatee.append(val)
else :