Ensemble: Results: Fix runs table.

scenario-dev-pa
Pierre-Antoine 2026-09-04 10:31:04 +02:00
parent ef36eba039
commit 2498466a51
4 changed files with 40 additions and 6 deletions

View File

@ -331,7 +331,7 @@ class TableData(SQLSubModel):
if isinstance(key, tuple):
return self._data[key[0], key[1]]
self._date[key]
self._data[key]
class Results(SQLSubModel):

View File

@ -62,7 +62,7 @@ class TableModel(PamhyrTableModel):
elif self._opt_data == "solver":
self._lst = self._parent._solvers
elif self._opt_data == "runs":
self._lst = self._data[0].get("table")["sample"]
self._lst = self._data[0].get("table")["samples"]
def __init__(self, **kwargs):
self._timestamp = max(kwargs["parent"]._timestamps)
@ -97,6 +97,7 @@ class TableModel(PamhyrTableModel):
return str(v)
elif self._opt_data == "runs":
if self._headers[column] == "runs":
p = self._lst[row,:]
return f"{row}: {p}"
elif self._opt_data == "raw_data":
table = self._data[0].get("table")

View File

@ -1462,10 +1462,6 @@ class ResultsEnsembleWindow(ResultsWindow):
self._slider_time.value()
]
if len(self._results) <= 1:
table = self.find(QTableView, f"tableView_solver")
table.hide()
def setup_plots(self):
self.canvas = MplCanvas(width=5, height=4, dpi=100)
@ -1648,3 +1644,35 @@ class ResultsEnsembleWindow(ResultsWindow):
self.plot_h.update_all()
elif tab_index > 2:
self._additional_plot[name].update_all()
def update_table_selection_reach(self, ind):
table = self.find(QTableView, f"tableView_reach")
selectionModel = table.selectionModel()
index = table.model().index(ind, 0)
selectionModel.select(
index,
QItemSelectionModel.Rows |
QItemSelectionModel.ClearAndSelect |
QItemSelectionModel.Select
)
table.scrollTo(index)
self._table["profile"].update(ind)
def update_table_selection_profile(self, ind):
for t in ["profile"]:
table = self.find(QTableView, f"tableView_{t}")
selectionModel = table.selectionModel()
index = table.model().index(ind, 0)
selectionModel.select(
index,
QItemSelectionModel.Rows |
QItemSelectionModel.ClearAndSelect |
QItemSelectionModel.Select
)
table.scrollTo(index)
def update_table_selection_solver(self, ind):
return

View File

@ -44,6 +44,7 @@ class ResultsTranslate(MainTranslate):
self._dict['envelop'] = _translate("Results", "Envelop")
self._dict['solver'] = _translate("Results", "Solver")
self._dict['runs'] = _translate("Results", "Runs")
self._dict['x'] = _translate("Results", "X (m)")
@ -81,6 +82,10 @@ class ResultsTranslate(MainTranslate):
"solver": self._dict['solver'],
}
self._sub_dict["table_headers_runs"] = {
"runs": self._dict['runs'],
}
self._sub_dict["table_headers_pollutants"] = {
"name": _translate("Results", "Pollutant name"),
}