View: BC: Use PamhyrTableModel.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-09-11 14:57:55 +02:00
1 parent c986674306
commit 650df2b56c
5 files changed
+63 -117

No files matched your search

+24 -14
View File
@@ -16,6 +16,8 @@
# -*- coding: utf-8 -*-
import logging
from tools import timer, trace
from View.ASubWindow import ASubMainWindow, AWidget
@@ -42,12 +44,15 @@ from View.Plot.MplCanvas import MplCanvas
from View.Plot.navigation_toolbar_2qt import PamHyrNavigationToolbar2QT
from View.BoundaryCondition.translate import long_types
from View.BoundaryCondition.Edit.translate import table_headers
from View.BoundaryCondition.Edit.UndoCommand import SetMetaDataCommand
from View.BoundaryCondition.Edit.Table import TableModel, ExTimeDelegate
from View.BoundaryCondition.Edit.Plot import Plot
_translate = QCoreApplication.translate
logger = logging.getLogger()
class WD50Sigma(AWidget):
d50Changed = pyqtSignal(float)
sigmaChanged = pyqtSignal(float)
@@ -141,23 +146,28 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
self._d50sigma.set_sigma(self._data.sigma)
def setup_table(self):
table = self.find(QTableView, "tableView")
self._table = TableModel(
headers = {}
for h in self._data.header:
headers[h] = table_headers[h]
self._delegate_time = ExTimeDelegate(
data = self._data,
undo = self._undo_stack,
mode = self._study.time_system
mode = self._study.time_system,
parent = self
)
if self._data.header[0] == "time":
self._delegate_time = ExTimeDelegate(
data = self._data,
mode = self._study.time_system,
parent = self
)
table.setItemDelegateForColumn(
0, self._delegate_time
)
table = self.find(QTableView, "tableView")
self._table = TableModel(
table_view = table,
table_headers = headers,
editable_headers = self._data.header,
delegates = {
"time": self._delegate_time,
},
data = self._data,
undo = self._undo_stack,
opt_data = self._study.time_system
)
table.setModel(self._table)
table.setSelectionBehavior(QAbstractItemView.SelectRows)