]> SALOME platform Git repositories - modules/parametric.git/commitdiff
Salome HOME
Replace Eficas by a custom GUI for the definition of execution parameters
authorRenaud Barate <renaud.barate@edf.fr>
Thu, 30 Aug 2012 09:22:02 +0000 (11:22 +0200)
committerRenaud Barate <renaud.barate@edf.fr>
Thu, 30 Aug 2012 09:22:02 +0000 (11:22 +0200)
16 files changed:
src/PARAMETRIC/PARAMETRIC.py
src/salome/__init__.py [new file with mode: 0644]
src/salome/parametric/gui/CMakeLists.txt
src/salome/parametric/gui/definevalues.py
src/salome/parametric/gui/eficas/__init__.py [deleted file]
src/salome/parametric/gui/eficas/appli.py [deleted file]
src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py [deleted file]
src/salome/parametric/gui/eficas/parametric_exec_params_cata.py [deleted file]
src/salome/parametric/gui/eficas/prefs.py [deleted file]
src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py [deleted file]
src/salome/parametric/gui/execparams.py [new file with mode: 0644]
src/salome/parametric/gui/execparams.ui [new file with mode: 0644]
src/salome/parametric/gui/mainpanel.py
src/salome/parametric/gui/wizard.py
src/salome/parametric/gui/wizard.ui
src/salome/parametric/study.py

index 850164d2466d39c5285b76f6d16a42bc55cc4ab5..831ef4d00eceb370becc7c641bdc898e30be3196 100644 (file)
@@ -99,10 +99,10 @@ class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOM
       if param_input_tc is None:
         raise Exception ("Internal error: No typecode found for type 'SALOME_TYPES/ParametricInput'")
       foreach = pilot.ForEachLoop("ForEach", param_input_tc)
-      foreach.edGetNbOfBranchesPort().edInit(param_study.get_exec_param("NUMBER_OF_PARALLEL_COMPUTATIONS"))
+      foreach.edGetNbOfBranchesPort().edInit(param_study.nb_parallel_computations)
       proc.edAddChild(foreach)
 
-      solver_code = param_study.get_exec_param("SOLVER_CODE")
+      solver_code = param_study.salome_component_name
       solver_compo_inst = proc.createComponentInstance(solver_code)
       solver_compo_def = self.session_catalog._componentMap[solver_code]
       
@@ -113,7 +113,7 @@ class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOM
       init_solver = solver_compo_def._serviceMap["Init"].clone(None)
       init_solver.setComponent(solver_compo_inst)
       init_solver.getInputPort("studyID").edInit(studyId)
-      entry = self._parse_entry(param_study.get_exec_param("DETERMINISTIC_CASE_ENTRY"))
+      entry = self._parse_entry(param_study.solver_case_entry)
       init_solver.getInputPort("detCaseEntry").edInit(entry)
       foreach.edSetInitNode(init_solver)
 
