mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
INI SPEC Table
This commit is contained in:
1 parent
35cc348f03
commit
cd68bebf03
4 files changed
+146
-22
No files matched your search
@@ -71,6 +71,7 @@ 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 = (
|
||||
@@ -91,7 +92,10 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
|
||||
self._ics_adists_lst = study.river.initial_conditions_adists
|
||||
|
||||
print("setup tables")
|
||||
|
||||
self.setup_table()
|
||||
|
||||
self.ui.setWindowTitle(self._title)
|
||||
|
||||
def setup_table(self):
|
||||
@@ -121,8 +125,10 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
|
||||
action_add = QAction(self)
|
||||
action_add.setIcon(QIcon(os.path.join(path_icons, f"add.png")))
|
||||
action_add.triggered.connect(self.add)
|
||||
action_delete = QAction(self)
|
||||
action_delete.setIcon(QIcon(os.path.join(path_icons, f"del.png")))
|
||||
action_delete.triggered.connect(self.delete)
|
||||
|
||||
toolBar.addAction(action_add)
|
||||
toolBar.addAction(action_delete)
|
||||
@@ -145,6 +151,8 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
mode="kp"
|
||||
)
|
||||
|
||||
print("hello table", self._study.river)
|
||||
|
||||
self._table_spec = InitialConditionTableModel(
|
||||
table_view=table_spec,
|
||||
table_headers=self._trad.get_dict("table_headers_spec"),
|
||||
@@ -156,7 +164,8 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
},
|
||||
data=self._data[0],
|
||||
undo=self._undo_stack,
|
||||
trad=self._trad
|
||||
trad=self._trad,
|
||||
river=self._study.river
|
||||
)
|
||||
|
||||
table_spec.setModel(self._table_spec)
|
||||
@@ -164,10 +173,6 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
table_spec.setAlternatingRowColors(True)
|
||||
|
||||
def setup_connections(self):
|
||||
self.find(QAction, "action_add").triggered.connect(self.add)
|
||||
self.find(QAction, "action_delete").triggered.connect(self.delete)
|
||||
|
||||
def index_selected_row(self):
|
||||
table = self.find(QTableView, f"tableView")
|
||||
rows = table.selectionModel()\
|
||||
@@ -255,6 +260,7 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
self._update()
|
||||
|
||||
def add(self):
|
||||
print("Hello")
|
||||
rows = self.index_selected_rows()
|
||||
if len(self._data[0]._data) == 0 or len(rows) == 0:
|
||||
self._table_spec.add(0)
|
||||
|
||||
Reference in new issue
Block a user