From: Renaud Barate Date: Fri, 14 Jan 2011 09:52:02 +0000 (+0000) Subject: Fixed bug in OpenTURNS save methods X-Git-Tag: LOGILAB~342 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=8c6184ba8728b0a50992001b6fb4063bccc049ce;p=tools%2Feficas.git Fixed bug in OpenTURNS save methods --- diff --git a/InterfaceQT4/editor.py b/InterfaceQT4/editor.py index 233ca18b..77cb5fc9 100644 --- a/InterfaceQT4/editor.py +++ b/InterfaceQT4/editor.py @@ -661,11 +661,8 @@ class JDCEditor(QSplitter): self.tree.racine.item.getObject().nom=os.path.basename(newName) self.tree.racine.update_node_label() - if self.jdc.isvalid() != 0 : - try: - self.generator.writeDefault(fn) - except: - pass + if self.jdc.isvalid() != 0 and hasattr(self.generator, "writeDefault"): + self.generator.writeDefault(fn) if self.salome : self.appliEficas.addJdcInSalome( self.fichier) diff --git a/generator/generator_openturns_study.py b/generator/generator_openturns_study.py index 6f2312a1..9a2854dc 100644 --- a/generator/generator_openturns_study.py +++ b/generator/generator_openturns_study.py @@ -127,7 +127,7 @@ class OpenturnsGenerator(PythonGenerator): def writeDefault(self, fn): fileSTD = fn[:fn.rfind(".")] + '.py' - f = open( str(filename), 'wb') + f = open( str(fileSTD), 'wb') f.write( self.texteSTD ) f.close() diff --git a/generator/generator_openturns_wrapper.py b/generator/generator_openturns_wrapper.py index 2dfd61ad..8c1c94b4 100644 --- a/generator/generator_openturns_wrapper.py +++ b/generator/generator_openturns_wrapper.py @@ -137,6 +137,5 @@ class OpenturnsGenerator(PythonGenerator): self.wrapperXML=None def writeDefault(self, filename): - fileXML = fn[:fn.rfind(".")] + '.xml' - self.wrapperXML.writeFile( fileXML ) - + fileXML = filename[:filename.rfind(".")] + '.xml' + self.wrapperXML.writeFile( str(fileXML) )