@@ -174,7 +174,6 @@ class PARAMETRIC(PARAMETRIC_ORB__POA.PARAMETRIC_Gen, SALOME_ComponentPy_i, SALOM
       # Launch computation
       executor = pilot.ExecutorSwig()
       executor.RunPy(proc)
-      state = proc.getEffectiveState()
       if proc.getEffectiveState() != pilot.DONE:
         msg = proc.getErrorReport()
         if msg != "":
diff --git a/src/salome/__init__.py b/src/salome/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
index 8fccb25cb7eb30189254921264fca5bb0cfa9bce..f1cf0180729dccf557e017aebfa27ef2fc4bc78e 100644 (file)
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU Lesser General Public License
 # along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
 
-SET(PYUIC_FILES wizard_ui.py varrange_ui.py)
+SET(PYUIC_FILES wizard_ui.py varrange_ui.py execparams_ui.py)
 SET(INSTALL_DIR ${PYTHONDIR}/salome/parametric/gui)
 
 FOREACH(OUTPUT ${PYUIC_FILES})
index 5fd11664e9a5e58d4c94d5734d9f5a339420c58d..43c1c726f94e501534d2b2523d450cb1662317e7 100644 (file)
@@ -49,6 +49,7 @@ class DefineValuesFrame(QtGui.QWidget):
       varrange.nameLabel.setText(var)
       self.varwidgets[var] = varrange
       self.layout().addWidget(varrange)
+    self.layout().addStretch()
 
   def set_ranges_from_param_study(self, param_study):
     for var in param_study.input_vars:
@@ -59,3 +60,4 @@ class DefineValuesFrame(QtGui.QWidget):
       varrange.stepSpinBox.setValue(var.step)
       self.varwidgets[var.name] = varrange
       self.layout().addWidget(varrange)
+    self.layout().addStretch()
diff --git a/src/salome/parametric/gui/eficas/__init__.py b/src/salome/parametric/gui/eficas/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/src/salome/parametric/gui/eficas/appli.py b/src/salome/parametric/gui/eficas/appli.py
deleted file mode 100644 (file)
index e9a03c0..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 EDF
-#
-# This file is part of SALOME PARAMETRIC module.
-#
-# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import sys
-import re
-import tempfile
-
-from PyQt4.QtGui import QMessageBox
-
-import salome
-import SalomePyQt
-sgPyQt = SalomePyQt.SalomePyQt()
-
-from salome.kernel.logger import Logger
-from salome.kernel import termcolor
-logger = Logger("salome.openturns.eficas_yacs_schema.appli",
-                color = termcolor.GREEN_FG)
-from salome.kernel.studyedit import getStudyEditor
-
-import eficasSalome
-
-
-class SalomeEntry:
-  
-  enable_salome_selection = True
-  help_message = u"Une entrée de l'arbre d'étude de Salome est attendue"
-  
-  def __init__(self, entryStr):
-    self._entry = entryStr
-  
-  @staticmethod
-  def __convert__(entryStr):
-    return SalomeEntry(entryStr)
-  
-  @staticmethod
-  def get_selected_value(selected_entry, study_editor):
-    sobj = study_editor.study.FindObjectID(selected_entry)
-    name = sobj.GetName()
-    return "%s (%s)" % (name, selected_entry)
-
-def parse_entry(selected_value):
-  """
-  Find entry if selected_value is something like "name (entry)"
-  """
-  entry = selected_value
-  match = re.search("\((.*)\)$", entry)
-  if match is not None:
-    entry = match.group(1)
-  return entry
-
-class EficasFrame(eficasSalome.MyEficas):
-  """
-  This class launches Eficas for PARAMETRIC module. The messages in this class are in
-  french because they are displayed in Eficas interface.
-
-  """
-  def __init__(self, parent = None):
-    self.codedir = os.path.dirname(__file__)
-    sys.path[:0] = [self.codedir]
-    eficasSalome.MyEficas.__init__(self, parent, "parametric_exec_params")
-    self.editor = getStudyEditor()
-
-  def selectGroupFromSalome(self, kwType = None, editor = None):
-    """
-    Select an entry from Salome object browser
-    """
-    nbEntries = salome.sg.SelectedCount()
-    if nbEntries < 1:
-      msg = u"Veuillez sélectionner une entrée de l'arbre d'étude de Salome"
-      QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(msg))
-      return [], msg
-    elif nbEntries > 1:
-      msg = u"Une seule entrée doit être sélectionnée dans l'arbre d'étude de Salome"
-      QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(msg))
-      return [], msg
-    else:
-      try:
-        value = kwType.get_selected_value(salome.sg.getSelected(0), self.editor)
-        msg = u"L'entrée de l'arbre d'étude de Salome a été sélectionnée"
-        return [value], msg
-      except Exception, e:
-        QMessageBox.information(self, self.tr(u"Sélection depuis Salome"), self.tr(unicode(e)))
-        return [], unicode(e)
-
-  def get_text_jdc(self):
-    """
-    Return the currently edited JDC as text
-    """
-    editor_index = self.viewmanager.myQtab.currentIndex()
-    if editor_index < 0:
-      return None
-    eficas_editor = self.viewmanager.dict_editors[editor_index]
-    return eficas_editor.get_text_JDC(eficas_editor.format)
-
-  def closeEvent(self, event):
-    while self.codedir in sys.path:
-      sys.path.remove(self.codedir)
-    eficasSalome.MyEficas.closeEvent(self, event)
-
-  def set_exec_params_from_param_study(self, param_study):
-    # No clean way to load JDC directly in Eficas, use a temp file instead
-    (fd, filename) = tempfile.mkstemp()
-    os.close(fd)
-    f = open(filename, "w")
-    f.write(param_study.exec_params)
-    f.close()
-    self.viewmanager.handleOpen(filename)
diff --git a/src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py b/src/salome/parametric/gui/eficas/configuration_parametric_exec_params.py
deleted file mode 100644 (file)
index d6768e9..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright (C) 2012 EDF
-#
-# This file is part of SALOME PARAMETRIC module.
-#
-# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-from Editeur.catadesc import CatalogDescription
-from InterfaceQT4.configuration import CONFIG_BASE
-
-class CONFIG(CONFIG_BASE):
-
-  def __init__(self, appli, repIni):
-    """
-    This class stores the configuration parameters for Eficas
-    """
-    CONFIG_BASE.__init__(self, appli, repIni, '.parametric_exec_params')
-
-    # Configuration parameters
-    self.savedir = os.getenv("HOME")
-    catapath = os.path.join(os.path.dirname(__file__), "parametric_exec_params_cata.py")
-    self.catalogues = (CatalogDescription("parametric_exec_params", catapath),)
-
-  def save_params(self):
-    pass
-
-def make_config(appli, rep):
-  return CONFIG(appli, rep)
-
-def make_config_style(appli, rep):
-  return None
diff --git a/src/salome/parametric/gui/eficas/parametric_exec_params_cata.py b/src/salome/parametric/gui/eficas/parametric_exec_params_cata.py
deleted file mode 100644 (file)
index d63aa97..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-# -*- coding: utf-8 -*-
-#
-# Copyright (C) 2012 EDF
-#
-# This file is part of SALOME PARAMETRIC module.
-#
-# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
-
-from salome.parametric.gui.eficas.appli import SalomeEntry
-from Accas import *
-
-JdC = JDC_CATA(regles = (UN_PARMI('EXECUTION_PARAMETERS',)),
-                        )
-
-EXECUTION_PARAMETERS = PROC(
-    nom = "EXECUTION_PARAMETERS", op = None,
-    fr = u"Paramètres d'exécution de l'étude paramétrique",
-    PARAMETRIC_STUDY_NAME = SIMP(statut = "o", typ = 'TXM',
-                                 defaut = "Parametric Study",
-                                 fr = u"Nom de l'étude paramétrique qui sera créée dans l'arbre d'étude de Salome"),
-    SOLVER_CODE = SIMP(statut = "o", typ = 'TXM',
-                       defaut = "DEVIATION",
-                       fr = u"Nom du composant de calcul"),
-    DETERMINISTIC_CASE_ENTRY = SIMP(statut = "o", typ = SalomeEntry,
-                                    fr = u"Cas déterministe dans l'arbre d'étude de Salome"),
-    NUMBER_OF_PARALLEL_COMPUTATIONS = SIMP(statut = "o", typ = 'I', defaut = 1,
-                                           fr = u"Nombre de branches de calcul parallèles"),
-)
diff --git a/src/salome/parametric/gui/eficas/prefs.py b/src/salome/parametric/gui/eficas/prefs.py
deleted file mode 100644 (file)
index 95b5101..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-# Copyright (C) 2012 EDF
-#
-# This file is part of SALOME PARAMETRIC module.
-#
-# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
-
-code = "parametric_exec_params"
diff --git a/src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py b/src/salome/parametric/gui/eficas/prefs_parametric_exec_params.py
deleted file mode 100644 (file)
index 07e2224..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright (C) 2012 EDF
-#
-# This file is part of SALOME PARAMETRIC module.
-#
-# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public License
-# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-repIni = os.path.dirname(__file__)
-INSTALLDIR = os.getenv("EFICAS_ROOT")
diff --git a/src/salome/parametric/gui/execparams.py b/src/salome/parametric/gui/execparams.py
new file mode 100644 (file)
index 0000000..84a8b55
--- /dev/null
@@ -0,0 +1,70 @@
+# Copyright (C) 2012 EDF
+#
+# This file is part of SALOME PARAMETRIC module.
+#
+# SALOME PARAMETRIC module is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# SALOME PARAMETRIC module is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with SALOME PARAMETRIC module.  If not, see <http://www.gnu.org/licenses/>.
+
+from PyQt4 import QtGui, QtCore
+
+import salome
+from salome.kernel.studyedit import getStudyEditor
+
+from salome.parametric.study import ParametricStudy
+from execparams_ui import Ui_ExecParams
+
+
+class ExecParamsFrame(QtGui.QWidget, Ui_ExecParams):
+
+  def __init__(self, parent = None):
+    QtGui.QWidget.__init__(self, parent)
+    self.setupUi(self)
+    self.connect(self.selectFromSalomeButton, QtCore.SIGNAL("clicked()"), self.select_from_salome)
+    self.case_entry = None
+  
+  def select_from_salome(self):
+    nb_entries = salome.sg.SelectedCount()
+    if nb_entries < 1:
+      QtGui.QMessageBox.information(self, self.tr("Select from Salome"),
+                                    self.tr("Please select an entry in Salome Object Browser"))
+    elif nb_entries > 1:
+      QtGui.QMessageBox.information(self, self.tr("Select from Salome"),
+                                    self.tr("Only one entry must be selected in Salome Object Browser"))
+    else:
+      self.set_case_entry(salome.sg.getSelected(0))
+
+  def set_case_entry(self, entry):
+    self.case_entry = entry
+    self.caseEntryLE.setText(getStudyEditor().study.FindObjectID(entry).GetName() + " (" + entry + ")")
+
+  def gui_to_study(self, param_study):
+    if self.salomeComponentRB.isChecked():
+      param_study.solver_code_type = ParametricStudy.SALOME_COMPONENT
+      param_study.salome_component_name = str(self.componentNameLE.text())
+      param_study.solver_case_entry = self.case_entry
+    else:
+      param_study.solver_code_type = ParametricStudy.PYTHON_SCRIPT
+      param_study.python_script = str(self.pythonScriptTE.text())
+    param_study.name = str(self.studyNameLE.text())
+    param_study.nb_parallel_computations = self.nbParallelSB.value()
+
+  def study_to_gui(self, param_study):
+    if param_study.solver_code_type == ParametricStudy.SALOME_COMPONENT:
+      self.salomeComponentRB.setChecked(True)
+      self.componentNameLE.setText(param_study.salome_component_name)
+      self.set_case_entry(param_study.solver_case_entry)
+    else:
+      self.pythonScriptRB.setChecked(True)
+      self.pythonScriptTE.setText(param_study.python_script)
+    self.studyNameLE.setText(param_study.name)
+    self.nbParallelSB.setValue(param_study.nb_parallel_computations)
diff --git a/src/salome/parametric/gui/execparams.ui b/src/salome/parametric/gui/execparams.ui
new file mode 100644 (file)
index 0000000..2270933
--- /dev/null
@@ -0,0 +1,213 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>ExecParams</class>
+ <widget class="QWidget" name="ExecParams">
+  <property name="geometry">
+   <rect>
+    <x>0</x>
+    <y>0</y>
+    <width>765</width>
+    <height>720</height>
+   </rect>
+  </property>
+  <property name="windowTitle">
+   <string>Execution Parameters</string>
+  </property>
+  <layout class="QVBoxLayout" name="verticalLayout">
+   <item>
+    <widget class="QGroupBox" name="groupBox">
+     <property name="title">
+      <string>Solver Code</string>
+     </property>
+     <layout class="QVBoxLayout" name="verticalLayout_2">
+      <item>
+       <widget class="QRadioButton" name="salomeComponentRB">
+        <property name="text">
+         <string>SALOME Component</string>
+        </property>
+        <property name="checked">
+         <bool>true</bool>
+        </property>
+        <attribute name="buttonGroup">
+         <string notr="true">solverCodeTypeBG</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout">
+        <item>
+         <spacer name="horizontalSpacer_2">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>25</width>
+            <height>10</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QLabel" name="label">
+          <property name="text">
+           <string>Component Name:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="componentNameLE">
+          <property name="text">
+           <string>DEVIATION</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>30</width>
+            <height>10</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QLabel" name="label_2">
+          <property name="text">
+           <string>Case Entry:</string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QLineEdit" name="caseEntryLE">
+          <property name="readOnly">
+           <bool>true</bool>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <widget class="QPushButton" name="selectFromSalomeButton">
+          <property name="text">
+           <string>Select </string>
+          </property>
+         </widget>
+        </item>
+        <item>
+         <spacer name="horizontalSpacer_4">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>40</width>
+            <height>20</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+       </layout>
+      </item>
+      <item>
+       <widget class="QRadioButton" name="pythonScriptRB">
+        <property name="enabled">
+         <bool>false</bool>
+        </property>
+        <property name="text">
+         <string>Python Script</string>
+        </property>
+        <attribute name="buttonGroup">
+         <string notr="true">solverCodeTypeBG</string>
+        </attribute>
+       </widget>
+      </item>
+      <item>
+       <layout class="QHBoxLayout" name="horizontalLayout_2">
+        <item>
+         <spacer name="horizontalSpacer_3">
+          <property name="orientation">
+           <enum>Qt::Horizontal</enum>
+          </property>
+          <property name="sizeType">
+           <enum>QSizePolicy::Fixed</enum>
+          </property>
+          <property name="sizeHint" stdset="0">
+           <size>
+            <width>25</width>
+            <height>10</height>
+           </size>
+          </property>
+         </spacer>
+        </item>
+        <item>
+         <widget class="QTextEdit" name="pythonScriptTE">
+          <property name="enabled">
+           <bool>false</bool>
+          </property>
+         </widget>
+        </item>
+       </layout>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item>
+    <widget class="QGroupBox" name="groupBox_2">
+     <property name="title">
+      <string>Other Parameters</string>
+     </property>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="1">
+       <widget class="QLineEdit" name="studyNameLE">
+        <property name="text">
+         <string>Parametric Study</string>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="0">
+       <widget class="QLabel" name="label_4">
+        <property name="text">
+         <string>Number of Parallel Computations:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="0" column="0">
+       <widget class="QLabel" name="label_3">
+        <property name="text">
+         <string>Parametric Study Name:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="6" column="1">
+       <widget class="QSpinBox" name="nbParallelSB">
+        <property name="minimum">
+         <number>1</number>
+        </property>
+        <property name="maximum">
+         <number>1000000</number>
+        </property>
+        <property name="value">
+         <number>1</number>
+        </property>
+       </widget>
+      </item>
+     </layout>
+    </widget>
+   </item>
+  </layout>
+ </widget>
+ <resources/>
+ <connections/>
+ <buttongroups>
+  <buttongroup name="solverCodeTypeBG"/>
+ </buttongroups>
+</ui>
index f34451a0af1ddba3f508668cfdc4da8ec492c121..07ce22fae59992a5b8f397251aa03a339baadb81 100644 (file)
@@ -24,11 +24,11 @@ class MainPanel():
 
   def new_study(self):
     wizard = Wizard(sgPyQt.getDesktop())
