mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Ensemble: Add normal low and generalise minmaxdialog.
This commit is contained in:
1 parent
6e029beafc
commit
8e77d31a5a
5 files changed
+69
-26
No files matched your search
@@ -184,25 +184,26 @@ class EnsemblesWindow(PamhyrWindow):
|
||||
|
||||
for row in rows:
|
||||
try:
|
||||
dlg = MinMaxDialog(
|
||||
ensemble=self._ensembles.get(row),
|
||||
ens = self._ensembles.get(row)
|
||||
dlg = Ensemble2ParamsDialog(
|
||||
ensemble=ens,
|
||||
trad=self._trad,
|
||||
parent=self
|
||||
)
|
||||
if dlg.exec():
|
||||
self._ensembles.get(row).params = dlg._minmax
|
||||
self._ensembles.get(row).params = dlg._values
|
||||
except Exception as e:
|
||||
logger_exception(e)
|
||||
return
|
||||
|
||||
|
||||
class MinMaxDialog(PamhyrDialog):
|
||||
_pamhyr_ui = "MinMaxDialog"
|
||||
_pamhyr_name = "Minmax"
|
||||
class Ensemble2ParamsDialog(PamhyrDialog):
|
||||
_pamhyr_ui = "Ensemble2ParamsDialog"
|
||||
_pamhyr_name = "Parameters"
|
||||
|
||||
def __init__(self, ensemble=None,
|
||||
trad=None, parent=None):
|
||||
super(MinMaxDialog, self).__init__(
|
||||
super(Ensemble2ParamsDialog, self).__init__(
|
||||
title=trad[self._pamhyr_name],
|
||||
trad=trad,
|
||||
options=[],
|
||||
@@ -210,23 +211,30 @@ class MinMaxDialog(PamhyrDialog):
|
||||
)
|
||||
|
||||
self._ensemble = ensemble
|
||||
self._labels = ensemble.function.labels
|
||||
|
||||
self._init_default_labels()
|
||||
self._init_default_values()
|
||||
|
||||
def _init_default_labels(self):
|
||||
self.set_label_text("label_0", self._trad[self._labels[0]])
|
||||
self.set_label_text("label_1", self._trad[self._labels[1]])
|
||||
|
||||
|
||||
def _init_default_values(self):
|
||||
self._minmax = self._ensemble.params
|
||||
if len(self._minmax) > 0:
|
||||
self.set_double_spin_box("doubleSpinBox_min", self._minmax[0])
|
||||
self.set_double_spin_box("doubleSpinBox_max", self._minmax[1])
|
||||
self._values = self._ensemble.params
|
||||
if len(self._values) > 0:
|
||||
self.set_double_spin_box("doubleSpinBox_0", self._values[0])
|
||||
self.set_double_spin_box("doubleSpinBox_1", self._values[1])
|
||||
|
||||
@property
|
||||
def minmax(self):
|
||||
return self._minmax
|
||||
def values(self):
|
||||
return self._values
|
||||
|
||||
def accept(self):
|
||||
self._minmax = [
|
||||
self.get_double_spin_box("doubleSpinBox_min"),
|
||||
self.get_double_spin_box("doubleSpinBox_max")
|
||||
self._values = [
|
||||
self.get_double_spin_box("doubleSpinBox_0"),
|
||||
self.get_double_spin_box("doubleSpinBox_1")
|
||||
]
|
||||
super().accept()
|
||||
|
||||
|
||||
@@ -40,6 +40,12 @@ class CommonWordTranslate(PamhyrTranslate):
|
||||
self._dict["time"] = _translate("CommonWord", "Time")
|
||||
self._dict["date"] = _translate("CommonWord", "Date")
|
||||
|
||||
self._dict["low"] = _translate("CommonWord", "Low")
|
||||
self._dict["high"] = _translate("CommonWord", "High")
|
||||
|
||||
self._dict["loc"] = _translate("CommonWord", "Loc")
|
||||
self._dict["scale"] = _translate("CommonWord", "Scale")
|
||||
|
||||
self._dict["reach"] = _translate("CommonWord", "Reach")
|
||||
self._dict["reaches"] = _translate("CommonWord", "Reaches")
|
||||
self._dict["Select reach"] = _translate("CommonWord", "Select reach")
|
||||
|
||||
@@ -17,14 +17,14 @@
|
||||
<item row="0" column="0">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label">
|
||||
<widget class="QLabel" name="label_0">
|
||||
<property name="text">
|
||||
<string>Low:</string>
|
||||
<string>@param0</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_min">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_0">
|
||||
<property name="minimum">
|
||||
<double>-100000.000000000000000</double>
|
||||
</property>
|
||||
@@ -38,14 +38,14 @@
|
||||
<item row="0" column="1">
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<widget class="QLabel" name="label_1">
|
||||
<property name="text">
|
||||
<string>High:</string>
|
||||
<string>@param1</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_max">
|
||||
<widget class="QDoubleSpinBox" name="doubleSpinBox_1">
|
||||
<property name="minimum">
|
||||
<double>-100000.000000000000000</double>
|
||||
</property>
|
||||
Reference in new issue
Block a user