Commit 3be361b0 authored by Youcef Aouad's avatar Youcef Aouad
Browse files

adistTS NUM file

No related merge requests found
Pipeline #55676 passed with stages
in 58 seconds
Showing with 25 additions and 21 deletions
+25 -21
......@@ -217,18 +217,21 @@ class AdisTSlc(AdisTS):
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
#kp = filter(
# lambda e: e._reach. == outputkp.kp,
# enumerate(edges)
#)
id_reach = outputkp.reach
kp = outputkp.kp
title = outputkp.title
#if outputkp.reach not in edges:
#return
print(id_edges)
if id_reach not in id_edges:
return
f.write(f"output = {id_reach} {kp} {title}\n")
def export_func_dict(self):
return [
......
......@@ -41,6 +41,8 @@ from View.OutputKpAdisTS.UndoCommand import (
SetEnabledCommand, AddCommand, DelCommand,
)
from functools import reduce
logger = logging.getLogger()
_translate = QCoreApplication.translate
......@@ -59,10 +61,13 @@ class ComboBoxDelegate(QItemDelegate):
val = []
if self._mode == "kp":
reach = self._data.Output_kp_adists\
.get(index.row())\
.reach
if reach is not None:
reach_id = self._data.Output_kp_adists \
.get(index.row()) \
.reach
reach = next(filter(lambda edge: edge.id == reach_id, self._data.edges()))
if reach_id is not None:
val = list(
map(
lambda kp: str(kp), reach.reach.get_kp()
......@@ -125,7 +130,7 @@ class TableModel(PamhyrTableModel):
n = self._lst.get(row).reach
if n is None:
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":
n = self._lst.get(row).kp
if n is None:
......
......@@ -38,10 +38,10 @@ class SetTitleCommand(QUndoCommand):
self._new = str(new_value)
def undo(self):
self._outputkp_lst.get(self._index).name = self._old
self._outputkp_lst.get(self._index).title = self._old
def redo(self):
self._outputkp_lst.get(self._index).name = self._new
self._outputkp_lst.get(self._index).title = self._new
class SetReachCommand(QUndoCommand):
......@@ -51,19 +51,15 @@ class SetReachCommand(QUndoCommand):
self._outputkp_lst = outputkp_lst
self._index = index
self._old = self._outputkp_lst.get(self._index).reach
self._new = reach
self._old_kp = self._outputkp_lst.get(self._index).kp
self._new_kp = None
self._new = reach.id
def undo(self):
i = self._outputkp_lst.get(self._index)
i.reach = self._old
i.kp = self._old_kp
def redo(self):
i = self._outputkp_lst.get(self._index)
i.reach = self._new
i.kp = self._new_kp
class SetKpCommand(QUndoCommand):
......
No preview for this file type
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