From 8a0d108b71eda0bcfc0c0c11107f526248959b71 Mon Sep 17 00:00:00 2001 From: Jean-Philippe ARGAUD Date: Fri, 19 Apr 2019 08:47:06 +0200 Subject: [PATCH] [19282] Verify EFICAS files saving before exporting to YACS --- src/daSalome/daGUI/daGuiImpl/adaoCase.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/daSalome/daGUI/daGuiImpl/adaoCase.py b/src/daSalome/daGUI/daGuiImpl/adaoCase.py index 54c1f4f..cadcef9 100644 --- a/src/daSalome/daGUI/daGuiImpl/adaoCase.py +++ b/src/daSalome/daGUI/daGuiImpl/adaoCase.py @@ -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" -- 2.39.2