]> SALOME platform Git repositories - tools/ydefx.git/commitdiff
Salome HOME
Add pre_command option to GUI.
authorOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 13 Mar 2019 15:09:57 +0000 (16:09 +0100)
committerOvidiu Mircescu <ovidiu.mircescu@edf.fr>
Wed, 13 Mar 2019 15:09:57 +0000 (16:09 +0100)
src/cpp/TMonoPyJob.hxx
src/gui/PathsConfig.cxx
src/gui/PathsConfig.hxx
src/gui/QuickConfig.cxx
src/gui/QuickConfig.hxx

index 93966a7c392462b458a2bed830109e7969153d69..06ee22b9bed4a75abca53557830329fbe4081bc2 100644 (file)
@@ -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
       {
index 1ac57d83c8c82305aaa26322d128504b23b266ac..9015b28e049856f1bc71d6cf4c0b930b23e60259 100644 (file)
@@ -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);
index f27ab4e5dfb69e2178dfe630883a12eda4ee6297..bea377ec298c11b197420c20e56fefb7de125552 100644 (file)
@@ -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;
 };
index 0282afbf26aa10d48f727b39f1eacee8030000c9..4db989ee92c76f9d441a8e75ff68145f98d53d0b 100644 (file)
@@ -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());
index 29bfb21431e9744b7bc12c45538efc9fcaf1cda5..71ee8af660a7efc8bbbbeef6e1f0276a574b8046 100644 (file)
@@ -31,6 +31,7 @@ public:
   virtual ~QuickConfigWidget();
 
 public slots:
+  void updateJobName(const QString& value);
   void updateResource(const QString& value);
   void updateNbBranches(int value);