Geometry: Section: Fix paste row position.

scenarios
Pierre-Antoine 2025-09-05 10:46:25 +02:00
parent a30bf8e364
commit 78b4269a69
1 changed files with 13 additions and 2 deletions

View File

@ -212,17 +212,28 @@ class GeometryReachTableModel(PamhyrTableModel):
self.layoutChanged.emit()
def paste(self, row, header, data):
if row > self._data.number_profiles:
if row > len(self._data._profiles):
return
if len(data) == 0:
return
profile = self._data.profile(row)
true_row = next(
map(
lambda e: e[0],
filter(
lambda e: e[1] == profile,
enumerate(self._data._profiles)
)
)
)
self.layoutAboutToBeChanged.emit()
self._undo.push(
PasteCommand(
self._data, row,
self._data, true_row,
list(
map(
lambda d: ProfileXYZ.from_data(header, d),