From e46a093dbb595d8d01b0426f18dca6181c8e7270 Mon Sep 17 00:00:00 2001 From: Ovidiu Mircescu Date: Wed, 24 Jan 2018 17:28:27 +0100 Subject: [PATCH] Add command_salome job type. --- src/engine/BL_Job.cxx | 4 +++ src/engine/BL_Job.hxx | 2 +- src/engine/BL_SALOMEServices.cxx | 4 +++ src/genericgui/BL_CreateJobWizard.cxx | 38 ++++++++++++++++++++++----- src/genericgui/BL_CreateJobWizard.hxx | 3 ++- src/genericgui/BL_JobTab.cxx | 2 ++ src/genericgui/BL_JobsManager_QT.cxx | 5 ++++ src/genericgui/BL_QModelManager.cxx | 2 ++ 8 files changed, 52 insertions(+), 8 deletions(-) diff --git a/src/engine/BL_Job.cxx b/src/engine/BL_Job.cxx index 01c7d3d..ccfd48f 100644 --- a/src/engine/BL_Job.cxx +++ b/src/engine/BL_Job.cxx @@ -117,6 +117,10 @@ BL::Job::setType(const std::string & type) { setType(BL::Job::PYTHON_SALOME); } + else if (type == "command_salome") + { + setType(BL::Job::COMMAND_SALOME); + } } BL::Job::JobType diff --git a/src/engine/BL_Job.hxx b/src/engine/BL_Job.hxx index cbc972d..243b2f8 100644 --- a/src/engine/BL_Job.hxx +++ b/src/engine/BL_Job.hxx @@ -42,7 +42,7 @@ namespace BL{ void setName(const std::string & name); std::string getName(); - enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME}; + enum JobType {YACS_SCHEMA, COMMAND, PYTHON_SALOME, COMMAND_SALOME}; void setType(BL::Job::JobType type); void setType(const std::string & type); BL::Job::JobType getType(); diff --git a/src/engine/BL_SALOMEServices.cxx b/src/engine/BL_SALOMEServices.cxx index 19b0377..ab6dac1 100644 --- a/src/engine/BL_SALOMEServices.cxx +++ b/src/engine/BL_SALOMEServices.cxx @@ -263,6 +263,10 @@ BL::SALOMEServices::create_job(BL::Job * job) { job_parameters->job_type = CORBA::string_dup("python_salome"); } + else if (job->getType() == BL::Job::COMMAND_SALOME) + { + job_parameters->job_type = CORBA::string_dup("command_salome"); + } // Specific parameters if (job->getType() == BL::Job::YACS_SCHEMA) diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 6d46e40..28b97f9 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -156,6 +156,13 @@ BL::CreateJobWizard::clone(const std::string & name) setField("env_command_file", QString(job->getEnvFile().c_str())); setField("pre_command_file", QString(job->getPreCommand().c_str())); } + else if (job->getType() == BL::Job::COMMAND_SALOME) + { + setField("command", QString(job->getJobFile().c_str())); + setField("job_type_command_salome", true); + setField("env_command_file", QString(job->getEnvFile().c_str())); + setField("pre_command_file", QString(job->getPreCommand().c_str())); + } else if (job->getType() == BL::Job::PYTHON_SALOME) { setField("PythonSalome", QString(job->getJobFile().c_str())); @@ -273,6 +280,8 @@ BL::CreateJobWizard::end(int result) job_type = YACS; else if (field("job_type_command").toBool()) job_type = COMMAND; + else if (field("job_type_command_salome").toBool()) + job_type = COMMAND_SALOME; else job_type = PYTHON_SALOME; @@ -293,7 +302,7 @@ BL::CreateJobWizard::end(int result) QString f_env_file; if (job_type == YACS) f_env_file = field("env_yacs_file").toString(); - else if (job_type == COMMAND) + else if (job_type == COMMAND || job_type == COMMAND_SALOME) f_env_file = field("env_command_file").toString(); else if (job_type == PYTHON_SALOME) f_env_file = field("env_PythonSalome_file").toString(); @@ -302,7 +311,7 @@ BL::CreateJobWizard::end(int result) QString f_pre_command_file; if (job_type == YACS) f_pre_command_file = field("pre_yacs_file").toString(); - else if (job_type == COMMAND) + else if (job_type == COMMAND || job_type == COMMAND_SALOME) f_pre_command_file = field("pre_command_file").toString(); else if (job_type == PYTHON_SALOME) f_pre_command_file = field("pre_PythonSalome_file").toString(); @@ -440,15 +449,18 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager QRadioButton * _yacs_schema_button = new QRadioButton(tr("YACS Schema")); _yacs_schema_button->setChecked(true); QRadioButton * _command_button = new QRadioButton(tr("Command")); + QRadioButton * _command_salome_button = new QRadioButton(tr("Command in salome shell")); QRadioButton * _python_salome_button = new QRadioButton(tr("Python script in SALOME")); QVBoxLayout *vbox = new QVBoxLayout; vbox->addWidget(_yacs_schema_button); vbox->addWidget(_command_button); + vbox->addWidget(_command_salome_button); vbox->addWidget(_python_salome_button); vbox->addStretch(1); groupBox->setLayout(vbox); registerField("job_type_yacs", _yacs_schema_button); registerField("job_type_command", _command_button); + registerField("job_type_command_salome", _command_salome_button); registerField("job_type_python_salome", _python_salome_button); QGroupBox * explanationBox = new QGroupBox("Explanation"); @@ -473,6 +485,7 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager connect(_yacs_schema_button, SIGNAL(toggled(bool)), this, SLOT(yacs_schema_button(bool))); connect(_command_button, SIGNAL(toggled(bool)), this, SLOT(command_button(bool))); + connect(_command_salome_button, SIGNAL(toggled(bool)), this, SLOT(command_salome_button(bool))); connect(_python_salome_button, SIGNAL(toggled(bool)), this, SLOT(python_salome_button(bool))); // Default button @@ -487,7 +500,7 @@ BL::JobNamePage::yacs_schema_button(bool checked) { if (checked) { - _explanation->setText("This job permits to launch a YACS schema into a SALOME application"); + _explanation->setText("Launch a YACS schema."); setField("exclusive", true); } } @@ -497,7 +510,19 @@ BL::JobNamePage::command_button(bool checked) { if (checked) { - _explanation->setText("This job permits to launch a script into a distributed resource. This script is not launched into a SALOME application"); + _explanation->setText("Launch a script on a remote resource without using " + "SALOME environment."); + setField("exclusive", false); + } +} + +void +BL::JobNamePage::command_salome_button(bool checked) +{ + if (checked) + { + _explanation->setText("Launch a script on a remote resource within SALOME " + "environment but whitout the SALOME application."); setField("exclusive", false); } } @@ -507,7 +532,7 @@ BL::JobNamePage::python_salome_button(bool checked) { if (checked) { - _explanation->setText("This job permits to launch a python script into a SALOME application"); + _explanation->setText("Launch a python script into a SALOME application."); setField("exclusive", true); } } @@ -551,7 +576,8 @@ BL::JobNamePage::nextId() const { return BL::CreateJobWizard::Page_YACSSchema; } - else if (field("job_type_command").toBool()) + else if (field("job_type_command").toBool() || + field("job_type_command_salome").toBool()) { return BL::CreateJobWizard::Page_Command_Main_Definitions; } diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 532a90f..2a40c36 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -72,7 +72,7 @@ namespace BL { public: // Results std::string job_name; - enum {YACS, COMMAND, PYTHON_SALOME} job_type; + enum {YACS, COMMAND, PYTHON_SALOME, COMMAND_SALOME} job_type; std::string yacs_file; std::string command; @@ -140,6 +140,7 @@ namespace BL { public slots: void yacs_schema_button(bool checked); void command_button(bool checked); + void command_salome_button(bool checked); void python_salome_button(bool checked); private: diff --git a/src/genericgui/BL_JobTab.cxx b/src/genericgui/BL_JobTab.cxx index ffc9ed6..557b065 100644 --- a/src/genericgui/BL_JobTab.cxx +++ b/src/genericgui/BL_JobTab.cxx @@ -237,6 +237,8 @@ BL::JobTab::job_selected(const QModelIndex & index) _job_type_label_value->setText("YACS_Schema"); else if (job->getType() == BL::Job::COMMAND) _job_type_label_value->setText("Command"); + else if (job->getType() == BL::Job::COMMAND_SALOME) + _job_type_label_value->setText("Command_Salome"); else if (job->getType() == BL::Job::PYTHON_SALOME) _job_type_label_value->setText("Python_Salome"); diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 8ff1128..c36862f 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -298,6 +298,11 @@ BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard) new_job->setType(BL::Job::COMMAND); new_job->setJobFile(wizard.command); break; + case BL::CreateJobWizard::COMMAND_SALOME: + // Command Job + new_job->setType(BL::Job::COMMAND_SALOME); + new_job->setJobFile(wizard.command); + break; case BL::CreateJobWizard::PYTHON_SALOME: // Python Salome Job new_job->setType(BL::Job::PYTHON_SALOME); diff --git a/src/genericgui/BL_QModelManager.cxx b/src/genericgui/BL_QModelManager.cxx index 67a71d7..37348e5 100644 --- a/src/genericgui/BL_QModelManager.cxx +++ b/src/genericgui/BL_QModelManager.cxx @@ -64,6 +64,8 @@ BL::QModelManager::new_job_added(const QString & name) new_job_type = new QStandardItem("YACS_Schema"); else if (job->getType() == BL::Job::COMMAND) new_job_type = new QStandardItem("Command"); + else if (job->getType() == BL::Job::COMMAND_SALOME) + new_job_type = new QStandardItem("Command_Salome"); else if (job->getType() == BL::Job::PYTHON_SALOME) new_job_type = new QStandardItem("Python_Salome"); -- 2.39.2