X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FTools%2FYamsPlug%2FmonViewText.py;fp=src%2FTools%2FYamsPlug%2FmonViewText.py;h=38aeed49bbd1e1e52d3bce8e27191a3d6b41b402;hb=a17b36970bc61da1d664453c615754997c925b18;hp=478e1833d0b0f4d46f3125283b552a6b65d163a2;hpb=81693f40091943d60dec0673176390b07665d018;p=modules%2Fsmesh.git diff --git a/src/Tools/YamsPlug/monViewText.py b/src/Tools/YamsPlug/monViewText.py index 478e1833d..38aeed49b 100644 --- a/src/Tools/YamsPlug/monViewText.py +++ b/src/Tools/YamsPlug/monViewText.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Copyright (C) 2007-2015 EDF R&D +# Copyright (C) 2007-2016 EDF R&D # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser General Public @@ -19,8 +19,9 @@ # # Modules Python -import string,types,os +import string,types,os, sys import traceback +import tempfile from qtsalome import * @@ -47,16 +48,25 @@ class MonViewText(Ui_ViewExe, QDialog): # Je n arrive pas a utiliser le setEnvironment du QProcess # fonctionne hors Salome mais pas dans Salome ??? cmds='' - cmds+='rm -f '+self.parent().fichierOut+'\n' + #cmds+='#! /usr/bin/env python\n' + #cmds+='# -*- coding: utf-8 -*-\n' cmds+=txt+'\n' - cmds+='echo END_OF_Yams\n' - pid=self.monExe.pid() - nomFichier='/tmp/Yams_'+str(pid)+'.sh' + cmds+='echo "END_OF_Yams"\n' + if os.path.exists(self.parent().fichierOut): + os.remove(self.parent().fichierOut) + + ext='' + if sys.platform == "win32": + ext = '.bat' + else: + ext = '.sh' + + nomFichier=tempfile.mktemp(suffix=ext,prefix='Yams_') f=open(nomFichier,'w') f.write(cmds) f.close() - maBidouille='sh ' + nomFichier + maBidouille=nomFichier self.monExe.start(maBidouille) self.monExe.closeWriteChannel() self.enregistreResultatsDone=False