More fixes in Cleaner and SurfOpt:

- fix decode error in case a GMF file is selected
- fix save log error
- fix wrong mesh used when changing from mesh object to mesh file.
This commit is contained in:
Christophe Bourcier 2019-01-14 12:18:20 +01:00 committed by vsr
parent f5882cb240
commit a38b958b27
4 changed files with 18 additions and 17 deletions

View File

@ -449,16 +449,17 @@ class MGCleanerMonPlugDialog(Ui_MGCleanerPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_MeshFile.setText(infile) self.LE_MeshFile.setText(infile)
self.fichierIn=str(infile).encode("latin-1") self.fichierIn=str(infile)
self.MeshIn="" self.MeshIn=""
self.LE_MeshSmesh.setText("") self.LE_MeshSmesh.setText("")
self.__selectedMesh=None
def setParamsFileName(self): def setParamsFileName(self):
fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)") fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_ParamsFile.setText(infile) self.LE_ParamsFile.setText(infile)
self.paramsFile=str(infile).encode("latin-1") self.paramsFile=str(infile)
def meshFileNameChanged(self): def meshFileNameChanged(self):
self.fichierIn=str(self.LE_MeshFile.text()) self.fichierIn=str(self.LE_MeshFile.text())

View File

@ -106,17 +106,16 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog):
def saveFile(self): def saveFile(self):
#recuperation du nom du fichier #recuperation du nom du fichier
savedir=os.environ['HOME'] savedir=os.environ['HOME']
fn = QFileDialog.getSaveFileName(None, self.trUtf8("Save File"),savedir) fn, mask = QFileDialog.getSaveFileName(None,"Save File",savedir)
if fn.isNull() : return if not fn: return
ulfile = os.path.abspath(str(fn)) ulfile = os.path.abspath(str(fn))
try: try:
f = open(fn, 'wb') f = open(fn, 'wb')
f.write(str(self.TB_Exe.toPlainText())) f.write(self.TB_Exe.toPlainText().encode("utf-8"))
f.close() f.close()
except IOError as why: except IOError as why:
QMessageBox.critical(self, self.trUtf8('Save File'), QMessageBox.critical(self, 'Save File',
self.trUtf8('The file <b>%1</b> could not be saved.<br>Reason: %2') 'The file <b>%s</b> could not be saved.<br>Reason: %s'%(str(fn), str(why)))
.arg(str(fn)).arg(str(why)))
def readFromStdErr(self): def readFromStdErr(self):
a=self.monExe.readAllStandardError() a=self.monExe.readAllStandardError()

View File

@ -94,16 +94,16 @@ class MonViewText(Ui_ViewExe, QDialog):
def saveFile(self): def saveFile(self):
#recuperation du nom du fichier #recuperation du nom du fichier
savedir=os.environ['HOME'] savedir=os.environ['HOME']
fn = QFileDialog.getSaveFileName(None,"Save File",savedir) fn, mask = QFileDialog.getSaveFileName(None,"Save File",savedir)
if fn.isNull() : return if not fn: return
ulfile = os.path.abspath(str(fn)) ulfile = os.path.abspath(str(fn))
try: try:
f = open(fn, 'wb') f = open(fn, 'wb')
f.write(str(self.TB_Exe.toPlainText())) f.write(self.TB_Exe.toPlainText().encode("utf-8"))
f.close() f.close()
except IOError as why: except IOError as why:
QMessageBox.critical(self, 'Save File', QMessageBox.critical(self, 'Save File',
'The file <b>%1</b> could not be saved.<br>Reason: %2'%(str(fn), str(why))) 'The file <b>%s</b> could not be saved.<br>Reason: %s'%(str(fn), str(why)))
def readFromStdErr(self): def readFromStdErr(self):
a=self.monExe.readAllStandardError() a=self.monExe.readAllStandardError()

View File

@ -413,16 +413,17 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_MeshFile.setText(infile) self.LE_MeshFile.setText(infile)
self.fichierIn=str(infile).encode("latin-1") self.fichierIn=str(infile)
self.MeshIn="" self.MeshIn=""
self.LE_MeshSmesh.setText("") self.LE_MeshSmesh.setText("")
self.__selectedMesh=None
def setParamsFileName(self): def setParamsFileName(self):
fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)") fd = QFileDialog(self, "select a file", self.LE_ParamsFile.text(), "dat Files (*.dat);;All Files (*)")
if fd.exec_(): if fd.exec_():
infile = fd.selectedFiles()[0] infile = fd.selectedFiles()[0]
self.LE_ParamsFile.setText(infile) self.LE_ParamsFile.setText(infile)
self.paramsFile=str(infile).encode("latin-1") self.paramsFile=str(infile)
def meshFileNameChanged(self): def meshFileNameChanged(self):
self.fichierIn=str(self.LE_MeshFile.text()) self.fichierIn=str(self.LE_MeshFile.text())
@ -504,7 +505,7 @@ class MonYamsPlugDialog(Ui_YamsPlugDialog,QWidget):
except: except:
pass pass
style = str(self.style).encode("latin-1") style = str(self.style)
# Translation of old Yams options to new MG-SurfOpt options # Translation of old Yams options to new MG-SurfOpt options
if style == "0" : if style == "0" :
self.commande+= " --optimisation only" self.commande+= " --optimisation only"