From b998f6f54de80dbe2b6000a1aa278c042bcc0a01 Mon Sep 17 00:00:00 2001 From: Pascale Noyret Date: Mon, 18 Feb 2008 13:33:52 +0000 Subject: [PATCH] *** empty log message *** --- Editeur/configuration.py | 4 ++++ InterfaceQT/editor.py | 42 +++++++++++++++++++++++++++++----------- 2 files changed, 35 insertions(+), 11 deletions(-) diff --git a/Editeur/configuration.py b/Editeur/configuration.py index 9368a6fb..1bdfa20d 100644 --- a/Editeur/configuration.py +++ b/Editeur/configuration.py @@ -220,6 +220,7 @@ class CONFIG(CONFIGbase): "Veuillez remplir TOUS les champs ci-dessous et appuyer sur 'Valider'\n"+\ "Si vous annulez, EFICAS ne se lancera pas !!" self.salome=appli.salome + self.code=appli.code if self.salome == 0 : self.fichier="editeur.ini" else : @@ -237,6 +238,9 @@ class CONFIG(CONFIGbase): "catalogues" : "Versions du code ", "isdeveloppeur" : "Niveau de message ", "path_cata_dev" : "Chemin d'accès aux catalogues développeurs"} + + if self.code == "OPENTURNS" : + self.labels["DTDDirectory"]="Chemin d'accès au wraper" self.types ={"initialdir":"rep", "rep_travail":"rep","rep_mat":"rep", "path_doc": "rep","exec_acrobat":"file","exec_acrobat":"file", diff --git a/InterfaceQT/editor.py b/InterfaceQT/editor.py index c1fb7ac4..01268b3c 100644 --- a/InterfaceQT/editor.py +++ b/InterfaceQT/editor.py @@ -44,7 +44,9 @@ class JDCEditor(QSplitter): self.titre=VERSION_EFICAS + ' pour '+ self.code self.dict_reels={} self.liste_simp_reel=[] - self.format_fichier='python' #CS_pbruno gestion python uniquement + self.format_fichier='python' # par defaut + self.jdc_openturn_xml="" + self.jdc_openturn_std="" self.ihm="QT" from Editeur import configuration @@ -508,24 +510,27 @@ class JDCEditor(QSplitter): #---------------------# return self.fileName - #---------------------# - def writeFile(self, fn): - #---------------------# + #---------------------------# + def writeFile(self, fn, txt = None): + #------------------------------# """ Public slot to write the text to a file. @param fn filename to write to (string or QString) @return flag indicating success """ + fn = unicode(fn) - txt = self.get_text_JDC('python') - eol = '\n' - if len(txt) >= len(eol): - if txt[-len(eol):] != eol: - txt += eol - else: - txt += eol + if txt == None : + txt = self.get_text_JDC(self.format_fichier) + eol = '\n' + if len(txt) >= len(eol): + if txt[-len(eol):] != eol: + txt += eol + else: + txt += eol + try: f = open(fn, 'wb') f.write(txt) @@ -537,6 +542,16 @@ class JDCEditor(QSplitter): .arg(unicode(fn)).arg(str(why))) return 0 + #------------------------------------ + def writeFilesOpenturns(self,fn) : + #------------------------------------ + base=fn[:fn.rfind(".")] + fileXML=base + '.xml' + fileSTD=base + '_std.py' + self.writeFile(fileXML,self.jdc_openturn_xml) + self.writeFile(fileSTD,self.jdc_openturn_std) + + #-----------------------------# def get_text_JDC(self,format): #-----------------------------# @@ -544,6 +559,9 @@ class JDCEditor(QSplitter): # Le generateur existe on l'utilise g=generator.plugins[format]() jdc_formate=g.gener(self.jdc,format='beautifie') + if format == "openturns" : + self.jdc_openturn_xml=g.getOpenturnsXML() + self.jdc_openturn_std=g.getOpenturnsSTD() if not g.cr.estvide(): self.affiche_infos("Erreur à la generation") QMessageBox.critical( self, "Erreur a la generation","EFICAS ne sait pas convertir ce JDC") @@ -618,6 +636,8 @@ class JDCEditor(QSplitter): self.vm.addToRecentList(newName) self.emit(PYSIGNAL('editorSaved'), (self.fileName,)) self.stop_modif() + if self.code == "OPENTURNS" : + self.writeFilesOpenturns(fn) return (1, self.fileName) else: return (0, None) -- 2.39.2