Salome HOME
Fix to allow Cleaner and SurfOpt to be launched on files with special characters...
authorChristophe Bourcier <christophe.bourcier@cea.fr>
Wed, 16 Jan 2019 13:18:24 +0000 (14:18 +0100)
committervsr <vsr@opencascade.com>
Fri, 8 Feb 2019 11:19:54 +0000 (14:19 +0300)
Do not use an intermediate bat file to prevent bad unicode conversions.

src/Tools/MGCleanerPlug/MGCleanerMonViewText.py
src/Tools/YamsPlug/monViewText.py

index f2647a3fb99e9de51f7832cc6684d3973abf8bee..0271821e35f640bcaffabceb0f05649cd1493c0f 100644 (file)
@@ -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 verbose: print(("INFO: MGCleaner launch script file: %s" % nomFichier))
+        if os.path.exists(self.parent().fichierOut):
+            os.remove(self.parent().fichierOut)
         
-        self.monExe.start(nomFichier)
+        self.monExe.start(txt)
         self.monExe.closeWriteChannel()
         self.enregistreResultatsDone=False
         self.show()
index 9d92a0c55a7eac476d31cc47d38bc3f10d865d62..afbc87e3bb71dc361fbef42b9f7806d7568653de 100644 (file)
@@ -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()