diff --git a/src/Model/BoundaryConditionsAdisTS/BoundaryConditionAdisTS.py b/src/Model/BoundaryConditionsAdisTS/BoundaryConditionAdisTS.py
index 4176350c..68a91ae7 100644
--- a/src/Model/BoundaryConditionsAdisTS/BoundaryConditionAdisTS.py
+++ b/src/Model/BoundaryConditionsAdisTS/BoundaryConditionAdisTS.py
@@ -105,7 +105,7 @@ class BoundaryConditionAdisTS(SQLSubModel):
bc.node = None
if row[3] != -1:
- bc.node = next(filter(lambda n: n.id == row[3], data["nodes"]))
+ bc.node = next(filter(lambda n: n.id == row[3], data["nodes"])).id
values = execute(
"SELECT data0, data1 FROM boundary_condition_data_adists " +
@@ -114,8 +114,8 @@ class BoundaryConditionAdisTS(SQLSubModel):
# Write data
for v in values:
- data0 = bc._types[0](v[1])
- data1 = bc._types[1](v[2])
+ data0 = bc._types[0](v[0])
+ data1 = bc._types[1](v[1])
# Replace data at pos ind
bc._data.append((data0, data1))
@@ -124,20 +124,19 @@ class BoundaryConditionAdisTS(SQLSubModel):
return new
def _db_save(self, execute, data=None):
- pollutant_id = data["pollutant_id"]
execute(f"DELETE FROM boundary_condition_adists WHERE id = {self.id}")
execute(f"DELETE FROM boundary_condition_data_adists WHERE bc = {self.id}")
node = -1
if self._node is not None:
- node = self._node.id
+ node = self._node
sql = (
"INSERT INTO " +
"boundary_condition_adists(id, pollutant, type, node) " +
"VALUES (" +
- f"{self.id}, {pollutant_id}, " +
+ f"{self.id}, {self._pollutant}, " +
f"'{self._db_format(self._type)}', {node}" +
")"
)
@@ -188,6 +187,11 @@ class BoundaryConditionAdisTS(SQLSubModel):
def header(self):
return self._header.copy()
+ @header.setter
+ def header(self, header):
+ self._header = header
+ self._status.modified()
+
@property
def pollutant(self):
return self._pollutant
diff --git a/src/Model/BoundaryConditionsAdisTS/BoundaryConditionsAdisTSList.py b/src/Model/BoundaryConditionsAdisTS/BoundaryConditionsAdisTSList.py
index 4246905f..613b70e6 100644
--- a/src/Model/BoundaryConditionsAdisTS/BoundaryConditionsAdisTSList.py
+++ b/src/Model/BoundaryConditionsAdisTS/BoundaryConditionsAdisTSList.py
@@ -44,6 +44,7 @@ class BoundaryConditionsAdisTSList(PamhyrModelList):
def _db_save(self, execute, data=None):
execute("DELETE FROM boundary_condition_adists")
+ execute("DELETE FROM boundary_condition_data_adists")
if data is None:
data = {}
diff --git a/src/View/BoundaryConditionsAdisTS/Edit/Plot.py b/src/View/BoundaryConditionsAdisTS/Edit/Plot.py
index 5405a501..8ecc288d 100644
--- a/src/View/BoundaryConditionsAdisTS/Edit/Plot.py
+++ b/src/View/BoundaryConditionsAdisTS/Edit/Plot.py
@@ -47,6 +47,7 @@ class Plot(PamhyrPlot):
self._table_headers = self._trad.get_dict("table_headers")
header = self.data.header
+
self.label_x = self._table_headers[header[0]]
self.label_y = self._table_headers[header[1]]
diff --git a/src/View/BoundaryConditionsAdisTS/Edit/Table.py b/src/View/BoundaryConditionsAdisTS/Edit/Table.py
index 287a8fe4..729f8420 100644
--- a/src/View/BoundaryConditionsAdisTS/Edit/Table.py
+++ b/src/View/BoundaryConditionsAdisTS/Edit/Table.py
@@ -40,14 +40,8 @@ from PyQt5.QtWidgets import (
QTimeEdit, QDateTimeEdit, QItemDelegate,
)
-from Model.BoundaryCondition.BoundaryConditionTypes import (
- NotDefined, PonctualContribution,
- TimeOverZ, TimeOverDischarge, ZOverDischarge
-)
-
-from View.BoundaryCondition.Edit.UndoCommand import (
- SetDataCommand, AddCommand, DelCommand,
- SortCommand, MoveCommand, PasteCommand,
+from View.BoundaryConditionsAdisTS.Edit.UndoCommand import (
+ AddCommand, DelCommand, SetDataCommand,
)
_translate = QCoreApplication.translate
@@ -69,8 +63,8 @@ class TableModel(PamhyrTableModel):
value = QVariant()
if 0 <= column < 2:
- v = self._data.get_i(row)[column]
- if self._data.get_type_column(column) == float:
+ v = self._data._data[row][column]
+ if self._data._types[column] == float:
value = f"{v:.4f}"
elif self._data.header[column] == "time":
if self._opt_data == "time":
@@ -125,69 +119,3 @@ class TableModel(PamhyrTableModel):
self.endRemoveRows()
- def sort(self, _reverse, parent=QModelIndex()):
- self.layoutAboutToBeChanged.emit()
-
- self._undo.push(
- SortCommand(
- self._data, _reverse
- )
- )
-
- self.layoutAboutToBeChanged.emit()
- self.layoutChanged.emit()
-
- def move_up(self, row, parent=QModelIndex()):
- if row <= 0:
- return
-
- target = row + 2
-
- self.beginMoveRows(parent, row - 1, row - 1, parent, target)
-
- self._undo_stack.push(
- MoveCommand(
- self._data, "up", row
- )
- )
-
- self.endMoveRows()
- self.layoutChanged.emit()
-
- def move_down(self, index, parent=QModelIndex()):
- if row > len(self._data):
- return
-
- target = row
-
- self.beginMoveRows(parent, row + 1, row + 1, parent, target)
-
- self._undo_stack.push(
- MoveCommand(
- self._data, "down", row
- )
- )
-
- self.endMoveRows()
- self.layoutChanged.emit()
-
- def paste(self, row, header, data):
- if len(data) == 0:
- return
-
- self.layoutAboutToBeChanged.emit()
-
- self._undo.push(
- PasteCommand(
- self._data, row,
- list(
- map(
- lambda d: self._data.new_from_data(header, d),
- data
- )
- )
- )
- )
-
- self.layoutAboutToBeChanged.emit()
- self.layoutChanged.emit()
diff --git a/src/View/BoundaryConditionsAdisTS/Edit/UndoCommand.py b/src/View/BoundaryConditionsAdisTS/Edit/UndoCommand.py
index 02e0a48e..dbca067e 100644
--- a/src/View/BoundaryConditionsAdisTS/Edit/UndoCommand.py
+++ b/src/View/BoundaryConditionsAdisTS/Edit/UndoCommand.py
@@ -25,7 +25,7 @@ from PyQt5.QtWidgets import (
QMessageBox, QUndoCommand, QUndoStack,
)
-from Model.BoundaryCondition.BoundaryCondition import BoundaryCondition
+from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
logger = logging.getLogger()
@@ -37,42 +37,21 @@ class SetDataCommand(QUndoCommand):
self._data = data
self._index = index
self._column = column
- self._old = self._data.get_i(self._index)[self._column]
- _type = self._data.get_type_column(self._column)
+ self._old = self._data._data[self._index][self._column]
+ _type = self._data._types[self._column]
self._new = _type(new_value)
def undo(self):
- self._data._set_i_c_v(self._index, self._column, self._old)
+ if self._column == 0:
+ self._data._data[self._index] = (self._old,self._data._data[self._index][1])
+ else:
+ self._data._data[self._index] = (self._data._data[self._index][1], self._old)
def redo(self):
- self._data._set_i_c_v(self._index, self._column, self._new)
-
-
-class SetMetaDataCommand(QUndoCommand):
- def __init__(self, data, column, new_value):
- QUndoCommand.__init__(self)
-
- self._data = data
- self._column = column
- if self._column == "d50":
- self._old = self._data.d50
- elif self._column == "sigma":
- self._old = self._data.sigma
-
- self._new = float(new_value)
-
- def undo(self):
- if self._column == "d50":
- self._data.d50 = self._old
- elif self._column == "sigma":
- self._data.sigma = self._old
-
- def redo(self):
- if self._column == "d50":
- self._data.d50 = self._new
- elif self._column == "sigma":
- self._data.sigma = self._new
-
+ if self._column == 0:
+ self._data._data[self._index] = (self._new,self._data._data[self._index][1])
+ else:
+ self._data._data[self._index] = (self._data._data[self._index][1], self._new)
class AddCommand(QUndoCommand):
def __init__(self, data, index):
@@ -83,14 +62,13 @@ class AddCommand(QUndoCommand):
self._new = None
def undo(self):
- self._data.delete_i([self._index])
+ del self._data._data[self._index]
def redo(self):
if self._new is None:
- self._new = self._data.add(self._index)
+ self._new = self._data._data.insert(self._index, (self._data._types[0](0), self._data._types[1](0.0)))
else:
- self._data.insert(self._index, self._new)
-
+ self._data._data.insert(self._index, self._new)
class DelCommand(QUndoCommand):
def __init__(self, data, rows):
@@ -101,7 +79,7 @@ class DelCommand(QUndoCommand):
self._bc = []
for row in rows:
- self._bc.append((row, self._data.get_i(row)))
+ self._bc.append((row, self._data._data[row]))
self._bc.sort()
def undo(self):
@@ -109,75 +87,9 @@ class DelCommand(QUndoCommand):
self._data.insert(row, el)
def redo(self):
- self._data.delete_i(self._rows)
+ for row in self._rows:
+ del self._data._data[row]
-class SortCommand(QUndoCommand):
- def __init__(self, data, _reverse):
- QUndoCommand.__init__(self)
-
- self._data = data
- self._reverse = _reverse
-
- self._old = self._data.data
- self._indexes = None
-
- def undo(self):
- ll = self._data.data
- self._data.sort(
- key=lambda x: self._indexes[ll.index(x)]
- )
-
- def redo(self):
- self._data.sort(
- _reverse=self._reverse,
- key=lambda x: x[0]
- )
- if self._indexes is None:
- self._indexes = list(
- map(
- lambda p: self._old.index(p),
- self._data.data
- )
- )
- self._old = None
-class MoveCommand(QUndoCommand):
- def __init__(self, data, up, i):
- QUndoCommand.__init__(self)
-
- self._data = data
- self._up = up == "up"
- self._i = i
-
- def undo(self):
- if self._up:
- self._data.move_up(self._i)
- else:
- self._data.move_down(self._i)
-
- def redo(self):
- if self._up:
- self._data.move_up(self._i)
- else:
- self._data.move_down(self._i)
-
-
-class PasteCommand(QUndoCommand):
- def __init__(self, data, row, bcs):
- QUndoCommand.__init__(self)
-
- self._data = data
- self._row = row
- self._bcs = bcs
- self._bcs.reverse()
-
- def undo(self):
- self._data.delete_i(
- range(self._row, self._row + len(self._bcs))
- )
-
- def redo(self):
- for bc in self._bcs:
- self._data.insert(self._row, bc)
diff --git a/src/View/BoundaryConditionsAdisTS/Edit/Window.py b/src/View/BoundaryConditionsAdisTS/Edit/Window.py
index faf41896..43223b84 100644
--- a/src/View/BoundaryConditionsAdisTS/Edit/Window.py
+++ b/src/View/BoundaryConditionsAdisTS/Edit/Window.py
@@ -1,4 +1,4 @@
-# Window.py -- Pamhyr
+ # Window.py -- Pamhyr
# Copyright (C) 2023-2024 INRAE
#
# This program is free software: you can redistribute it and/or modify
@@ -44,76 +44,23 @@ from PyQt5.QtWidgets import (
from View.Tools.Plot.PamhyrCanvas import MplCanvas
from View.Tools.Plot.PamhyrToolbar import PamhyrPlotToolbar
-from View.BoundaryCondition.Edit.translate import BCETranslate
-from View.BoundaryCondition.Edit.UndoCommand import SetMetaDataCommand
-from View.BoundaryCondition.Edit.Table import TableModel
-from View.BoundaryCondition.Edit.Plot import Plot
+from View.BoundaryConditionsAdisTS.Edit.translate import BCETranslate
+from View.BoundaryConditionsAdisTS.Edit.Table import TableModel
+from View.BoundaryConditionsAdisTS.Edit.Plot import Plot
_translate = QCoreApplication.translate
logger = logging.getLogger()
-
-class WD50Sigma(PamhyrWidget):
- _pamhyr_ui = "d50sigma"
-
- d50Changed = pyqtSignal(float)
- sigmaChanged = pyqtSignal(float)
-
- def __init__(self, parent=None):
- super(WD50Sigma, self).__init__(
- parent=parent
- )
-
- self.spinBox_d50 = self.find(QDoubleSpinBox, "doubleSpinBox_d50")
- self.spinBox_sigma = self.find(QDoubleSpinBox, "doubleSpinBox_sigma")
-
- self.spinBox_d50.valueChanged.connect(self.valueChangedD50)
- self.spinBox_sigma.valueChanged.connect(self.valueChangedSigma)
-
- def set_d50(self, d50):
- self.spinBox_d50.valueChanged.disconnect(self.valueChangedD50)
- self.spinBox_d50.setValue(float(d50))
- self.spinBox_d50.valueChanged.connect(self.valueChangedD50)
-
- def get_d50(self):
- return float(self.spinBox_d50.value())
-
- def set_sigma(self, sigma):
- self.spinBox_sigma.valueChanged.disconnect(self.valueChangedSigma)
- self.spinBox_sigma.setValue(float(sigma))
- self.spinBox_sigma.valueChanged.connect(self.valueChangedSigma)
-
- def get_sigma(self):
- return float(self.spinBox_sigma.value())
-
- @QtCore.pyqtSlot(float)
- def valueChangedD50(self, value):
- self.d50Changed.emit(value)
-
- @QtCore.pyqtSlot(float)
- def valueChangedSigma(self, value):
- self.sigmaChanged.emit(value)
-
-
class EditBoundaryConditionWindow(PamhyrWindow):
- _pamhyr_ui = "EditBoundaryConditions"
- _pamhyr_name = "Edit Boundary Conditions"
+ _pamhyr_ui = "EditBoundaryConditionsAdisTS"
+ _pamhyr_name = "Edit Boundary Conditions AdisTS"
def __init__(self, data=None, study=None, config=None, parent=None):
self._data = data
trad = BCETranslate()
- self._long_types = trad.get_dict("long_types")
name = trad[self._pamhyr_name]
- if self._data is not None:
- node_name = (self._data.node.name if self._data.node is not None
- else trad['not_associated'])
- name += (
- f" - {study.name} " +
- f" - {self._data.name} ({self._data.id}) " +
- f"({self._long_types[self._data.bctype]} - {node_name})"
- )
super(EditBoundaryConditionWindow, self).__init__(
title=name,
@@ -123,25 +70,26 @@ class EditBoundaryConditionWindow(PamhyrWindow):
parent=parent
)
+ if self._data is not None:
+ n = self._data.node
+ node_name = next(filter(lambda x: x.id == n, self._study.river._nodes)).name
+ name += (
+ f" - {study.name} " +
+ f"({node_name})"
+ )
+
self._hash_data.append(data)
self.setup_table()
self.setup_plot()
- self.setup_data()
self.setup_connections()
- def setup_data(self):
- self._is_solid = self._data.bctype == "SL"
-
- if self._is_solid:
- layout = self.find(QVBoxLayout, "verticalLayout_table")
- self._d50sigma = WD50Sigma(parent=self)
- layout.addWidget(self._d50sigma)
-
- self._d50sigma.set_d50(self._data.d50)
- self._d50sigma.set_sigma(self._data.sigma)
-
def setup_table(self):
+ if self._data.type == "Concentration":
+ self._data.header = ["time", "concentration"]
+ else:
+ self._data.header = ["time", "rate"]
+
headers = {}
table_headers = self._trad.get_dict("table_headers")
for h in self._data.header:
@@ -192,35 +140,9 @@ class EditBoundaryConditionWindow(PamhyrWindow):
def setup_connections(self):
self.find(QAction, "action_add").triggered.connect(self.add)
self.find(QAction, "action_del").triggered.connect(self.delete)
- self.find(QAction, "action_sort").triggered.connect(self.sort)
self._table.dataChanged.connect(self.update)
- if self._is_solid:
- self._d50sigma.d50Changed.connect(self.d50_changed)
- self._d50sigma.sigmaChanged.connect(self.sigma_changed)
-
- def d50_changed(self, value):
- self._undo_stack.push(
- SetMetaDataCommand(
- self._data,
- "d50", value
- )
- )
-
- def sigma_changed(self, value):
- self._undo_stack.push(
- SetMetaDataCommand(
- self._data,
- "sigma", value
- )
- )
-
- def widget_update(self):
- if self._is_solid:
- self._d50sigma.set_d50(self._data.d50)
- self._d50sigma.set_sigma(self._data.sigma)
-
def update(self):
self.plot.update()
@@ -263,16 +185,6 @@ class EditBoundaryConditionWindow(PamhyrWindow):
self._table.sort(False)
self.plot.update()
- def move_up(self):
- row = self.index_selected_row()
- self._table.move_up(row)
- self.plot.update()
-
- def move_down(self):
- row = self.index_selected_row()
- self._table.move_down(row)
- self.plot.update()
-
def _copy(self):
rows = self.index_selected_rows()
@@ -285,28 +197,10 @@ class EditBoundaryConditionWindow(PamhyrWindow):
self.copyTableIntoClipboard(table)
- def _paste(self):
- header, data = self.parseClipboardTable()
-
- logger.debug(f"paste: h:{header}, d:{data}")
-
- if len(data) == 0:
- return
-
- row = 0
- rows = self.index_selected_rows()
- if len(rows) != 0:
- row = rows[0]
-
- self._table.paste(row, header, data)
- self.plot.update()
-
def _undo(self):
self._table.undo()
self.plot.update()
- self.widget_update()
def _redo(self):
self._table.redo()
self.plot.update()
- self.widget_update()
diff --git a/src/View/BoundaryConditionsAdisTS/Edit/translate.py b/src/View/BoundaryConditionsAdisTS/Edit/translate.py
index 9d835550..0375adbb 100644
--- a/src/View/BoundaryConditionsAdisTS/Edit/translate.py
+++ b/src/View/BoundaryConditionsAdisTS/Edit/translate.py
@@ -29,16 +29,13 @@ class BCETranslate(BCTranslate):
def __init__(self):
super(BCETranslate, self).__init__()
- self._dict["Edit Boundary Conditions"] = _translate(
- "BoundaryCondition", "Edit boundary conditions"
+ self._dict["Edit Boundary Conditions AdisTS"] = _translate(
+ "BoundaryConditionAdisTS", "Edit boundary conditions AdisTS"
)
self._sub_dict["table_headers"] = {
- "x": _translate("BoundaryCondition", "X"),
- "y": _translate("BoundaryCondition", "Y"),
"time": self._dict["time"],
"date": self._dict["date"],
- "discharge": self._dict["unit_discharge"],
- "z": self._dict["unit_elevation"],
- "solid": _translate("BoundaryCondition", "Solid (kg/s)"),
+ "rate": _translate("BoundaryConditionAdisTS", "Rate"),
+ "concentration": _translate("BoundaryConditionAdisTS", "Concentration"),
}
diff --git a/src/View/BoundaryConditionsAdisTS/Table.py b/src/View/BoundaryConditionsAdisTS/Table.py
index d2b08caf..4a71d3cf 100644
--- a/src/View/BoundaryConditionsAdisTS/Table.py
+++ b/src/View/BoundaryConditionsAdisTS/Table.py
@@ -43,8 +43,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel
from View.BoundaryConditionsAdisTS.UndoCommand import (
SetNodeCommand, SetTypeCommand,
- AddCommand, DelCommand, SortCommand,
- MoveCommand, PasteCommand,
+ AddCommand, DelCommand,
)
from View.BoundaryCondition.translate import BC_types
@@ -111,7 +110,6 @@ class TableModel(PamhyrTableModel):
self._trad = trad
self._bc_list = bc_list
self._pollutant = pollutant
- print("pollutant : ", self._pollutant)
super(TableModel, self).__init__(trad=trad, **kwargs)
@@ -135,17 +133,15 @@ class TableModel(PamhyrTableModel):
column = index.column()
if self._headers[column] == "type":
- #n = self._lst[row].type
n = data[row].type
if n is None or n == "":
return self._trad["not_associated"]
return n
elif self._headers[column] == "node":
- #n = self._lst[row].node
n = data[row].node
if n is None:
return self._trad["not_associated"]
- return n
+ return next(filter(lambda x: x.id == n, self._data._nodes)).name
return QVariant()
@@ -169,6 +165,7 @@ class TableModel(PamhyrTableModel):
self._lst, row, self._data.node(value)
)
)
+ print(value, self._data.node(value).id)
except Exception as e:
logger.info(e)
logger.debug(traceback.format_exc())
diff --git a/src/View/BoundaryConditionsAdisTS/UndoCommand.py b/src/View/BoundaryConditionsAdisTS/UndoCommand.py
index 98fff994..dd39d42a 100644
--- a/src/View/BoundaryConditionsAdisTS/UndoCommand.py
+++ b/src/View/BoundaryConditionsAdisTS/UndoCommand.py
@@ -56,7 +56,6 @@ class SetTypeCommand(QUndoCommand):
def redo(self):
self._bcs[self._index].type = self._new
- print("type : ", self._old, self._new, self._bcs[self._index].type)
class AddCommand(QUndoCommand):
def __init__(self, pollutant, bcs_list, bcs, index):
@@ -74,106 +73,27 @@ class AddCommand(QUndoCommand):
def redo(self):
if self._new is None:
self._new = self._bc_list.new(self._index, self._pollutant)
- print(self._new.pollutant)
- print(len(self._bc_list))
- print(len(self._bcs))
else:
self._bcs.insert(self._index, self._new)
class DelCommand(QUndoCommand):
- def __init__(self, bcs, tab, rows):
+ def __init__(self, bcs, rows):
QUndoCommand.__init__(self)
self._bcs = bcs
- self._tab = tab
self._rows = rows
self._bc = []
for row in rows:
- self._bc.append((row, self._bcs.get(self._tab, row)))
+ self._bc.append((row, self._bcs[row]))
self._bc.sort()
def undo(self):
for row, el in self._bc:
- self._bcs.insert(self._tab, row, el)
+ self._bcs.insert(row, el)
def redo(self):
- self._bcs.delete_i(self._tab, self._rows)
+ for row in self._rows:
+ del self._bcs[row]
-
-class SortCommand(QUndoCommand):
- def __init__(self, bcs, tab, _reverse):
- QUndoCommand.__init__(self)
-
- self._bcs = bcs
- self._tab = tab
- self._reverse = _reverse
-
- self._old = self._bcs.get_tab(self._tab)
- self._indexes = None
-
- def undo(self):
- ll = self._bcs.get_tab(self._tab)
- self._bcs.sort(
- self._tab,
- key=lambda x: self._indexes[ll.index(x)]
- )
-
- def redo(self):
- self._bcs.sort(
- self._tab,
- reverse=self._reverse,
- key=lambda x: x.name
- )
- if self._indexes is None:
- self._indexes = list(
- map(
- lambda p: self._old.index(p),
- self._bcs.get_tab(self._tab)
- )
- )
- self._old = None
-
-
-class MoveCommand(QUndoCommand):
- def __init__(self, bcs, tab, up, i):
- QUndoCommand.__init__(self)
-
- self._bcs = bcs
- self._tab = tab
- self._up = up == "up"
- self._i = i
-
- def undo(self):
- if self._up:
- self._bcs.move_up(self._tab, self._i)
- else:
- self._bcs.move_down(self._tab, self._i)
-
- def redo(self):
- if self._up:
- self._bcs.move_up(self._tab, self._i)
- else:
- self._bcs.move_down(self._tab, self._i)
-
-
-class PasteCommand(QUndoCommand):
- def __init__(self, bcs, tab, row, bc):
- QUndoCommand.__init__(self)
-
- self._bcs = bcs
- self._tab = tab
- self._row = row
- self._bc = deepcopy(bc)
- self._bc.reverse()
-
- def undo(self):
- self._bcs.delete_i(
- self._tab,
- range(self._row, self._row + len(self._bc))
- )
-
- def redo(self):
- for bc in self._bc:
- self._bcs.insert(self._tab, self._row, bc)
diff --git a/src/View/BoundaryConditionsAdisTS/Window.py b/src/View/BoundaryConditionsAdisTS/Window.py
index 8b825080..e055c58b 100644
--- a/src/View/BoundaryConditionsAdisTS/Window.py
+++ b/src/View/BoundaryConditionsAdisTS/Window.py
@@ -40,17 +40,6 @@ from PyQt5.QtWidgets import (
QWidget,
)
-from Model.BoundaryCondition.BoundaryConditionTypes import (
- NotDefined, PonctualContribution,
- TimeOverZ, TimeOverDischarge, ZOverDischarge
-)
-
-from View.BoundaryCondition.UndoCommand import (
- SetNameCommand, SetNodeCommand, SetTypeCommand,
- AddCommand, DelCommand, SortCommand,
- MoveCommand, PasteCommand,
-)
-
from View.BoundaryConditionsAdisTS.Table import (
TableModel, ComboBoxDelegate
)
@@ -119,7 +108,8 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
trad=self._trad,
bc_list = self._study.river.boundary_conditions_adists,
undo=self._undo_stack,
- pollutant=self._pollutant
+ pollutant=self._pollutant,
+ data=self._study.river
)
table.setModel(self._table)
table.setSelectionBehavior(QAbstractItemView.SelectRows)
@@ -140,7 +130,6 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
self.find(QAction, "action_add").triggered.connect(self.add)
self.find(QAction, "action_del").triggered.connect(self.delete)
self.find(QAction, "action_edit").triggered.connect(self.edit)
- self.find(QAction, "action_sort").triggered.connect(self.sort)
def index_selected_row(self):
tab = "liquid"
@@ -169,27 +158,12 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
self._table.add(rows[0])
def delete(self):
- tab = "liquid"
rows = self.index_selected_rows()
if len(rows) == 0:
return
self._table.delete(rows)
- def sort(self):
- tab = "liquid"
- self._table.sort(False)
-
- def move_up(self):
- tab = "liquid"
- row = self.index_selected_row()
- self._table.move_up(row)
-
- def move_down(self):
- tab = "liquid"
- row = self.index_selected_row()
- self._table.move_down(row)
-
def _copy(self):
logger.info("TODO: copy")
@@ -197,18 +171,15 @@ class BoundaryConditionAdisTSWindow(PamhyrWindow):
logger.info("TODO: paste")
def _undo(self):
- tab = "liquid"
self._table.undo()
def _redo(self):
- tab = "liquid"
self._table.redo()
def edit(self):
- tab = "liquid"
rows = self.index_selected_rows()
for row in rows:
- data = self._bcs.get(tab, row)
+ data = self._bcs.lst[row]
if self.sub_window_exists(
EditBoundaryConditionWindow,
diff --git a/src/View/ui/BoundaryConditionsAdisTS.ui b/src/View/ui/BoundaryConditionsAdisTS.ui
index e9ceb0f3..e9fce33d 100644
--- a/src/View/ui/BoundaryConditionsAdisTS.ui
+++ b/src/View/ui/BoundaryConditionsAdisTS.ui
@@ -23,29 +23,25 @@
-
-
-
- 20
- 10
- 811
- 421
-
-
-
- Qt::Horizontal
-
-
-
- -
-
-
-
-
-
-
-
-
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
@@ -120,18 +115,6 @@
Ctrl+E
-
-
-
- ressources/sort_A-Z.pngressources/sort_A-Z.png
-
-
- Sort
-
-
- Sort boundary condition by name
-
-
diff --git a/src/View/ui/EditBoundaryConditionsAdisTS.ui b/src/View/ui/EditBoundaryConditionsAdisTS.ui
new file mode 100644
index 00000000..bd55a027
--- /dev/null
+++ b/src/View/ui/EditBoundaryConditionsAdisTS.ui
@@ -0,0 +1,112 @@
+
+
+ MainWindow
+
+
+
+ 0
+ 0
+ 800
+ 450
+
+
+
+
+ 0
+ 0
+
+
+
+ MainWindow
+
+
+
+
+
+
+ -
+
+
+ Qt::Horizontal
+
+
+
+
-
+
+
+
+ 0
+ 200
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ toolBar
+
+
+ TopToolBarArea
+
+
+ false
+
+
+
+
+
+
+ false
+
+
+
+ ressources/add.pngressources/add.png
+
+
+ Add
+
+
+ Add a new point in boundary condition or punctual contribution
+
+
+ Ctrl+N
+
+
+
+
+
+ ressources/del.pngressources/del.png
+
+
+ Delete
+
+
+ Delete current selected rows
+
+
+ Ctrl+D
+
+
+
+
+
+
diff --git a/tests_cases/Enlargement/Enlargement.pamhyr b/tests_cases/Enlargement/Enlargement.pamhyr
index d4b08c0b..98658da7 100644
Binary files a/tests_cases/Enlargement/Enlargement.pamhyr and b/tests_cases/Enlargement/Enlargement.pamhyr differ