]> SALOME platform Git repositories - modules/adao.git/commitdiff
Salome HOME
[19282] Verify EFICAS files saving before exporting to YACS
authorJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Fri, 19 Apr 2019 06:47:06 +0000 (08:47 +0200)
committerJean-Philippe ARGAUD <jean-philippe.argaud@edf.fr>
Fri, 19 Apr 2019 06:47:06 +0000 (08:47 +0200)
src/daSalome/daGUI/daGuiImpl/adaoCase.py

index 54c1f4fd678e16a75cf9449d7a5713593eb930da..cadcef95d302a9c0a74d0b084089dc30efcf9a7b 100644 (file)
@@ -21,6 +21,7 @@
 #
 
 import os
+import time
 import subprocess
 import traceback
 import SalomePyQt
@@ -66,8 +67,8 @@ class AdaoCase:
 
   def createYACSFile(self):
     rtn = ""
-    if (self.filename == ""):
-      return "You need to save your case to export it."
+    if (self.filename == "" or self.filename == "not yet defined"):
+      return "You need to save your case before exporting it."
 
     self.yacs_filename = self.filename[:self.filename.rfind(".")] + '.xml'
     yacs_filename_backup = self.filename[:self.filename.rfind(".")] + '.xml.back'
@@ -77,6 +78,10 @@ class AdaoCase:
     self.eficas_editor.modified = True
     self.eficas_editor.saveFile()
     filename = self.filename[:self.filename.rfind(".")] + '.py'
+    retry = 0
+    while (not os.path.exists(filename) and retry < 30):
+        time.sleep(0.1)
+        retry += 1
     if not os.path.exists(filename):
       msg =  "Cannot find the COMM/PY associated EFICAS/Python files for YACS\n"
       msg += "generation. Is your case correct? Try to close and re-open the\n"