-    id = sgPyQt.createView("New Parametric Study", wizard)
-    wizard.view_id = id
+    view_id = sgPyQt.createView("New Parametric Study", wizard)
+    wizard.view_id = view_id
 
   def edit_study(self, param_study):
     wizard = Wizard(sgPyQt.getDesktop())
     wizard.set_study(param_study)
-    id = sgPyQt.createView(param_study.get_exec_param("PARAMETRIC_STUDY_NAME"), wizard)
-    wizard.view_id = id
+    view_id = sgPyQt.createView(param_study.name, wizard)
+    wizard.view_id = view_id
index 533a0ff6fe432b6030fed774f70bef3c151bf02a..0dfffb02dbf022f1be5c432a9a750a1c33b8e67d 100644 (file)
@@ -24,7 +24,7 @@ sgPyQt = SalomePyQt.SalomePyQt()
 from wizard_ui import Ui_Wizard
 from selectvars import SelectVarsFrame
 from definevalues import DefineValuesFrame
-from salome.parametric.gui.eficas.appli import EficasFrame
+from execparams import ExecParamsFrame
 from salome.parametric.study import ParametricVariable, ParametricStudy, ParametricStudyEditor
 
 
@@ -43,7 +43,7 @@ class Wizard(QtGui.QWidget, Ui_Wizard):
       self.stepLayout.addWidget(self.step_labels[i])
     self.select_vars_frame = SelectVarsFrame(self)
     self.define_values_frame = DefineValuesFrame(self)
