mirror of https://gitlab.com/pamhyr/pamhyr2
Geometry: Continue to fix ponts operation.
parent
c58620fdc2
commit
76ce34c4ea
|
|
@ -193,7 +193,7 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
|||
DelCommand(
|
||||
self._data, list(
|
||||
map(
|
||||
lambda r: self.get_true_data_row(r),
|
||||
lambda r: self._data.point(r),
|
||||
rows
|
||||
)
|
||||
)
|
||||
|
|
@ -285,6 +285,8 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
|||
)
|
||||
)
|
||||
|
||||
row = self.get_true_data_row(row)
|
||||
|
||||
self._undo.push(
|
||||
PasteCommand(
|
||||
self._data, row, points
|
||||
|
|
|
|||
|
|
@ -116,23 +116,19 @@ class AddCommand(QUndoCommand):
|
|||
|
||||
|
||||
class DelCommand(QUndoCommand):
|
||||
def __init__(self, profile, rows):
|
||||
def __init__(self, profile, points):
|
||||
QUndoCommand.__init__(self)
|
||||
|
||||
self._profile = profile
|
||||
self._rows = rows
|
||||
|
||||
self._points = []
|
||||
for row in rows:
|
||||
self._points.append(self._profile.point(row))
|
||||
self._points = points
|
||||
|
||||
def undo(self):
|
||||
for row, point in zip(self._rows, self._points):
|
||||
self._profile.insert_point(row, point)
|
||||
for point in self._points:
|
||||
point.set_as_not_deleted()
|
||||
self._profile.modified()
|
||||
|
||||
def redo(self):
|
||||
self._profile.delete_i(self._rows)
|
||||
self._profile.delete_points(self._points)
|
||||
self._profile.modified()
|
||||
|
||||
|
||||
|
|
@ -230,8 +226,7 @@ class PasteCommand(QUndoCommand):
|
|||
self._points.reverse()
|
||||
|
||||
def undo(self):
|
||||
for ind in range(len(self._points)):
|
||||
self._profile.delete_i([self._row])
|
||||
self._profile.delete_points(self._points)
|
||||
self._profile.modified()
|
||||
|
||||
def redo(self):
|
||||
|
|
|
|||
Loading…
Reference in New Issue