mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Section: Fix paste row position.
parent
a30bf8e364
commit
78b4269a69
|
|
@ -212,17 +212,28 @@ class GeometryReachTableModel(PamhyrTableModel):
|
||||||
self.layoutChanged.emit()
|
self.layoutChanged.emit()
|
||||||
|
|
||||||
def paste(self, row, header, data):
|
def paste(self, row, header, data):
|
||||||
if row > self._data.number_profiles:
|
if row > len(self._data._profiles):
|
||||||
return
|
return
|
||||||
|
|
||||||
if len(data) == 0:
|
if len(data) == 0:
|
||||||
return
|
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.layoutAboutToBeChanged.emit()
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row,
|
self._data, true_row,
|
||||||
list(
|
list(
|
||||||
map(
|
map(
|
||||||
lambda d: ProfileXYZ.from_data(header, d),
|
lambda d: ProfileXYZ.from_data(header, d),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue