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

BC: Fix delete elements.

Showing with 18 additions and 8 deletions
+18 -8
# -*- 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):
......
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