Ensemble: Run: Add function combobox and seed spin box.

scenario-dev-pa
Pierre-Antoine 2026-09-10 16:17:57 +02:00
parent 345f24996f
commit 3325ba935b
3 changed files with 80 additions and 20 deletions

View File

@ -42,7 +42,7 @@ from PyQt5.QtWidgets import (
QFileDialog, QTableView, QAbstractItemView,
QUndoStack, QShortcut, QAction, QItemDelegate,
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
QTextEdit, QProgressBar,
QTextEdit, QProgressBar, QCheckBox,
)
from View.RunSolver.Log.Window import SolverLogFileWindow
@ -72,10 +72,21 @@ class EnsembleRunNumberDialog(PamhyrDialog):
)
self._init_default_values()
self._init_connection()
def _init_default_values(self):
self.combobox_add_items("comboBox", ["Random"])
self.set_combobox_text("comboBox", "Random")
self.set_spin_box("spinBox", 100)
def _init_connection(self):
self._checkbox = self.find(QCheckBox, f"checkBox")
self._checkbox.clicked.connect(self._set_random_seed_spin_box_state)
def _set_random_seed_spin_box_state(self):
self.set_spin_box_enable("spinBox_seed", self._checkbox.isChecked())
@property
def number(self):
return self._number

View File

@ -390,6 +390,19 @@ class ASubWindowFeatures(object):
"""
return self.find(QSpinBox, name).value()
def set_spin_box_enable(self, name: str, value: bool):
"""Set status of spinbox component
Args:
name: The spinbox component name
value: The boolean value
Returns:
Nothing
"""
self.find(QSpinBox, name).setEnabled(value)
def set_double_spin_box(self, name: str, value: int):
"""Set value of spinbox component

View File

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>400</width>
<height>79</height>
<height>152</height>
</rect>
</property>
<property name="windowTitle">
@ -15,13 +15,29 @@
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QLabel" name="label">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Run number</string>
<string>Draw function</string>
</property>
</widget>
</item>
<item row="0" column="1">
<item>
<widget class="QComboBox" name="comboBox"/>
</item>
</layout>
</item>
<item row="1" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Number of run</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox">
<property name="minimum">
<number>1</number>
@ -34,7 +50,27 @@
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
</layout>
</item>
<item row="2" column="0">
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Custom random seed</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinBox_seed">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
</layout>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>