This commit is contained in:
Youcef AOUAD committed 2024-06-13 14:35:40 +02:00
1 parent f917dd9284
commit 716d0af96f
6 files changed
+50 -33

No files matched your search

+14 -13
View File
@@ -71,7 +71,6 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
def __init__(self, data=None, study=None, config=None, parent=None):
self._data = []
self._data.append(data)
print(self._data[0]._data)
trad = IcAdisTSTranslate()
name = (
@@ -131,8 +130,8 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
toolBar.addAction(action_add)
toolBar.addAction(action_delete)
table_spec = QTableView()
layout.addWidget(table_spec)
self.table_spec = QTableView()
layout.addWidget(self.table_spec)
self._delegate_reach = ComboBoxDelegate(
trad=self._trad,
@@ -150,7 +149,7 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
)
self._table_spec = InitialConditionTableModel(
table_view=table_spec,
table_view=self.table_spec,
table_headers=self._trad.get_dict("table_headers_spec"),
editable_headers=["name", "reach", "start_kp", "end_kp", "concentration", "eg", "em", "ed", "rate"],
delegates={
@@ -164,13 +163,13 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
river=self._study.river
)
table_spec.setModel(self._table_spec)
table_spec.setSelectionBehavior(QAbstractItemView.SelectRows)
table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
table_spec.setAlternatingRowColors(True)
self.table_spec.setModel(self._table_spec)
self.table_spec.setSelectionBehavior(QAbstractItemView.SelectRows)
self.table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
self.table_spec.setAlternatingRowColors(True)
selectionModel = table_spec.selectionModel()
index = table_spec.model().index(0, 0)
selectionModel = self.table_spec.selectionModel()
index = self.table_spec.model().index(0, 0)
selectionModel.select(
index,
@@ -178,10 +177,11 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
QItemSelectionModel.ClearAndSelect |
QItemSelectionModel.Select
)
table_spec.scrollTo(index)
self.table_spec.scrollTo(index)
def index_selected_row(self):
table = self.find(QTableView, f"tableView")
#table = self.find(QTableView, f"tableView")
table = self.table_spec
rows = table.selectionModel()\
.selectedRows()
@@ -191,7 +191,8 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
return rows[0].row()
def index_selected_rows(self):
table = self.find(QTableView, f"tableView")
#table = self.find(QTableView, f"tableView")
table = self.table_spec
return list(
# Delete duplicate
set(