-    self.exec_params_frame = EficasFrame(self)
+    self.exec_params_frame = ExecParamsFrame(self)
     self.step_frames = [self.select_vars_frame,
                         self.define_values_frame,
                         self.exec_params_frame]
@@ -91,18 +91,18 @@ class Wizard(QtGui.QWidget, Ui_Wizard):
     param_study = ParametricStudy()
     # Input variables
     for (name, range_widget) in self.define_values_frame.varwidgets.iteritems():
-      min = range_widget.fromSpinBox.value()
-      max = range_widget.toSpinBox.value()
+      minval = range_widget.fromSpinBox.value()
+      maxval = range_widget.toSpinBox.value()
       step = range_widget.stepSpinBox.value()
-      var = ParametricVariable(name, min, max, step)
+      var = ParametricVariable(name, minval, maxval, step)
       param_study.add_input_variable(var)
     # Output variables
     exch_vars = self.select_vars_frame.getSelectedExchangeVariables()
     for outvar in exch_vars.outputVarList:
       param_study.add_output_variable(outvar.name)
     # Execution parameters
-    exec_params_comm = self.exec_params_frame.get_text_jdc()
-    param_study.set_exec_params(exec_params_comm)
+    self.exec_params_frame.gui_to_study(param_study)
+
     # Save to Salome study
     ed = ParametricStudyEditor()
     if self.entry is not None:
