mirror of https://gitlab.com/pamhyr/pamhyr2
adistTS NUM file
parent
7681b5d326
commit
3be361b03c
|
|
@ -217,18 +217,21 @@ class AdisTSlc(AdisTS):
|
||||||
|
|
||||||
print(outputkp.reach, outputkp.kp, outputkp.title)
|
print(outputkp.reach, outputkp.kp, outputkp.title)
|
||||||
|
|
||||||
#edges = study.river.enable_edges()
|
edges = study.river.enable_edges()
|
||||||
|
print(edges)
|
||||||
|
|
||||||
#edges = [lambda x: x.id for x in study.river.enable_edges()]
|
id_edges = list(map(lambda x: x.id, edges))
|
||||||
|
|
||||||
#id_reach = outputkp.reach
|
id_reach = outputkp.reach
|
||||||
#kp = filter(
|
kp = outputkp.kp
|
||||||
# lambda e: e._reach. == outputkp.kp,
|
title = outputkp.title
|
||||||
# enumerate(edges)
|
|
||||||
#)
|
|
||||||
|
|
||||||
#if outputkp.reach not in edges:
|
print(id_edges)
|
||||||
#return
|
|
||||||
|
if id_reach not in id_edges:
|
||||||
|
return
|
||||||
|
|
||||||
|
f.write(f"output = {id_reach} {kp} {title}\n")
|
||||||
|
|
||||||
def export_func_dict(self):
|
def export_func_dict(self):
|
||||||
return [
|
return [
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,8 @@ from View.OutputKpAdisTS.UndoCommand import (
|
||||||
SetEnabledCommand, AddCommand, DelCommand,
|
SetEnabledCommand, AddCommand, DelCommand,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
@ -59,10 +61,13 @@ class ComboBoxDelegate(QItemDelegate):
|
||||||
|
|
||||||
val = []
|
val = []
|
||||||
if self._mode == "kp":
|
if self._mode == "kp":
|
||||||
reach = self._data.Output_kp_adists\
|
reach_id = self._data.Output_kp_adists \
|
||||||
.get(index.row())\
|
.get(index.row()) \
|
||||||
.reach
|
.reach
|
||||||
if reach is not None:
|
|
||||||
|
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
|
||||||
|
|
||||||
|
if reach_id is not None:
|
||||||
val = list(
|
val = list(
|
||||||
map(
|
map(
|
||||||
lambda kp: str(kp), reach.reach.get_kp()
|
lambda kp: str(kp), reach.reach.get_kp()
|
||||||
|
|
@ -125,7 +130,7 @@ class TableModel(PamhyrTableModel):
|
||||||
n = self._lst.get(row).reach
|
n = self._lst.get(row).reach
|
||||||
if n is None:
|
if n is None:
|
||||||
return self._trad['not_associated']
|
return self._trad['not_associated']
|
||||||
return n.name
|
return next(filter(lambda edge: edge.id == n, self._data.edges())).name
|
||||||
elif self._headers[column] == "kp":
|
elif self._headers[column] == "kp":
|
||||||
n = self._lst.get(row).kp
|
n = self._lst.get(row).kp
|
||||||
if n is None:
|
if n is None:
|
||||||
|
|
|
||||||
|
|
@ -38,10 +38,10 @@ class SetTitleCommand(QUndoCommand):
|
||||||
self._new = str(new_value)
|
self._new = str(new_value)
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._outputkp_lst.get(self._index).name = self._old
|
self._outputkp_lst.get(self._index).title = self._old
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._outputkp_lst.get(self._index).name = self._new
|
self._outputkp_lst.get(self._index).title = self._new
|
||||||
|
|
||||||
|
|
||||||
class SetReachCommand(QUndoCommand):
|
class SetReachCommand(QUndoCommand):
|
||||||
|
|
@ -51,19 +51,15 @@ class SetReachCommand(QUndoCommand):
|
||||||
self._outputkp_lst = outputkp_lst
|
self._outputkp_lst = outputkp_lst
|
||||||
self._index = index
|
self._index = index
|
||||||
self._old = self._outputkp_lst.get(self._index).reach
|
self._old = self._outputkp_lst.get(self._index).reach
|
||||||
self._new = reach
|
self._new = reach.id
|
||||||
self._old_kp = self._outputkp_lst.get(self._index).kp
|
|
||||||
self._new_kp = None
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
i = self._outputkp_lst.get(self._index)
|
i = self._outputkp_lst.get(self._index)
|
||||||
i.reach = self._old
|
i.reach = self._old
|
||||||
i.kp = self._old_kp
|
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
i = self._outputkp_lst.get(self._index)
|
i = self._outputkp_lst.get(self._index)
|
||||||
i.reach = self._new
|
i.reach = self._new
|
||||||
i.kp = self._new_kp
|
|
||||||
|
|
||||||
|
|
||||||
class SetKpCommand(QUndoCommand):
|
class SetKpCommand(QUndoCommand):
|
||||||
|
|
|
||||||
Binary file not shown.
Loading…
Reference in New Issue