mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Merge: branch 'master' into 'scenarios'.
This commit is contained in:
commit
74ab3aa522
312 files changed
+82851
-9744
No files matched your search
@@ -39,7 +39,7 @@ from View.Tools.PamhyrTable import PamhyrTableModel
|
||||
from View.InitialConditions.UndoCommand import (
|
||||
SetCommand, AddCommand, DelCommand,
|
||||
SortCommand, MoveCommand, InsertCommand,
|
||||
DuplicateCommand, GenerateCommand,
|
||||
DuplicateCommand, GenerateCommand, ReplaceDataCommand,
|
||||
)
|
||||
|
||||
logger = logging.getLogger()
|
||||
@@ -111,20 +111,15 @@ class InitialConditionTableModel(PamhyrTableModel):
|
||||
row = index.row()
|
||||
column = index.column()
|
||||
|
||||
if self._headers[column] == "rk":
|
||||
val = self._lst.get(row)
|
||||
section = val[self._headers[column]]
|
||||
if section is None:
|
||||
return ""
|
||||
|
||||
return section.display_name()
|
||||
elif self._headers[column] == "speed":
|
||||
if self._headers[column] == "velocity":
|
||||
z = self._lst.get(row)["elevation"]
|
||||
q = self._lst.get(row)["discharge"]
|
||||
profile = self._lst.get(row)["rk"]
|
||||
if profile is not None:
|
||||
speed = profile.speed(q, z)
|
||||
return f"{speed:.4f}"
|
||||
profile = self._reach.reach.get_profiles_from_rk(
|
||||
self._lst.get(row)["rk"]
|
||||
)
|
||||
if len(profile) >= 1:
|
||||
velocity = profile[0].speed(q, z)
|
||||
return f"{velocity:.4f}"
|
||||
|
||||
return ""
|
||||
elif self._headers[column] not in ["name", "comment"]:
|
||||
@@ -279,8 +274,8 @@ class InitialConditionTableModel(PamhyrTableModel):
|
||||
)
|
||||
|
||||
self._undo.push(
|
||||
InsertCommand(
|
||||
self._lst, index,
|
||||
ReplaceDataCommand(
|
||||
self._lst,
|
||||
list(
|
||||
map(
|
||||
lambda d: self._lst.new_from_data(*d),
|
||||
|
||||
Reference in new issue
Block a user