mirror of https://gitlab.com/pamhyr/pamhyr2
BC: Fix delete elements.
parent
cd3d546d73
commit
500d97d7d3
|
|
@ -1,5 +1,7 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from tools import trace, timer
|
||||
|
||||
from Model.Except import NotImplementedMethodeError
|
||||
|
||||
class BoundaryCondition(object):
|
||||
|
|
@ -88,6 +90,7 @@ class BoundaryCondition(object):
|
|||
def set_i_1(self, index:int, value):
|
||||
self._set_i_c_v(index, 1, value)
|
||||
|
||||
@timer
|
||||
def convert(self, cls):
|
||||
new = cls(name = self.name)
|
||||
for i, _ in self.data:
|
||||
|
|
|
|||
|
|
@ -25,16 +25,16 @@ class BoundaryConditionList(list):
|
|||
self.remove(bc)
|
||||
|
||||
def delete_i(self, indexes):
|
||||
bcs = map(
|
||||
lambda x: x[1],
|
||||
filter(
|
||||
lambda x: x[0] in indexes,
|
||||
enumerate(self)
|
||||
bcs = list(
|
||||
map(
|
||||
lambda x: x[1],
|
||||
filter(
|
||||
lambda x: x[0] in indexes,
|
||||
enumerate(self)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
for bc in bcs:
|
||||
self.remove(bc)
|
||||
self.delete(bcs)
|
||||
|
||||
def move_up(self, index):
|
||||
if index < len(self):
|
||||
|
|
|
|||
|
|
@ -301,6 +301,10 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
|||
2, self._delegate_node
|
||||
)
|
||||
|
||||
table.setSelectionBehavior(QAbstractItemView.SelectRows)
|
||||
table.setAlternatingRowColors(True)
|
||||
|
||||
|
||||
def setup_connections(self):
|
||||
self.find(QAction, "action_add").triggered.connect(self.add)
|
||||
self.find(QAction, "action_del").triggered.connect(self.delete)
|
||||
|
|
@ -339,6 +343,9 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
|||
|
||||
def delete(self):
|
||||
rows = self.index_selected_rows()
|
||||
if len(rows) == 0:
|
||||
return
|
||||
|
||||
self._table.delete(rows)
|
||||
|
||||
def sort(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue