Commit e9879625 authored by Pierre-Antoine Rouby's avatar Pierre-Antoine Rouby
Browse files

BC: Edit: Add X and Y column name for not defined bc type.

Showing with 15 additions and 5 deletions
+15 -5
......@@ -13,7 +13,7 @@ class BoundaryCondition(object):
self._node = None
self._data = []
self._header = []
self._types = [int, float]
self._types = [float, float]
def __len__(self):
return len(self._data)
......
......@@ -10,7 +10,11 @@ class NotDefined(BoundaryCondition):
super(NotDefined, self).__init__(name=name)
self._type = "ND"
self._header = ["", ""]
self._header = ["x", "y"]
@property
def _default_0(self):
return 0.0
class PonctualContribution(BoundaryCondition):
def __init__(self, name:str = ""):
......@@ -18,6 +22,7 @@ class PonctualContribution(BoundaryCondition):
self._type = "PC"
self._header = ["time", "debit"]
self._types = [int, float]
@classmethod
def compatibility(cls):
......@@ -29,6 +34,7 @@ class TimeOverZ(BoundaryCondition):
self._type = "TZ"
self._header = ["time", "z"]
self._types = [int, float]
@classmethod
def compatibility(cls):
......@@ -40,6 +46,7 @@ class TimeOverDebit(BoundaryCondition):
self._type = "TD"
self._header = ["time", "debit"]
self._types = [int, float]
@classmethod
def compatibility(cls):
......
......@@ -51,7 +51,7 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
)
self._study = study
self._lst = self._study.river.boundary_condition
self._bcs = self._study.river.boundary_condition
self.setup_sc()
self.setup_table()
......@@ -154,7 +154,7 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
def add(self):
tab = self.current_tab()
rows = self.index_selected_rows()
if self._lst.len(tab) == 0 or len(rows) == 0:
if self._bcs.len(tab) == 0 or len(rows) == 0:
self._table[tab].add(0)
else:
self._table[tab].add(rows[0])
......@@ -196,10 +196,11 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
self._table[tab].redo()
def edit(self):
tab = self.current_tab()
rows = self.index_selected_rows()
for row in rows:
win = EditBoundaryConditionWindow(
data=self._lst[row],
data=self._bcs.get(tab, row),
parent=self
)
win.show()
......@@ -5,6 +5,8 @@ from PyQt5.QtCore import QCoreApplication
_translate = QCoreApplication.translate
table_headers = {
"x": _translate("BoundaryCondition", "X"),
"y": _translate("BoundaryCondition", "Y"),
"time": _translate("BoundaryCondition", "Time"),
"debit": _translate("BoundaryCondition", "Debit"),
"z": _translate("BoundaryCondition", "Z (m)")
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment