from .launcher import run_study
from .genjobwindow import GenJobDialog
-from PyQt5.QtWidgets import QFileDialog, QMessageBox, QPlainTextEdit
+from PyQt5.QtWidgets import QFileDialog, QMessageBox, QTextEdit
def create_case_study():
EficasForRunStudyAppli()
def run_selected_case_study():
param_dict = get_params_from_selected_case()
- QMessageBox.Information(view, view.tr("Information"),
- view.tr("The job is running."))
- listing = run_study(param_dict)
+ view = sgPyQt.getDesktop()
- # Display listing
- dspl_listing = QPlainTextEdit(view)
- dspl_listing.setReadOnly(True)
-
- dspl_listing.setPlainText(tmp)
-
- dspl_listing.show()
+ QMessageBox.information(view, "Information", "The job is running.")
+ passed, tmp = run_study(param_dict)
+ qmsg = QMessageBox(view)
+ qmsg.setIcon(QMessageBox.Information)
+ if passed:
+ qmsg.setText("Job successfull"+" "*80)
+ else:
+ qmsg.setText("Job failed"+" "*85)
+ qmsg.setDetailedText(tmp)
+ qmsg.exec_()
def generate_job_for_selected_case_study():
param_dict = get_params_from_selected_case()
orig_steering = f.read()
orig_steering_lines = orig_steering.split("\n")
- #TODO: replace by call to Telemac Python (import runcode.py) ? for windows compatibility
-
# Run the code itself
code = param_dict["CODE"]
- listing_name = "run.log"
- listing = os.path.join(steering_file_dir, '..', listing_name)
- cmd = "runcode.py {code} {steering_filepath}" \
- .format(steering_file_dir=steering_file_dir,
- code=code,
- steering_filepath=os.path.basename(steering_filepath),
- listing=listing_name)
+ cmd = "runcode.py {code} -w {wrkdir} {steering_filepath} -s" \
+ .format(code=code,
+ wrkdir=wrkdir,
+ steering_filepath=os.path.basename(steering_filepath))
# Launch the command
- logger.debug("Running the following command in salome shell in %s: %s", wrkdir, cmd)
- log = subprocess.check_output(cmd, cwd=wrkdir, shell=True)
+ logger.debug("Running the following command in salome shell in %s: %s", steering_file_dir, cmd)
+ try:
+ log = subprocess.check_output(cmd, cwd=steering_file_dir, shell=True)
+ passed = True
+ log = log.decode('utf-8')
+ except subprocess.CalledProcessError as e:
+ passed = False
+ log = str(e)
- return log.decode('utf-8')
+ return passed, log
def check_file_or_create_link(filepath, dirpath, interm_file_list = None):