Import INI files: non-blocking error if no profile associated with the RK is found in INI file, notifies the user of the relevant RK

This commit is contained in:
JeaDylan committed 2026-08-27 18:49:22 +02:00
1 parent 707577521f
commit 63dfab6654
2 files changed
+29 -7

No files matched your search

+22 -7
View File
@@ -31,7 +31,7 @@ from PyQt5.QtWidgets import (
QDialogButtonBox, QPushButton, QLineEdit,
QFileDialog, QTableView, QAbstractItemView,
QUndoStack, QShortcut, QAction, QItemDelegate,
QComboBox,
QComboBox, QMessageBox
)
from View.Tools.PamhyrTable import PamhyrTableModel
@@ -349,17 +349,32 @@ class InitialConditionTableModel(PamhyrTableModel):
line_split[2],
line_split[3]])
new_data = list(
map(
lambda d: self._lst.new_from_data(*d),
data
)
)
new_data = []
missing_rks = []
for row in data:
rk = row[0].strip()
try:
new_data.append(self._lst.new_from_data(*row))
except ValueError:
missing_rks.append(rk)
logger.warning(
f"No profile found for imported RK {rk} "
f"in reach {self._reach.name}"
)
self.layoutAboutToBeChanged.emit()
self._undo.push(ReplaceDataCommand(self._lst, new_data))
self.layoutChanged.emit()
if missing_rks:
QMessageBox.warning(
self._table_view,
self._trad["missing_rk_title"],
self._trad["missing_rk_text"].format(
rks=", ".join(missing_rks)
)
)
def undo(self):
self._undo.undo()
self.layoutChanged.emit()