@@ -116,7 +116,7 @@ class Wizard(QtGui.QWidget, Ui_Wizard):
     self.entry = param_study.entry
     self.select_vars_frame.set_vars_from_param_study(param_study)
     self.define_values_frame.set_ranges_from_param_study(param_study)
-    self.exec_params_frame.set_exec_params_from_param_study(param_study)
+    self.exec_params_frame.study_to_gui(param_study)
 
   def close(self):
     QtGui.QWidget.close(self)
index 627a7e33e73ddb75d06e83a445ecdf8eb7f82230..b5fb4875f450527f66cb062404cb066df9350482 100644 (file)
    </item>
    <item>
     <widget class="QFrame" name="innerFrame">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="frameShape">
       <enum>QFrame::StyledPanel</enum>
      </property>
      <layout class="QVBoxLayout" name="verticalLayout_3"/>
     </widget>
    </item>
-   <item>
-    <spacer name="verticalSpacer">
-     <property name="orientation">
-      <enum>Qt::Vertical</enum>
-     </property>
-     <property name="sizeHint" stdset="0">
-      <size>
-       <width>20</width>
-       <height>198</height>
-      </size>
-     </property>
-    </spacer>
-   </item>
    <item>
     <layout class="QHBoxLayout" name="horizontalLayout">
      <item>
