_salome_services = salome_services;
job_name = "";
+ job_type = YACS;
yacs_file = "";
command = "";
python_salome_file = "";
if (job->getType() == BL::Job::YACS_SCHEMA)
{
setField("yacs_file", QString(job->getJobFile().c_str()));
- _job_name_page->_yacs_schema_button->click();
+ setField("job_type_yacs", true);
setField("env_yacs_file", QString(job->getEnvFile().c_str()));
if (job->getDumpYACSState() != -1)
{
else if (job->getType() == BL::Job::COMMAND)
{
setField("command", QString(job->getJobFile().c_str()));
- _job_name_page->_command_button->click();
+ setField("job_type_command", true);
setField("env_command_file", QString(job->getEnvFile().c_str()));
}
else if (job->getType() == BL::Job::PYTHON_SALOME)
{
setField("PythonSalome", QString(job->getJobFile().c_str()));
- _job_name_page->_python_salome_button->click();
+ setField("job_type_python_salome", true);
setField("env_PythonSalome_file", QString(job->getEnvFile().c_str()));
}
// Job Name Panel
QString f_job_name = field("job_name").toString();
job_name = f_job_name.trimmed().toUtf8().constData();
+ if (field("job_type_yacs").toBool())
+ job_type = YACS;
+ else if (field("job_type_command").toBool())
+ job_type = COMMAND;
+ else
+ job_type = PYTHON_SALOME;
// YACS Schema Panel
QString f_yacs_file = field("yacs_file").toString();
python_salome_file = f_python_salome_file.trimmed().toUtf8().constData();
QString f_env_file;
- if (yacs_file != "")
+ if (job_type == YACS)
f_env_file = field("env_yacs_file").toString();
- else if (command != "")
+ else if (job_type == COMMAND)
f_env_file = field("env_command_file").toString();
- else if (python_salome_file != "")
+ else if (job_type == PYTHON_SALOME)
f_env_file = field("env_PythonSalome_file").toString();
env_file = f_env_file.trimmed().toUtf8().constData();
QLabel * label_type = new QLabel("Choose type of batch job:");
QGroupBox *groupBox = new QGroupBox("Type of job");
- _yacs_schema_button = new QRadioButton(tr("YACS Schema"));
+ QRadioButton * _yacs_schema_button = new QRadioButton(tr("YACS Schema"));
_yacs_schema_button->setChecked(true);
- _command_button = new QRadioButton(tr("Command"));
- _python_salome_button = new QRadioButton(tr("Python script in SALOME"));
+ QRadioButton * _command_button = new QRadioButton(tr("Command"));
+ 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(_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_python_salome", _python_salome_button);
QGroupBox * explanationBox = new QGroupBox("Explanation");
QVBoxLayout *explanationvbox = new QVBoxLayout;
layout->addWidget(explanationBox, 4, 0, 1, -1);
setLayout(main_layout);
- connect(_yacs_schema_button, SIGNAL(clicked(bool)), this, SLOT(yacs_schema_button(bool)));
- connect(_command_button, SIGNAL(clicked(bool)), this, SLOT(command_button(bool)));
- connect(_python_salome_button, SIGNAL(clicked(bool)), this, SLOT(python_salome_button(bool)));
+ 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(_python_salome_button, SIGNAL(toggled(bool)), this, SLOT(python_salome_button(bool)));
// Default button
yacs_schema_button(true);
int
BL::JobNamePage::nextId() const
{
- if (_yacs_schema_button->isChecked())
+ if (field("job_type_yacs").toBool())
{
return BL::CreateJobWizard::Page_YACSSchema;
}
- else if (_command_button->isChecked())
+ else if (field("job_type_command").toBool())
{
return BL::CreateJobWizard::Page_Command_Main_Definitions;
}
BL::JobsManager_QT::create_job_with_wizard(BL::CreateJobWizard & wizard)
{
BL::Job * new_job = createJob(wizard.job_name);
- if (wizard.yacs_file != "")
+ switch (wizard.job_type)
{
+ case BL::CreateJobWizard::YACS:
// YACS schema job
new_job->setType(BL::Job::YACS_SCHEMA);
new_job->setJobFile(wizard.yacs_file);
new_job->setDumpYACSState(wizard.dump_yacs_state);
- }
- else if (wizard.command != "")
- {
+ break;
+ case BL::CreateJobWizard::COMMAND:
// Command Job
new_job->setType(BL::Job::COMMAND);
new_job->setJobFile(wizard.command);
- }
- else if (wizard.python_salome_file != "")
- {
- // Command Job
+ break;
+ case BL::CreateJobWizard::PYTHON_SALOME:
+ // Python Salome Job
new_job->setType(BL::Job::PYTHON_SALOME);
new_job->setJobFile(wizard.python_salome_file);
+ break;
+ default:
+ throw BL::Exception("Unknown job type");
}
// For all jobs