mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
geometry: Fix delete and paste command.
This commit is contained in:
1 parent
8adad9b7ad
commit
9057860302
2 files changed
+45
-9
No files matched your search
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from copy import deepcopy
|
||||
from tools import trace, timer
|
||||
|
||||
from PyQt5.QtWidgets import (
|
||||
@@ -64,9 +65,7 @@ class DelCommand(QUndoCommand):
|
||||
self._reach.insert_profile(row, pro)
|
||||
|
||||
def redo(self):
|
||||
row = self._rows[0]
|
||||
for _ in self._rows:
|
||||
self._reach.delete(row)
|
||||
self._reach.delete(self._rows)
|
||||
|
||||
class SortCommand(QUndoCommand):
|
||||
def __init__(self, reach, _reverse):
|
||||
@@ -120,11 +119,15 @@ class PasteCommand(QUndoCommand):
|
||||
|
||||
self._reach = reach
|
||||
self._row = row
|
||||
self._profiles = profiles
|
||||
self._profiles = list(
|
||||
map(
|
||||
lambda p: deepcopy(p),
|
||||
profiles
|
||||
)
|
||||
)
|
||||
|
||||
def undo(self):
|
||||
for ind in range(len(self._profiles)):
|
||||
self._reach.delete(self._row)
|
||||
self._reach.delete_profiles(self._profiles)
|
||||
|
||||
def redo(self):
|
||||
self._profiles.reverse()
|
||||
|
||||
Reference in new issue
Block a user