From: Ovidiu Mircescu Date: Wed, 13 Mar 2019 15:09:57 +0000 (+0100) Subject: Add pre_command option to GUI. X-Git-Tag: V9_3_0rc1~3 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=42990dcc19bdac30d019313c69e9095f8ae18392;p=tools%2Fydefx.git Add pre_command option to GUI. --- diff --git a/src/cpp/TMonoPyJob.hxx b/src/cpp/TMonoPyJob.hxx index 93966a7..06ee22b 100644 --- a/src/cpp/TMonoPyJob.hxx +++ b/src/cpp/TMonoPyJob.hxx @@ -38,7 +38,7 @@ public: : MonoPyJob() , _sample(sample) { - if(_lastError.empty()) // no errors during parent contruction + if(_lastError.empty()) // no errors during parent construction { try { diff --git a/src/gui/PathsConfig.cxx b/src/gui/PathsConfig.cxx index 1ac57d8..9015b28 100644 --- a/src/gui/PathsConfig.cxx +++ b/src/gui/PathsConfig.cxx @@ -36,16 +36,6 @@ PathsConfigWidget::PathsConfigWidget(ydefx::JobParametersProxy& model, QHBoxLayout *hLayout; QLineEdit *editLine; - hLayout = new QHBoxLayout(); - label = new QLabel(tr("Job name:")); - editLine = new QLineEdit(); - editLine->setText(_model.job_name().c_str()); - hLayout->addWidget(label); - hLayout->addWidget(editLine); - mainLayout->addLayout(hLayout); - connect(editLine, SIGNAL(textChanged(const QString &)), - this, SLOT(updateJobName(const QString&))); - hLayout = new QHBoxLayout(); label = new QLabel(tr("Remote work directory:")); editLine = new QLineEdit(); @@ -71,6 +61,19 @@ PathsConfigWidget::PathsConfigWidget(ydefx::JobParametersProxy& model, this, SLOT(updateLocalDirectory(const QString&))); connect(localdirButton,SIGNAL(clicked()),this, SLOT(onChoseLocaldir())); + hLayout = new QHBoxLayout(); + label = new QLabel(tr("Preprocessing script for the frontal:")); + _preprocScriptEdit = new QLineEdit(); + _preprocScriptEdit->setText(_model.pre_command().c_str()); + QPushButton* preprocButton = new QPushButton("..."); + hLayout->addWidget(label); + hLayout->addWidget(_preprocScriptEdit); + hLayout->addWidget(preprocButton); + mainLayout->addLayout(hLayout); + connect(_preprocScriptEdit, SIGNAL(textChanged(const QString &)), + this, SLOT(updatePreprocessingScript(const QString&))); + connect(preprocButton,SIGNAL(clicked()), + this, SLOT(onChosePreprocessingScript())); QGroupBox * inputFilesBox = new QGroupBox; inputFilesBox->setTitle(tr("Additional input files:")); @@ -103,11 +106,6 @@ PathsConfigWidget::~PathsConfigWidget() { } -void PathsConfigWidget::updateJobName(const QString& value) -{ - _model.job_name(value.toStdString()); -} - void PathsConfigWidget::updateWorkingDirectory(const QString& value) { _model.work_directory(value.toStdString()); @@ -118,6 +116,11 @@ void PathsConfigWidget::updateLocalDirectory(const QString& value) _model.result_directory(value.toStdString()); } +void PathsConfigWidget::updatePreprocessingScript(const QString& value) +{ + _model.pre_command(value.toStdString()); +} + void PathsConfigWidget::onChoseLocaldir() { QString dir; @@ -134,6 +137,20 @@ void PathsConfigWidget::onChoseLocaldir() } } +void PathsConfigWidget::onChosePreprocessingScript() +{ + QString file; + file = QFileDialog::getOpenFileName(this, + tr("Choose a script file"), + ""); + + if (file != "") + { + _model.pre_command(file.toStdString()); + _preprocScriptEdit->setText(file); + } +} + void PathsConfigWidget::inputSelectionChanged() { bool canRemove = (_inputFilesList->selectedItems().size() > 0); diff --git a/src/gui/PathsConfig.hxx b/src/gui/PathsConfig.hxx index f27ab4e..bea377e 100644 --- a/src/gui/PathsConfig.hxx +++ b/src/gui/PathsConfig.hxx @@ -31,10 +31,11 @@ public: virtual ~PathsConfigWidget(); public slots: - void updateJobName(const QString& value); void updateWorkingDirectory(const QString& value); void updateLocalDirectory(const QString& value); + void updatePreprocessingScript(const QString& value); void onChoseLocaldir(); + void onChosePreprocessingScript(); void inputSelectionChanged(); void addInputFiles(); void removeInputFiles(); @@ -45,6 +46,7 @@ signals: private: ydefx::JobParametersProxy& _model; QLineEdit * _localdirEdit; + QLineEdit * _preprocScriptEdit; QListWidget * _inputFilesList; QPushButton *_removeInputFilesButton; }; diff --git a/src/gui/QuickConfig.cxx b/src/gui/QuickConfig.cxx index 0282afb..4db989e 100644 --- a/src/gui/QuickConfig.cxx +++ b/src/gui/QuickConfig.cxx @@ -57,6 +57,16 @@ QuickConfigWidget::QuickConfigWidget(ydefx::JobParametersProxy& model, connect(nb_branchesEdit, SIGNAL(valueChanged(int)), this, SLOT(updateNbBranches(int))); + hLayout = new QHBoxLayout(); + QLabel *label = new QLabel(tr("Job name:")); + QLineEdit *editLine = new QLineEdit(); + editLine->setText(_model.job_name().c_str()); + hLayout->addWidget(label); + hLayout->addWidget(editLine); + mainLayout->addLayout(hLayout); + connect(editLine, SIGNAL(textChanged(const QString &)), + this, SLOT(updateJobName(const QString&))); + mainLayout->addStretch(); setWidget(mainWidget); setWidgetResizable (true); @@ -66,6 +76,11 @@ QuickConfigWidget::~QuickConfigWidget() { } +void QuickConfigWidget::updateJobName(const QString& value) +{ + _model.job_name(value.toStdString()); +} + void QuickConfigWidget::updateResource(const QString& value) { _model.configureResource(value.toStdString()); diff --git a/src/gui/QuickConfig.hxx b/src/gui/QuickConfig.hxx index 29bfb21..71ee8af 100644 --- a/src/gui/QuickConfig.hxx +++ b/src/gui/QuickConfig.hxx @@ -31,6 +31,7 @@ public: virtual ~QuickConfigWidget(); public slots: + void updateJobName(const QString& value); void updateResource(const QString& value); void updateNbBranches(int value);