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