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
parent 890ce9fde2
commit c294972ace
4 changed files with 18 additions and 17 deletions

View File

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

View File

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

View File

@ -94,16 +94,16 @@ class MonViewText(Ui_ViewExe, QDialog):
def saveFile(self):
#recuperation du nom du fichier
savedir=os.environ['HOME']
fn = QFileDialog.getSaveFileName(None,"Save File",savedir)
if fn.isNull() : return
fn, mask = QFileDialog.getSaveFileName(None,"Save File",savedir)
if not fn: return
ulfile = os.path.abspath(str(fn))
try:
f = open(fn, 'wb')
f.write(str(self.TB_Exe.toPlainText()))
f.write(self.TB_Exe.toPlainText().encode("utf-8"))
f.close()
except IOError as why:
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):
a=self.monExe.readAllStandardError()

View File

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