# 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
+from PyQt4 import QtGui
from PyQt4.QtCore import Qt
from varrange_ui import Ui_VariableRange
+from definevalues_ui import Ui_SampleDefinition
class VariableRange(QtGui.QWidget, Ui_VariableRange):
self.setupUi(self)
-class DefineValuesFrame(QtGui.QWidget):
+class DefineValuesFrame(QtGui.QWidget, Ui_SampleDefinition):
def __init__(self, parent = None):
QtGui.QWidget.__init__(self, parent)
- self.setLayout(QtGui.QVBoxLayout(self))
+ self.setupUi(self)
self.varwidgets = {}
- self.layout().addStretch()
def set_variables(self, varlist):
previous_set = set(self.varwidgets.keys())
var_to_remove = previous_set - new_set
var_to_add = new_set - previous_set
for var in var_to_remove:
- self.layout().removeWidget(self.varwidgets[var])
+ self.variablesRangesWidget.layout().removeWidget(self.varwidgets[var])
self.varwidgets[var].close()
del self.varwidgets[var]
for var in var_to_add:
varrange = VariableRange(self)
varrange.nameLabel.setText(var)
self.varwidgets[var] = varrange
- self.layout().insertWidget(self.layout().count()-1, varrange)
+ self.variablesRangesWidget.layout().addWidget(varrange)
def set_ranges_from_param_study(self, param_study):
for var in param_study.input_vars:
varrange.toSpinBox.setValue(var.max)
varrange.stepSpinBox.setValue(var.step)
self.varwidgets[var.name] = varrange
- self.layout().insertWidget(self.layout().count()-1, varrange)
+ self.variablesRangesWidget.layout().addWidget(varrange)
def check_values(self):
return True
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
+ <class>SampleDefinition</class>
+ <widget class="QWidget" name="SampleDefinition">
+ <property name="geometry">
+ <rect>
+ <x>0</x>
+ <y>0</y>
+ <width>765</width>
+ <height>720</height>
+ </rect>
+ </property>
+ <property name="windowTitle">
+ <string>Sample Definition</string>
+ </property>
+ <layout class="QVBoxLayout" name="verticalLayout">
+ <item>
+ <widget class="QLabel" name="label_3">
+ <property name="text">
+ <string>Choose a method to define the input sample:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="variableRangeRB">
+ <property name="text">
+ <string>Define variable(s) range(s)</string>
+ </property>
+ <property name="checked">
+ <bool>true</bool>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">sampleDefinitionMethodBG</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="QScrollArea" name="variablesRangesSA">
+ <property name="sizePolicy">
+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
+ <horstretch>0</horstretch>
+ <verstretch>0</verstretch>
+ </sizepolicy>
+ </property>
+ <property name="widgetResizable">
+ <bool>true</bool>
+ </property>
+ <widget class="QWidget" name="variablesRangesWidget">
+ <layout class="QVBoxLayout" name="verticalLayout_3"/>
+ </widget>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="pythonScriptRB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Define sample with a Python script</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">sampleDefinitionMethodBG</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>13</height>
+ </size>
+ </property>
+ </spacer>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
+ <item>
+ <widget class="QLabel" name="pyscriptLabel">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="font">
+ <font>
+ <italic>true</italic>
+ </font>
+ </property>
+ <property name="text">
+ <string>This script must create a NumPy array of dimension (m,n) named <b>sample</b><br>- where m is the number of points in the sample<br>- where n is the number of input variables</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QTextEdit" name="pythonScriptTE">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="font">
+ <font>
+ <family>DejaVu Sans Mono</family>
+ </font>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <widget class="QRadioButton" name="loadSampleRB">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Load sample from a CSV file</string>
+ </property>
+ <attribute name="buttonGroup">
+ <string notr="true">sampleDefinitionMethodBG</string>
+ </attribute>
+ </widget>
+ </item>
+ <item>
+ <layout class="QHBoxLayout" name="horizontalLayout_3">
+ <item>
+ <spacer name="horizontalSpacer_4">
+ <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="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>CSV File:</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="lineEdit">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QPushButton" name="pushButton">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string>Choose File...</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ </layout>
+ </widget>
+ <resources/>
+ <connections/>
+ <buttongroups>
+ <buttongroup name="sampleDefinitionMethodBG"/>
+ </buttongroups>
+</ui>