mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
INISPEC DEL
This commit is contained in:
1 parent
cd68bebf03
commit
f917dd9284
3 files changed
+34
-7
No files matched your search
@@ -30,7 +30,7 @@ from PyQt5.QtGui import (
|
||||
from PyQt5.QtCore import (
|
||||
Qt, QVariant, QAbstractTableModel,
|
||||
QCoreApplication, QModelIndex, pyqtSlot,
|
||||
QRect,
|
||||
QRect, QItemSelectionModel,
|
||||
)
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
@@ -92,8 +92,6 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
|
||||
self._ics_adists_lst = study.river.initial_conditions_adists
|
||||
|
||||
print("setup tables")
|
||||
|
||||
self.setup_table()
|
||||
|
||||
self.ui.setWindowTitle(self._title)
|
||||
@@ -151,8 +149,6 @@ 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"),
|
||||
@@ -173,6 +169,17 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
table_spec.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||
table_spec.setAlternatingRowColors(True)
|
||||
|
||||
selectionModel = table_spec.selectionModel()
|
||||
index = table_spec.model().index(0, 0)
|
||||
|
||||
selectionModel.select(
|
||||
index,
|
||||
QItemSelectionModel.Rows |
|
||||
QItemSelectionModel.ClearAndSelect |
|
||||
QItemSelectionModel.Select
|
||||
)
|
||||
table_spec.scrollTo(index)
|
||||
|
||||
def index_selected_row(self):
|
||||
table = self.find(QTableView, f"tableView")
|
||||
rows = table.selectionModel()\
|
||||
@@ -260,7 +267,6 @@ 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)
|
||||
@@ -268,7 +274,9 @@ class InitialConditionsAdisTSWindow(PamhyrWindow):
|
||||
self._table_spec.add(rows[0])
|
||||
|
||||
def delete(self):
|
||||
print("del")
|
||||
rows = self.index_selected_rows()
|
||||
if len(rows) == 0:
|
||||
print("len 0")
|
||||
return
|
||||
self._table_spec.delete(rows)
|
||||
Reference in new issue
Block a user