mirror of https://gitlab.com/pamhyr/pamhyr2
geometry: Fix profile add, undo.
parent
e5d47564eb
commit
92d1549d7e
|
|
@ -79,13 +79,15 @@ class Reach:
|
||||||
index: The position of the new profile.
|
index: The position of the new profile.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Nothing.
|
The new profile.
|
||||||
"""
|
"""
|
||||||
profile = ProfileXYZ(reach=self)
|
profile = ProfileXYZ(reach=self)
|
||||||
|
|
||||||
self._profiles.insert(index, profile)
|
self._profiles.insert(index, profile)
|
||||||
self._update_profile_numbers()
|
self._update_profile_numbers()
|
||||||
|
|
||||||
|
return profile
|
||||||
|
|
||||||
def insert_profile(self, index: int, profile: Profile):
|
def insert_profile(self, index: int, profile: Profile):
|
||||||
"""Insert new profile in list
|
"""Insert new profile in list
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,12 +40,16 @@ class AddCommand(QUndoCommand):
|
||||||
|
|
||||||
self._reach = reach
|
self._reach = reach
|
||||||
self._index = index
|
self._index = index
|
||||||
|
self._profile = None
|
||||||
|
|
||||||
def undo(self):
|
def undo(self):
|
||||||
self._reach.delete(self._index)
|
self._reach.delete_profiles([self._profile])
|
||||||
|
|
||||||
def redo(self):
|
def redo(self):
|
||||||
self._reach.insert(self._index)
|
if self._profile is None:
|
||||||
|
self._profile = self._reach.insert(self._index)
|
||||||
|
else:
|
||||||
|
self._reach.insert_profile(self._index, self._profile)
|
||||||
|
|
||||||
class DelCommand(QUndoCommand):
|
class DelCommand(QUndoCommand):
|
||||||
def __init__(self, reach, rows):
|
def __init__(self, reach, rows):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue