From 645bde21b8eb395b2e1a10fe33a6324aa1c46445 Mon Sep 17 00:00:00 2001 From: ribes Date: Wed, 18 Nov 2009 15:02:43 +0000 Subject: [PATCH] EnvFile for YACSFile jobs --- src/engine/BL_SALOMEServices.cxx | 2 +- src/genericgui/BL_CreateJobWizard.cxx | 24 +++++++++++++++++++++++- src/genericgui/BL_CreateJobWizard.hxx | 2 ++ src/genericgui/BL_JobsManager_QT.cxx | 1 + 4 files changed, 27 insertions(+), 2 deletions(-) diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 7a053b8..4ecb47b 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -95,7 +95,6 @@ BL::SALOMEServices::create_job(BL::Job * job) { job_parameters->job_type = CORBA::string_dup("command"); job_parameters->command = CORBA::string_dup(job->getCommand().c_str()); - job_parameters->env_file = CORBA::string_dup(job->getEnvFile().c_str()); } else if (job->getType() == BL::Job::YACS_SCHEMA) { @@ -104,6 +103,7 @@ BL::SALOMEServices::create_job(BL::Job * job) } // Files + job_parameters->env_file = CORBA::string_dup(job->getEnvFile().c_str()); BL::Job::FilesParam files = job->getFilesParameters(); std::list::iterator it; int i = 0; diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 6347db1..ad54e2d 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -85,9 +85,10 @@ BL::CreateJobWizard::end(int result) // Command Panel QString f_command = field("command").toString(); command = f_command.toStdString(); + QString f_env_file = field("env_file").toString(); env_file = f_env_file.toStdString(); - + // Batch Panel QString f_batch_directory = field("batch_directory").toString(); batch_directory = f_batch_directory.toStdString(); @@ -242,11 +243,20 @@ BL::YACSSchemaPage::YACSSchemaPage(QWidget * parent) registerField("yacs_file", _yacs_file_text); _yacs_file_text->setReadOnly(true); + QPushButton * command_env_file_button = new QPushButton(tr("Choose an environnement file")); + command_env_file_button->show(); + connect(command_env_file_button, SIGNAL(clicked()), this, SLOT(choose_env_file())); + _line_env_file = new QLineEdit(this); + registerField("env_file", _line_env_file); + _line_env_file->setReadOnly(true); + QVBoxLayout * main_layout = new QVBoxLayout; main_layout->addWidget(label); QGridLayout *layout = new QGridLayout; layout->addWidget(_yacs_file_button, 0, 0); layout->addWidget(_yacs_file_text, 0, 1); + layout->addWidget(command_env_file_button, 1, 0); + layout->addWidget(_line_env_file, 1, 1); main_layout->insertLayout(-1, layout); setLayout(main_layout); }; @@ -282,6 +292,18 @@ BL::YACSSchemaPage::choose_file() _yacs_file_text->setReadOnly(true); } +void +BL::YACSSchemaPage::choose_env_file() +{ + QString env_file = QFileDialog::getOpenFileName(this, + tr("Open environnement file"), "", + tr("sh (*.sh);;All Files (*)")); + _line_env_file->setReadOnly(false); + _line_env_file->setText(env_file); + _line_env_file->setReadOnly(true); +} + + int BL::YACSSchemaPage::nextId() const { diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index c2a5022..3b36b2c 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -119,10 +119,12 @@ namespace BL{ public slots: void choose_file(); + void choose_env_file(); private: QPushButton * _yacs_file_button; QLineEdit * _yacs_file_text; + QLineEdit * _line_env_file; }; class CommandMainPage: virtual public QWizardPage diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 0684cda..bcd1e33 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -161,6 +161,7 @@ BL::JobsManager_QT::create_job_wizard() // YACS schema job new_job->setType(BL::Job::YACS_SCHEMA); new_job->setYACSFile(wizard.yacs_file); + new_job->setEnvFile(wizard.env_file); BL::Job::BatchParam param; param.batch_directory = wizard.batch_directory; param.maximum_duration = wizard.maximum_duration; -- 2.39.2