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(
|
DelCommand(
|
||||||
self._data, list(
|
self._data, list(
|
||||||
map(
|
map(
|
||||||
lambda r: self.get_true_data_row(r),
|
lambda r: self._data.point(r),
|
||||||
rows
|
rows
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
@ -285,6 +285,8 @@ class GeometryProfileTableModel(PamhyrTableModel):
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
row = self.get_true_data_row(row)
|
||||||
|
|
||||||
self._undo.push(
|
self._undo.push(
|
||||||
PasteCommand(
|
PasteCommand(
|
||||||
self._data, row, points
|
self._data, row, points
|
||||||
|
|
|
||||||
|
|
@ -116,23 +116,19 @@ class AddCommand(QUndoCommand):
|
||||||
|
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
def __init__(self, profile, rows):
|
def __init__(self, profile, points):
|
||||||
QUndoCommand.__init__(self)
|
QUndoCommand.__init__(self)
|
||||||
|
|
||||||
self._profile = profile
|
self._profile = profile
|
||||||
self._rows = rows
|
self._points = points
|
||||||
|
|
||||||
self._points = []
|
|
||||||
for row in rows:
|
|
||||||
self._points.append(self._profile.point(row))
|
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
for row, point in zip(self._rows, self._points):
|
for point in self._points:
|
||||||
self._profile.insert_point(row, point)
|
point.set_as_not_deleted()
|
||||||
self._profile.modified()
|
self._profile.modified()
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._profile.delete_i(self._rows)
|
self._profile.delete_points(self._points)
|
||||||
self._profile.modified()
|
self._profile.modified()
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -230,8 +226,7 @@ class PasteCommand(QUndoCommand):
|
||||||
self._points.reverse()
|
self._points.reverse()
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
for ind in range(len(self._points)):
|
self._profile.delete_points(self._points)
|
||||||
self._profile.delete_i([self._row])
|
|
||||||
self._profile.modified()
|
self._profile.modified()
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue