mirror of https://gitlab.com/pamhyr/pamhyr2
refacto variable names for D90
parent
e755459004
commit
7a91969f41
|
|
@ -46,21 +46,21 @@ _translate = QCoreApplication.translate
|
|||
|
||||
|
||||
class ComboBoxDelegate(QItemDelegate):
|
||||
def __init__(self, data=None, ic_spec_lst=None,
|
||||
def __init__(self, data=None, d90_spec_lst=None,
|
||||
trad=None, parent=None, mode="reaches"):
|
||||
super(ComboBoxDelegate, self).__init__(parent)
|
||||
|
||||
self._data = data
|
||||
self._mode = mode
|
||||
self._trad = trad
|
||||
self._ic_spec_lst = ic_spec_lst
|
||||
self._d90_spec_lst = d90_spec_lst
|
||||
|
||||
def createEditor(self, parent, option, index):
|
||||
self.editor = QComboBox(parent)
|
||||
|
||||
val = []
|
||||
if self._mode == "rk":
|
||||
reach_id = self._ic_spec_lst[index.row()].reach
|
||||
reach_id = self._d90_spec_lst[index.row()].reach
|
||||
|
||||
reach = next(filter(
|
||||
lambda edge: edge.id == reach_id, self._data.edges()
|
||||
|
|
|
|||
|
|
@ -112,11 +112,11 @@ class SetCommandSpec(QUndoCommand):
|
|||
|
||||
|
||||
class AddCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, index):
|
||||
def __init__(self, data, d90_spec, index):
|
||||
QUndoCommand.__init__(self)
|
||||
|
||||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._d90_spec = d90_spec
|
||||
self._index = index
|
||||
self._new = None
|
||||
|
||||
|
|
@ -131,21 +131,20 @@ class AddCommand(QUndoCommand):
|
|||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, data, ics_spec, rows):
|
||||
def __init__(self, data, d90_spec, rows):
|
||||
QUndoCommand.__init__(self)
|
||||
|
||||
self._data = data
|
||||
self._ics_spec = ics_spec
|
||||
self._d90_spec = d90_spec
|
||||
self._rows = rows
|
||||
# self._data = data
|
||||
|
||||
self._ic = []
|
||||
self._d90 = []
|
||||
for row in rows:
|
||||
self._ic.append((row, self._ics_spec[row]))
|
||||
self._ic.sort()
|
||||
self._d90.append((row, self._d90_spec[row]))
|
||||
self._d90.sort()
|
||||
|
||||
def undo(self):
|
||||
for row, el in self._ic:
|
||||
for row, el in self._d90:
|
||||
self._data.insert(row, el)
|
||||
|
||||
def redo(self):
|
||||
|
|
|
|||
|
|
@ -138,14 +138,14 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
self._delegate_reach = ComboBoxDelegate(
|
||||
trad=self._trad,
|
||||
data=self._study.river,
|
||||
ic_spec_lst=self._data[0]._data,
|
||||
d90_spec_lst=self._data[0]._data,
|
||||
parent=self,
|
||||
mode="reaches"
|
||||
)
|
||||
self._delegate_rk = ComboBoxDelegate(
|
||||
trad=self._trad,
|
||||
data=self._study.river,
|
||||
ic_spec_lst=self._data[0]._data,
|
||||
d90_spec_lst=self._data[0]._data,
|
||||
parent=self,
|
||||
mode="rk"
|
||||
)
|
||||
|
|
@ -227,15 +227,15 @@ class D90AdisTSWindow(PamhyrWindow):
|
|||
|
||||
table = list(
|
||||
map(
|
||||
lambda eic: list(
|
||||
lambda ed90: list(
|
||||
map(
|
||||
lambda k: eic[1][k],
|
||||
lambda k: ed90[1][k],
|
||||
["rk", "discharge", "elevation"]
|
||||
)
|
||||
),
|
||||
filter(
|
||||
lambda eic: eic[0] in rows,
|
||||
enumerate(self._ics.lst())
|
||||
lambda ed90: ed90[0] in rows,
|
||||
enumerate(self._d90.lst())
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue