mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
Geometry: Refacto and fix purge method.
This commit is contained in:
1 parent
76ce34c4ea
commit
7181122a3a
6 files changed
+55
-47
No files matched your search
@@ -202,16 +202,17 @@ class PurgeCommand(QUndoCommand):
|
||||
def __init__(self, profile, np_purge):
|
||||
QUndoCommand.__init__(self)
|
||||
|
||||
self._deleted = []
|
||||
self._profile = profile
|
||||
self._old = self._profile.points.copy()
|
||||
self._np_purge = np_purge
|
||||
|
||||
def undo(self):
|
||||
self._profile._points = self._old.copy()
|
||||
for point in self._deleted:
|
||||
point.set_as_not_deleted()
|
||||
self._profile.modified()
|
||||
|
||||
def redo(self):
|
||||
self._profile.purge(self._np_purge)
|
||||
self._deleted = self._profile.purge(self._np_purge)
|
||||
self._profile.modified()
|
||||
|
||||
|
||||
|
||||
@@ -277,18 +277,17 @@ class PurgeCommand(QUndoCommand):
|
||||
|
||||
self._reach = reach
|
||||
self._np_purge = np_purge
|
||||
|
||||
self._old = []
|
||||
for profile in self._reach.profiles:
|
||||
self._old.append(profile.points.copy())
|
||||
self._deleted = {}
|
||||
|
||||
def undo(self):
|
||||
for i in range(self._reach.number_profiles):
|
||||
self._reach.profiles[i]._points = self._old[i].copy()
|
||||
for profile in self._deleted:
|
||||
for point in self._deleted[profile]:
|
||||
point.set_as_not_deleted()
|
||||
profile.modified()
|
||||
|
||||
def redo(self):
|
||||
for profile in self._reach._profiles:
|
||||
profile.purge(self._np_purge)
|
||||
self._deleted[profile] = profile.purge(self._np_purge)
|
||||
|
||||
|
||||
class ChangeReachCommand(QUndoCommand):
|
||||
|
||||
Reference in new issue
Block a user