BC: Fix delete elements.

mesh
Pierre-Antoine Rouby 2023-05-03 11:28:13 +02:00
parent cd3d546d73
commit 500d97d7d3
3 changed files with 18 additions and 8 deletions

View File

@ -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:

View File

@ -25,16 +25,16 @@ class BoundaryConditionList(list):
self.remove(bc)
def delete_i(self, indexes):
bcs = map(
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):

View File

@ -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):