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