From d27e9f60b3b538c705fb4c1d0cdc8f59cb4f079a Mon Sep 17 00:00:00 2001 From: ribes Date: Mon, 25 Jan 2010 10:03:46 +0000 Subject: [PATCH] - Some improvements: - status messages - Result directory without output files - job type explanation --- src/engine/BL_JobsManager.cxx | 29 ++++++++++++----- src/genericgui/BL_CreateJobWizard.cxx | 45 ++++++++++++++++++++++----- src/genericgui/BL_CreateJobWizard.hxx | 8 +++++ src/genericgui/BL_JobsManager_QT.cxx | 2 ++ 4 files changed, 70 insertions(+), 14 deletions(-) diff --git a/src/engine/BL_JobsManager.cxx b/src/engine/BL_JobsManager.cxx index eabee2e..b6e25a3 100644 --- a/src/engine/BL_JobsManager.cxx +++ b/src/engine/BL_JobsManager.cxx @@ -231,7 +231,16 @@ BL::JobsManager::refresh_job(void * object_ptr) if (job_state != BL::Job::FINISHED or job_state != BL::Job::ERROR) { std::string result = object->_salome_services->refresh_job(job); - if (result == "QUEUED") + if (result == "CREATED") + { + if (job_state != BL::Job::CREATED) + { + job->setState(BL::Job::CREATED); + if (object->_observer) + object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state"); + } + } + else if (result == "QUEUED") { if (job_state != BL::Job::QUEUED) { @@ -269,15 +278,21 @@ BL::JobsManager::refresh_job(void * object_ptr) } else if (result == "FINISHED") { - job->setState(BL::Job::FINISHED); - if (object->_observer) - object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state"); + if (job_state != BL::Job::FINISHED) + { + job->setState(BL::Job::FINISHED); + if (object->_observer) + object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state"); + } } else if (result == "ERROR") { - job->setState(BL::Job::ERROR); - if (object->_observer) - object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state"); + if (job_state != BL::Job::ERROR) + { + job->setState(BL::Job::ERROR); + if (object->_observer) + object->_observer->sendEvent("refresh_job", "Ok", job->getName(), "new state"); + } } else { diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index eed2df2..70211a1 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -171,7 +171,7 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager registerField("job_name", _nameLineEdit); QLabel * label_type = new QLabel("Choose type of batch job:"); - QGroupBox *groupBox = new QGroupBox(); + QGroupBox *groupBox = new QGroupBox("Type of job"); _yacs_schema_button = new QRadioButton(tr("YACS Schema")); _yacs_schema_button->setChecked(true); _command_button = new QRadioButton(tr("Command")); @@ -183,6 +183,14 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager vbox->addStretch(1); groupBox->setLayout(vbox); + QGroupBox * explanationBox = new QGroupBox("Explanation"); + QVBoxLayout *explanationvbox = new QVBoxLayout; + _explanation = new QLabel(); + _explanation->setWordWrap(true); + explanationvbox->addWidget(_explanation); + explanationvbox->addStretch(1); + explanationBox->setLayout(explanationvbox); + // Layouts QVBoxLayout * main_layout = new QVBoxLayout; main_layout->addWidget(label); @@ -192,12 +200,41 @@ BL::JobNamePage::JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager main_layout->insertLayout(-1, layout); layout->addWidget(label_type, 2, 0); layout->addWidget(groupBox, 3, 0, 1, -1); + 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))); + + // Default button + yacs_schema_button(true); } BL::JobNamePage::~JobNamePage() {} +void +BL::JobNamePage::yacs_schema_button(bool checked) +{ + if (checked) + _explanation->setText("This job permits to launch a YACS schema into a SALOME application"); +} + +void +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"); +} + +void +BL::JobNamePage::python_salome_button(bool checked) +{ + if (checked) + _explanation->setText("This job permits to launch a python script into a SALOME application"); +} + bool BL::JobNamePage::validatePage() { @@ -600,12 +637,6 @@ BL::FilesPage::validatePage() return false; } - if (result_directory != "" and _output_files_list->count() == 0) - { - QMessageBox::warning(NULL, "Result Error", "Please add output files or erase result directory"); - return false; - } - return true; } diff --git a/src/genericgui/BL_CreateJobWizard.hxx b/src/genericgui/BL_CreateJobWizard.hxx index 76ede8e..78bd250 100644 --- a/src/genericgui/BL_CreateJobWizard.hxx +++ b/src/genericgui/BL_CreateJobWizard.hxx @@ -90,6 +90,8 @@ namespace BL{ class JobNamePage: virtual public QWizardPage { + Q_OBJECT + public: JobNamePage(QWidget * parent, BL::JobsManager_QT * jobs_manager); virtual ~JobNamePage(); @@ -97,11 +99,17 @@ namespace BL{ virtual bool validatePage(); virtual int nextId() const ; + public slots: + void yacs_schema_button(bool checked); + void command_button(bool checked); + void python_salome_button(bool checked); + private: BL::JobsManager_QT * _jobs_manager; QRadioButton * _yacs_schema_button; QRadioButton * _command_button; QRadioButton * _python_salome_button; + QLabel * _explanation; }; class ConclusionPage: virtual public QWizardPage diff --git a/src/genericgui/BL_JobsManager_QT.cxx b/src/genericgui/BL_JobsManager_QT.cxx index 97e25c9..f6c9627 100644 --- a/src/genericgui/BL_JobsManager_QT.cxx +++ b/src/genericgui/BL_JobsManager_QT.cxx @@ -44,6 +44,8 @@ BL::JobsManager_QT::JobsManager_QT(QWidget * parent, BL::SALOMEServices * salome _load_jobs = new QPushButton("Load Jobs"); _save_jobs = new QPushButton("Save Jobs"); + _load_jobs->setEnabled(false); + _save_jobs->setEnabled(false); _auto_refresh_jobs = new QPushButton("Auto Refresh: no"); _timer = new QTimer(this); _timer->stop(); -- 2.39.2