index de68dd553d7a190a3fe439a68015de90ece81ec8..703f731679a083c1d2bdf5509cdf15bc2577f47d 100644 (file)
@@ -29,21 +29,6 @@ COMPONENT_ICON = "PARAMETRIC_small.png"
 PARAM_STUDY_ICON = "param_study.png"
 PARAM_STUDY_TYPE_ID = 1
 
-def jdc_to_dict(jdc, command_list):
-    """
-    This tricky function transforms a JdC with a single command into a
-    dictionary that can be used more easily from a Python context (thanks to
-    M. Courtois and G. Boulant).
-    """
-    context = {}
-    for command in command_list:
-        context[command] = _args_to_dict
-    exec "parameters = " + jdc.strip() in context
-    return context['parameters']
-
-def _args_to_dict(**kwargs):
-    return kwargs
-
 class ParametricStudyEditor:
   """
   This class provides utility methods to edit the component "Parametric" in
@@ -74,7 +59,7 @@ class ParametricStudyEditor:
 
   def _set_sobj(self, parametric_study, sobj):
     self.editor.setItem(sobj,
-                        name = parametric_study.get_exec_param("PARAMETRIC_STUDY_NAME"),
+                        name = parametric_study.name,
                         comment = cPickle.dumps(parametric_study),
                         icon = PARAM_STUDY_ICON,
                         typeId = PARAM_STUDY_TYPE_ID)
@@ -90,19 +75,27 @@ class ParametricStudyEditor:
 
 class ParametricVariable:
 
-  def __init__(self, name, min = None, max = None, step = None):
+  def __init__(self, name, minval = None, maxval = None, step = None):
     self.name = name
-    self.min = min
-    self.max = max
+    self.min = minval
+    self.max = maxval
     self.step = step
 
 
 class ParametricStudy:
+  
+  SALOME_COMPONENT = 0
+  PYTHON_SCRIPT = 1
 
   def __init__(self):
     self.input_vars = []
     self.output_vars = []
-    self.exec_params = None
+    self.solver_code_type = ParametricStudy.SALOME_COMPONENT
+    self.salome_component_name = None
+    self.solver_case_entry = None
+    self.python_script = None
+    self.name = None
+    self.nb_parallel_computations = 1
     self.data = None
     self.datasize = 0
     self._value_dict = None
@@ -114,13 +107,6 @@ class ParametricStudy:
   def add_output_variable(self, varname):
     self.output_vars.append(varname)
 
-  def set_exec_params(self, params):
-    self.exec_params = params
-
-  def get_exec_param(self, name):
-    param_dict = jdc_to_dict(self.exec_params, ["EXECUTION_PARAMETERS"])
-    return param_dict[name]
-  
   def generate_data(self):
     self.data = {}
     self.datasize = 0