mirror of https://gitlab.com/pamhyr/pamhyr2
envelop optional
parent
5f043468ee
commit
b21b6be9ca
|
|
@ -42,6 +42,7 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
|
|||
self._available_values_y = self._trad.get_dict("values_y")
|
||||
|
||||
self.setup_radio_buttons()
|
||||
self.setup_envelop_box()
|
||||
self.setup_check_boxs()
|
||||
|
||||
self.value = None
|
||||
|
|
@ -61,6 +62,24 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
|
|||
self._radio[0][1].setChecked(True)
|
||||
layout.addStretch()
|
||||
|
||||
def setup_envelop_box(self):
|
||||
self._envelop = []
|
||||
layout = self.find(QVBoxLayout, "verticalLayout_x")
|
||||
self._envelop = QCheckBox(
|
||||
"envelop",
|
||||
parent=self
|
||||
)
|
||||
layout.addWidget(self._envelop)
|
||||
self._envelop.setChecked(True)
|
||||
for r in self._radio:
|
||||
r[1].clicked.connect(self.envelop_box_status)
|
||||
|
||||
def envelop_box_status(self):
|
||||
if self._radio[0][1].isChecked():
|
||||
self._envelop.setEnabled(True)
|
||||
else:
|
||||
self._envelop.setEnabled(False)
|
||||
|
||||
def setup_check_boxs(self):
|
||||
self._check = []
|
||||
layout = self.find(QVBoxLayout, "verticalLayout_y")
|
||||
|
|
@ -94,6 +113,6 @@ class CustomPlotValuesSelectionDialog(PamhyrDialog):
|
|||
)
|
||||
)
|
||||
|
||||
self.value = x, y
|
||||
self.value = x, y, self._envelop.isChecked()
|
||||
|
||||
super().accept()
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ unit = {
|
|||
|
||||
|
||||
class CustomPlot(PamhyrPlot):
|
||||
def __init__(self, x, y, reach, profile, timestamp,
|
||||
def __init__(self, x, y, envelop, reach, profile, timestamp,
|
||||
data=None, canvas=None, trad=None,
|
||||
toolbar=None, parent=None):
|
||||
super(CustomPlot, self).__init__(
|
||||
|
|
@ -59,6 +59,7 @@ class CustomPlot(PamhyrPlot):
|
|||
|
||||
self._x = x
|
||||
self._y = y
|
||||
self._envelop = envelop
|
||||
self._reach = reach
|
||||
self._profile = profile
|
||||
self._timestamp = timestamp
|
||||
|
|
@ -134,7 +135,7 @@ class CustomPlot(PamhyrPlot):
|
|||
color='blue', alpha=0.5, interpolate=True
|
||||
)
|
||||
|
||||
#if "water_elevation_envelop" in self._y:
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["water_elevation_envelop"]]
|
||||
|
||||
|
|
@ -175,7 +176,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
self.lines["discharge"] = line
|
||||
|
||||
#if "discharge_envelop" in self._y:
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["discharge_envelop"]]
|
||||
|
||||
|
|
@ -223,7 +224,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
self.lines["velocity"] = line
|
||||
|
||||
#if "velocity_envelop" in self._y:
|
||||
if self._envelop:
|
||||
|
||||
velocities = list(map(lambda p:
|
||||
list(map(lambda q, z:
|
||||
|
|
@ -267,7 +268,7 @@ class CustomPlot(PamhyrPlot):
|
|||
)
|
||||
self.lines["depth"] = line
|
||||
|
||||
#if "depth_envelop" in self._y:
|
||||
if self._envelop:
|
||||
|
||||
ax = self._axes[unit["depth_envelop"]]
|
||||
|
||||
|
|
|
|||
|
|
@ -490,11 +490,13 @@ class ResultsWindow(PamhyrWindow):
|
|||
def _add_custom_plot(self):
|
||||
dlg = CustomPlotValuesSelectionDialog(parent=self)
|
||||
if dlg.exec():
|
||||
x, y = dlg.value
|
||||
self.create_new_tab_custom_plot(x, y)
|
||||
x, y, envelop = dlg.value
|
||||
self.create_new_tab_custom_plot(x, y, envelop)
|
||||
|
||||
def create_new_tab_custom_plot(self, x: str, y: list):
|
||||
def create_new_tab_custom_plot(self, x: str, y: list, envelop: bool):
|
||||
name = f"{x}: {','.join(y)}"
|
||||
if envelop and x == "rk":
|
||||
name += "_envelop"
|
||||
wname = f"tab_custom_{x}_{y}"
|
||||
|
||||
tab_widget = self.find(QTabWidget, f"tabWidget")
|
||||
|
|
@ -518,7 +520,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
)
|
||||
|
||||
plot = CustomPlot(
|
||||
x, y,
|
||||
x, y, envelop,
|
||||
self._get_current_reach(),
|
||||
self._get_current_profile(),
|
||||
self._get_current_timestamp(),
|
||||
|
|
@ -589,7 +591,7 @@ class ResultsWindow(PamhyrWindow):
|
|||
|
||||
dlg = CustomPlotValuesSelectionDialog(parent=self)
|
||||
if dlg.exec():
|
||||
x, y = dlg.value
|
||||
x, y, = dlg.value
|
||||
else:
|
||||
return
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue