X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2FTools%2FYamsPlug%2FmonViewText.py;h=afbc87e3bb71dc361fbef42b9f7806d7568653de;hb=c9afb20072e07eeea02c562e119a69e854d60ffb;hp=84d640e8edd2a6d72930499690540ed107418f83;hpb=f5882cb24088610fb4f7d1cbcd41cb19a71bed2c;p=modules%2Fsmesh.git
diff --git a/src/Tools/YamsPlug/monViewText.py b/src/Tools/YamsPlug/monViewText.py
index 84d640e8e..afbc87e3b 100644
--- a/src/Tools/YamsPlug/monViewText.py
+++ b/src/Tools/YamsPlug/monViewText.py
@@ -55,33 +55,10 @@ class MonViewText(Ui_ViewExe, QDialog):
self.monExe.readyReadStandardError.connect( self.readFromStdErr )
self.monExe.finished.connect( self.finished )
- cmds = ''
- ext = ''
- if sys.platform == "win32":
- if os.path.exists(self.parent().fichierOut):
- cmds += 'del %s\n' % self.parent().fichierOut
- ext = '.bat'
- else:
- cmds += '#!/bin/bash\n'
- cmds += 'pwd\n'
- #cmds += 'which mg-surfopt.exe\n'
- cmds += 'echo "DISTENE_LICENSE_FILE="$DISTENE_LICENSE_FILE\n'
- cmds += 'echo "DLIM8VAR="$DLIM8VAR\n'
- cmds += 'rm -f %s\n' % self.parent().fichierOut
- ext = '.bash'
+ if os.path.exists(self.parent().fichierOut):
+ os.remove(self.parent().fichierOut)
- cmds += 'echo %s\n' % txt #to see what is compute command
- cmds += txt+'\n'
- cmds += 'echo "END_OF_MGSurfOpt"\n'
-
- nomFichier = os.path.splitext(self.parent().fichierOut)[0] + ext
- with open(nomFichier, 'w') as f:
- f.write(cmds)
- self.make_executable(nomFichier)
-
- if verbose: print(("INFO: MGSurfOpt launch script file: %s" % nomFichier))
-
- self.monExe.start(nomFichier)
+ self.monExe.start(txt)
self.monExe.closeWriteChannel()
self.enregistreResultatsDone=False
self.show()
@@ -94,16 +71,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 %1 could not be saved.
Reason: %2'%(str(fn), str(why)))
+ 'The file %s could not be saved.
Reason: %s'%(str(fn), str(why)))
def readFromStdErr(self):
a=self.monExe.readAllStandardError()