X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FTools%2FMGCleanerPlug%2FMGCleanerMonViewText.py;h=0271821e35f640bcaffabceb0f05649cd1493c0f;hp=99e322d3111813d8c56f8c520653485f48c585e1;hb=c9afb20072e07eeea02c562e119a69e854d60ffb;hpb=0003e6b4fcc95a0aec695ceef8371dee28baf417 diff --git a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py index 99e322d31..0271821e3 100644 --- a/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py +++ b/src/Tools/MGCleanerPlug/MGCleanerMonViewText.py @@ -67,33 +67,10 @@ class MGCleanerMonViewText(Ui_ViewExe, QDialog): PP.pprint([str(i) for i in sorted(self.monExe.processEnvironment().toStringList()) if 'DISTENE' in i]) """ - 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-cleaner.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' - - cmds += 'echo %s\n' % txt #to see what is compute command - cmds += txt+'\n' - cmds += 'echo "END_OF_MGCleaner"\n' - - nomFichier = os.path.splitext(self.parent().fichierOut)[0] + ext - with open(nomFichier, 'w') as f: - f.write(cmds) - self.make_executable(nomFichier) + if os.path.exists(self.parent().fichierOut): + os.remove(self.parent().fichierOut) - if verbose: print(("INFO: MGCleaner launch script file: %s" % nomFichier)) - - self.monExe.start(nomFichier) + self.monExe.start(txt) self.monExe.closeWriteChannel() self.enregistreResultatsDone=False self.show() @@ -106,25 +83,25 @@ 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.close() + f = open(fn, 'wb') + 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 %1 could not be saved.
Reason: %2') - .arg(str(fn)).arg(str(why))) + QMessageBox.critical(self, 'Save File', + 'The file %s could not be saved.
Reason: %s'%(str(fn), str(why))) def readFromStdErr(self): a=self.monExe.readAllStandardError() - self.TB_Exe.append(str(a.data())) + aa=a.data().decode(errors='ignore') + self.TB_Exe.append(aa) def readFromStdOut(self) : a=self.monExe.readAllStandardOutput() - aa=str(a.data()) + aa=a.data().decode(errors='ignore') self.TB_Exe.append(aa) def finished(self):