mirror of https://gitlab.com/pamhyr/pamhyr2
BC AdisTS View Table
parent
d154ac96c2
commit
b927aa81b3
|
|
@ -41,8 +41,8 @@ from Model.BoundaryCondition.BoundaryConditionTypes import (
|
||||||
|
|
||||||
from View.Tools.PamhyrTable import PamhyrTableModel
|
from View.Tools.PamhyrTable import PamhyrTableModel
|
||||||
|
|
||||||
from View.BoundaryCondition.UndoCommand import (
|
from View.BoundaryConditionsAdisTS.UndoCommand import (
|
||||||
SetNameCommand, SetNodeCommand, SetTypeCommand,
|
SetNodeCommand, SetTypeCommand,
|
||||||
AddCommand, DelCommand, SortCommand,
|
AddCommand, DelCommand, SortCommand,
|
||||||
MoveCommand, PasteCommand,
|
MoveCommand, PasteCommand,
|
||||||
)
|
)
|
||||||
|
|
@ -71,15 +71,7 @@ class ComboBoxDelegate(QItemDelegate):
|
||||||
self.editor = QComboBox(parent)
|
self.editor = QComboBox(parent)
|
||||||
|
|
||||||
if self._mode == "type":
|
if self._mode == "type":
|
||||||
lst = list(
|
lst = [self._trad["not_associated"], "Concentration", "Rate"]
|
||||||
map(
|
|
||||||
lambda k: self._long_types[k],
|
|
||||||
filter(
|
|
||||||
lambda k: self._tab in BC_types[k].compatibility(),
|
|
||||||
BC_types.keys()
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self.editor.addItems(
|
self.editor.addItems(
|
||||||
lst
|
lst
|
||||||
)
|
)
|
||||||
|
|
@ -115,38 +107,45 @@ class ComboBoxDelegate(QItemDelegate):
|
||||||
|
|
||||||
|
|
||||||
class TableModel(PamhyrTableModel):
|
class TableModel(PamhyrTableModel):
|
||||||
def __init__(self, trad=None, **kwargs):
|
def __init__(self, pollutant=None, bc_list =None, trad=None, **kwargs):
|
||||||
self._trad = trad
|
self._trad = trad
|
||||||
self._long_types = {}
|
self._bc_list = bc_list
|
||||||
if self._trad is not None:
|
self._pollutant = pollutant
|
||||||
self._long_types = self._trad.get_dict("long_types")
|
print("pollutant : ", self._pollutant)
|
||||||
|
|
||||||
super(TableModel, self).__init__(trad=trad, **kwargs)
|
super(TableModel, self).__init__(trad=trad, **kwargs)
|
||||||
|
|
||||||
def _setup_lst(self):
|
def _setup_lst(self):
|
||||||
self._lst = self._data.boundary_condition
|
self._lst = self._bc_list.lst
|
||||||
self._tab = self._opt_data
|
|
||||||
|
|
||||||
def rowCount(self, parent):
|
def rowCount(self, parent):
|
||||||
return self._lst.len(self._tab)
|
return len(self._lst)
|
||||||
|
|
||||||
def data(self, index, role):
|
def data(self, index, role):
|
||||||
|
if len(self._lst) != 0:
|
||||||
|
data = list(filter(lambda x: x.pollutant == self._pollutant,
|
||||||
|
self._lst))
|
||||||
|
else:
|
||||||
|
data = []
|
||||||
|
|
||||||
if role != Qt.ItemDataRole.DisplayRole:
|
if role != Qt.ItemDataRole.DisplayRole:
|
||||||
return QVariant()
|
return QVariant()
|
||||||
|
|
||||||
row = index.row()
|
row = index.row()
|
||||||
column = index.column()
|
column = index.column()
|
||||||
|
|
||||||
if self._headers[column] == "name":
|
if self._headers[column] == "type":
|
||||||
return self._lst.get(self._tab, row).name
|
#n = self._lst[row].type
|
||||||
elif self._headers[column] == "type":
|
n = data[row].type
|
||||||
t = self._lst.get(self._tab, row).bctype
|
if n is None or n == "":
|
||||||
return self._long_types[t]
|
return self._trad["not_associated"]
|
||||||
|
return n
|
||||||
elif self._headers[column] == "node":
|
elif self._headers[column] == "node":
|
||||||
n = self._lst.get(self._tab, row).node
|
#n = self._lst[row].node
|
||||||
|
n = data[row].node
|
||||||
if n is None:
|
if n is None:
|
||||||
return self._trad["not_associated"]
|
return self._trad["not_associated"]
|
||||||
return n.name
|
return n
|
||||||
|
|
||||||
return QVariant()
|
return QVariant()
|
||||||
|
|
||||||
|
|
@ -158,24 +157,16 @@ class TableModel(PamhyrTableModel):
|
||||||
column = index.column()
|
column = index.column()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if self._headers[column] == "name":
|
if self._headers[column] == "type":
|
||||||
self._undo.push(
|
|
||||||
SetNameCommand(
|
|
||||||
self._lst, self._tab, row, value
|
|
||||||
)
|
|
||||||
)
|
|
||||||
elif self._headers[column] == "type":
|
|
||||||
key = next(k for k, v in self._long_types.items()
|
|
||||||
if v == value)
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
SetTypeCommand(
|
SetTypeCommand(
|
||||||
self._lst, self._tab, row, BC_types[key]
|
self._lst, row, value
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
elif self._headers[column] == "node":
|
elif self._headers[column] == "node":
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
SetNodeCommand(
|
SetNodeCommand(
|
||||||
self._lst, self._tab, row, self._data.node(value)
|
self._lst, row, self._data.node(value)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
@ -190,7 +181,7 @@ class TableModel(PamhyrTableModel):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
AddCommand(
|
AddCommand(
|
||||||
self._lst, self._tab, row
|
self._pollutant, self._bc_list, self._lst, row
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@ -202,59 +193,13 @@ class TableModel(PamhyrTableModel):
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
DelCommand(
|
DelCommand(
|
||||||
self._lst, self._tab, rows
|
self._lst, rows
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def sort(self, _reverse, parent=QModelIndex()):
|
|
||||||
self.layoutAboutToBeChanged.emit()
|
|
||||||
|
|
||||||
self._undo.push(
|
|
||||||
SortCommand(
|
|
||||||
self._lst, self._tab, False
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
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._lst, self._tab, "up", row
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.endMoveRows()
|
|
||||||
self.layoutChanged.emit()
|
|
||||||
|
|
||||||
def move_down(self, index, parent=QModelIndex()):
|
|
||||||
if row > len(self._lst):
|
|
||||||
return
|
|
||||||
|
|
||||||
target = row
|
|
||||||
|
|
||||||
self.beginMoveRows(parent, row + 1, row + 1, parent, target)
|
|
||||||
|
|
||||||
self._undo_stack.push(
|
|
||||||
MoveCommand(
|
|
||||||
self._lst, self._tab, "down", row
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
self.endMoveRows()
|
|
||||||
self.layoutChanged.emit()
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._undo.undo()
|
self._undo.undo()
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
|
||||||
|
|
@ -23,87 +23,62 @@ from PyQt5.QtWidgets import (
|
||||||
QMessageBox, QUndoCommand, QUndoStack,
|
QMessageBox, QUndoCommand, QUndoStack,
|
||||||
)
|
)
|
||||||
|
|
||||||
from Model.BoundaryCondition.BoundaryCondition import BoundaryCondition
|
from Model.BoundaryConditionsAdisTS.BoundaryConditionAdisTS import BoundaryConditionAdisTS
|
||||||
from Model.BoundaryCondition.BoundaryConditionList import BoundaryConditionList
|
from Model.BoundaryConditionsAdisTS.BoundaryConditionsAdisTSList import BoundaryConditionsAdisTSList
|
||||||
|
|
||||||
|
|
||||||
class SetNameCommand(QUndoCommand):
|
|
||||||
def __init__(self, bcs, tab, index, new_value):
|
|
||||||
QUndoCommand.__init__(self)
|
|
||||||
|
|
||||||
self._bcs = bcs
|
|
||||||
self._tab = tab
|
|
||||||
self._index = index
|
|
||||||
self._old = self._bcs.get(self._tab, self._index).name
|
|
||||||
self._new = str(new_value)
|
|
||||||
|
|
||||||
def undo(self):
|
|
||||||
self._bcs.get(self._tab, self._index).name = self._old
|
|
||||||
|
|
||||||
def redo(self):
|
|
||||||
self._bcs.get(self._tab, self._index).name = self._new
|
|
||||||
|
|
||||||
|
|
||||||
class SetNodeCommand(QUndoCommand):
|
class SetNodeCommand(QUndoCommand):
|
||||||
def __init__(self, bcs, tab, index, node):
|
def __init__(self, bcs, index, node):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._bcs = bcs
|
self._bcs = bcs
|
||||||
self._tab = tab
|
|
||||||
self._index = index
|
self._index = index
|
||||||
self._old = self._bcs.get(self._tab, self._index).node
|
self._old = self._bcs[self._index].node
|
||||||
self._new = node
|
self._new = node.id
|
||||||
self._prev_assoc_to_node = self._bcs.get_assoc_to_node(tab, node)
|
|
||||||
|
|
||||||
def _previous_assoc_node(self, node):
|
|
||||||
if self._prev_assoc_to_node is not None:
|
|
||||||
self._prev_assoc_to_node.node = node
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._bcs.get(self._tab, self._index).node = self._old
|
self._bcs[self._index].node = self._old
|
||||||
self._previous_assoc_node(self._new)
|
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._bcs.get(self._tab, self._index).node = self._new
|
self._bcs[self._index].node = self._new
|
||||||
self._previous_assoc_node(None)
|
|
||||||
|
|
||||||
|
|
||||||
class SetTypeCommand(QUndoCommand):
|
class SetTypeCommand(QUndoCommand):
|
||||||
def __init__(self, bcs, tab, index, _type):
|
def __init__(self, bcs, index, _type):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._bcs = bcs
|
self._bcs = bcs
|
||||||
self._tab = tab
|
|
||||||
self._index = index
|
self._index = index
|
||||||
self._type = _type
|
self._type = _type
|
||||||
self._old = self._bcs.get(self._tab, self._index)
|
self._old = self._bcs[self._index].type
|
||||||
self._new = self._bcs.get(self._tab, self._index)\
|
self._new = self._type
|
||||||
.convert(self._type)
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._bcs.set(self._tab, self._index, self._old)
|
self._bcs[self._index].type = self._old
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._bcs.set(self._tab, self._index, self._new)
|
self._bcs[self._index].type = self._new
|
||||||
|
print("type : ", self._old, self._new, self._bcs[self._index].type)
|
||||||
|
|
||||||
class AddCommand(QUndoCommand):
|
class AddCommand(QUndoCommand):
|
||||||
def __init__(self, bcs, tab, index):
|
def __init__(self, pollutant, bcs_list, bcs, index):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._bcs = bcs
|
self._bcs = bcs
|
||||||
self._tab = tab
|
self._bc_list = bcs_list
|
||||||
|
self._pollutant = pollutant
|
||||||
self._index = index
|
self._index = index
|
||||||
self._new = None
|
self._new = None
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._bcs.delete_i(self._tab, [self._index])
|
del self._bcs[self._index]
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
if self._new is None:
|
if self._new is None:
|
||||||
self._new = self._bcs.new(self._tab, self._index)
|
self._new = self._bc_list.new(self._index, self._pollutant)
|
||||||
|
print(self._new.pollutant)
|
||||||
|
print(len(self._bc_list))
|
||||||
|
print(len(self._bcs))
|
||||||
else:
|
else:
|
||||||
self._bcs.insert(self._tab, self._index, self._new)
|
self._bcs.insert(self._index, self._new)
|
||||||
|
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
|
|
|
||||||
|
|
@ -64,18 +64,20 @@ _translate = QCoreApplication.translate
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
class BoundaryConditionWindow(PamhyrWindow):
|
class BoundaryConditionAdisTSWindow(PamhyrWindow):
|
||||||
_pamhyr_ui = "BoundaryConditionsAdisTS"
|
_pamhyr_ui = "BoundaryConditionsAdisTS"
|
||||||
_pamhyr_name = "Boundary conditions AdisTS"
|
_pamhyr_name = "Boundary conditions AdisTS"
|
||||||
|
|
||||||
def __init__(self, study=None, config=None, parent=None):
|
def __init__(self, pollutant=None, study=None, config=None, parent=None):
|
||||||
trad = BCAdisTSTranslate()
|
trad = BCAdisTSTranslate()
|
||||||
name = (
|
name = (
|
||||||
trad[self._pamhyr_name] +
|
trad[self._pamhyr_name] +
|
||||||
" - " + study.name
|
" - " + study.name
|
||||||
)
|
)
|
||||||
|
|
||||||
super(BoundaryConditionWindow, self).__init__(
|
self._pollutant = pollutant
|
||||||
|
|
||||||
|
super(BoundaryConditionAdisTSWindow, self).__init__(
|
||||||
title=name,
|
title=name,
|
||||||
study=study,
|
study=study,
|
||||||
config=config,
|
config=config,
|
||||||
|
|
@ -83,7 +85,7 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
parent=parent
|
parent=parent
|
||||||
)
|
)
|
||||||
|
|
||||||
self._bcs = self._study.river.boundary_condition
|
self._bcs = self._study.river.boundary_conditions_adists
|
||||||
|
|
||||||
self.setup_table()
|
self.setup_table()
|
||||||
self.setup_graph()
|
self.setup_graph()
|
||||||
|
|
@ -92,40 +94,34 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
self.ui.setWindowTitle(self._title)
|
self.ui.setWindowTitle(self._title)
|
||||||
|
|
||||||
def setup_table(self):
|
def setup_table(self):
|
||||||
self._table = {}
|
|
||||||
|
|
||||||
t = "liquid"
|
|
||||||
|
|
||||||
self._delegate_type = ComboBoxDelegate(
|
self._delegate_type = ComboBoxDelegate(
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
data=self._study.river,
|
data=self._study.river,
|
||||||
mode="type",
|
mode="type",
|
||||||
tab=t,
|
|
||||||
parent=self
|
parent=self
|
||||||
)
|
)
|
||||||
self._delegate_node = ComboBoxDelegate(
|
self._delegate_node = ComboBoxDelegate(
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
data=self._study.river,
|
data=self._study.river,
|
||||||
mode="node",
|
mode="node",
|
||||||
tab=t,
|
|
||||||
parent=self
|
parent=self
|
||||||
)
|
)
|
||||||
|
|
||||||
table = self.find(QTableView, f"tableView_{t}")
|
table = self.find(QTableView, f"tableView")
|
||||||
self._table[t] = TableModel(
|
self._table = TableModel(
|
||||||
table_view=table,
|
table_view=table,
|
||||||
table_headers=self._trad.get_dict("table_headers"),
|
table_headers=self._trad.get_dict("table_headers"),
|
||||||
editable_headers=["name", "type", "node"],
|
editable_headers=["type", "node"],
|
||||||
delegates={
|
delegates={
|
||||||
"type": self._delegate_type,
|
"type": self._delegate_type,
|
||||||
"node": self._delegate_node,
|
"node": self._delegate_node,
|
||||||
},
|
},
|
||||||
trad=self._trad,
|
trad=self._trad,
|
||||||
data=self._study.river,
|
bc_list = self._study.river.boundary_conditions_adists,
|
||||||
undo=self._undo_stack,
|
undo=self._undo_stack,
|
||||||
opt_data=t,
|
pollutant=self._pollutant
|
||||||
)
|
)
|
||||||
table.setModel(self._table[t])
|
table.setModel(self._table)
|
||||||
table.setSelectionBehavior(QAbstractItemView.SelectRows)
|
table.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||||
table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
table.horizontalHeader().setSectionResizeMode(QHeaderView.Stretch)
|
||||||
table.setAlternatingRowColors(True)
|
table.setAlternatingRowColors(True)
|
||||||
|
|
@ -154,8 +150,7 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
.row()
|
.row()
|
||||||
|
|
||||||
def index_selected_rows(self):
|
def index_selected_rows(self):
|
||||||
tab = "liquid"
|
table = self.find(QTableView, f"tableView")
|
||||||
table = self.find(QTableView, f"tableView_{tab}")
|
|
||||||
return list(
|
return list(
|
||||||
# Delete duplicate
|
# Delete duplicate
|
||||||
set(
|
set(
|
||||||
|
|
@ -167,12 +162,11 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
)
|
)
|
||||||
|
|
||||||
def add(self):
|
def add(self):
|
||||||
tab = "liquid"
|
|
||||||
rows = self.index_selected_rows()
|
rows = self.index_selected_rows()
|
||||||
if self._bcs.len(tab) == 0 or len(rows) == 0:
|
if len(self._bcs) == 0 or len(rows) == 0:
|
||||||
self._table[tab].add(0)
|
self._table.add(0)
|
||||||
else:
|
else:
|
||||||
self._table[tab].add(rows[0])
|
self._table.add(rows[0])
|
||||||
|
|
||||||
def delete(self):
|
def delete(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
|
|
@ -180,21 +174,21 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
if len(rows) == 0:
|
if len(rows) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._table[tab].delete(rows)
|
self._table.delete(rows)
|
||||||
|
|
||||||
def sort(self):
|
def sort(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
self._table[tab].sort(False)
|
self._table.sort(False)
|
||||||
|
|
||||||
def move_up(self):
|
def move_up(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
row = self.index_selected_row()
|
row = self.index_selected_row()
|
||||||
self._table[tab].move_up(row)
|
self._table.move_up(row)
|
||||||
|
|
||||||
def move_down(self):
|
def move_down(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
row = self.index_selected_row()
|
row = self.index_selected_row()
|
||||||
self._table[tab].move_down(row)
|
self._table.move_down(row)
|
||||||
|
|
||||||
def _copy(self):
|
def _copy(self):
|
||||||
logger.info("TODO: copy")
|
logger.info("TODO: copy")
|
||||||
|
|
@ -204,11 +198,11 @@ class BoundaryConditionWindow(PamhyrWindow):
|
||||||
|
|
||||||
def _undo(self):
|
def _undo(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
self._table[tab].undo()
|
self._table.undo()
|
||||||
|
|
||||||
def _redo(self):
|
def _redo(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
self._table[tab].redo()
|
self._table.redo()
|
||||||
|
|
||||||
def edit(self):
|
def edit(self):
|
||||||
tab = "liquid"
|
tab = "liquid"
|
||||||
|
|
|
||||||
|
|
@ -30,17 +30,7 @@ class BCAdisTSTranslate(MainTranslate):
|
||||||
"BoundaryConditionsAdisTS", "Boundary conditions AdisTS"
|
"BoundaryConditionsAdisTS", "Boundary conditions AdisTS"
|
||||||
)
|
)
|
||||||
|
|
||||||
self._sub_dict["long_types"] = {
|
|
||||||
"ND": self._dict["not_defined"],
|
|
||||||
"PC": _translate("BoundaryCondition", "Ponctual contribution"),
|
|
||||||
"TZ": _translate("BoundaryCondition", "Z(t)"),
|
|
||||||
"TD": _translate("BoundaryCondition", "Q(t)"),
|
|
||||||
"ZD": _translate("BoundaryCondition", "Q(Z)"),
|
|
||||||
"SL": _translate("BoundaryCondition", "Solid"),
|
|
||||||
}
|
|
||||||
|
|
||||||
self._sub_dict["table_headers"] = {
|
self._sub_dict["table_headers"] = {
|
||||||
"name": self._dict["name"],
|
|
||||||
"type": self._dict["type"],
|
"type": self._dict["type"],
|
||||||
"node": _translate("BoundaryCondition", "Node")
|
"node": _translate("BoundaryCondition", "Node")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ from View.Pollutants.Translate import PollutantsTranslate
|
||||||
from View.Pollutants.Edit.Window import EditPolluantWindow
|
from View.Pollutants.Edit.Window import EditPolluantWindow
|
||||||
|
|
||||||
from View.InitialConditionsAdisTS.Window import InitialConditionsAdisTSWindow
|
from View.InitialConditionsAdisTS.Window import InitialConditionsAdisTSWindow
|
||||||
from View.BoundaryConditionsAdisTS.Window import BoundaryConditionWindow
|
from View.BoundaryConditionsAdisTS.Window import BoundaryConditionAdisTSWindow
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
|
|
@ -214,17 +214,22 @@ class PollutantsWindow(PamhyrWindow):
|
||||||
initial.show()
|
initial.show()
|
||||||
|
|
||||||
def boundary_conditions(self, tab=0):
|
def boundary_conditions(self, tab=0):
|
||||||
|
rows = self.index_selected_rows()
|
||||||
|
|
||||||
|
for row in rows:
|
||||||
|
pollutant_id = self._pollutants_lst.get(row).id
|
||||||
|
|
||||||
if self.sub_window_exists(
|
if self.sub_window_exists(
|
||||||
BoundaryConditionWindow,
|
BoundaryConditionAdisTSWindow,
|
||||||
data=[self._study, None]
|
data=[self._study, None, pollutant_id]
|
||||||
):
|
):
|
||||||
bound = self.get_sub_window(
|
bound = self.get_sub_window(
|
||||||
BoundaryConditionWindow,
|
BoundaryConditionAdisTSWindow,
|
||||||
data=[self._study, None]
|
data=[self._study, None, ollutant_id]
|
||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
bound = BoundaryConditionWindow(study=self._study, parent=self)
|
bound = BoundaryConditionAdisTSWindow(study=self._study, pollutant=pollutant_id, parent=self)
|
||||||
bound.show()
|
bound.show()
|
||||||
|
|
||||||
def _set_checkbox_state(self):
|
def _set_checkbox_state(self):
|
||||||
|
|
|
||||||
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>861</width>
|
||||||
<height>450</height>
|
<height>498</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
|
@ -23,46 +23,36 @@
|
||||||
<locale language="English" country="Europe"/>
|
<locale language="English" country="Europe"/>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QSplitter" name="splitter">
|
<widget class="QSplitter" name="splitter">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>10</y>
|
||||||
|
<width>811</width>
|
||||||
|
<height>421</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QWidget" name="verticalLayoutWidget_2">
|
||||||
<property name="minimumSize">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<size>
|
<item>
|
||||||
<width>300</width>
|
<widget class="QTableView" name="tableView"/>
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="currentIndex">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<widget class="QWidget" name="tab_liquid">
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Liquid</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QTableView" name="tableView_liquid"/>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="verticalLayoutWidget">
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout"/>
|
<layout class="QVBoxLayout" name="verticalLayout"/>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QMenuBar" name="menubar">
|
<widget class="QMenuBar" name="menubar">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>800</width>
|
<width>861</width>
|
||||||
<height>22</height>
|
<height>22</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue