Start of the icon editor
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from copy import deepcopy
|
||||
|
||||
from PySide6.QtGui import QUndoCommand
|
||||
|
||||
from bedit_core.models import ComponentID
|
||||
from bedit_gui.models import Icon
|
||||
|
||||
|
||||
class ChangeIconCommand(QUndoCommand):
|
||||
def __init__(self, document: object, component_id: ComponentID, icon: Icon) -> None:
|
||||
super().__init__("Change icon")
|
||||
self.document = document
|
||||
self.component_id = component_id
|
||||
self.old_icon = document.stored_component_icon(component_id)
|
||||
self.new_icon = deepcopy(icon)
|
||||
|
||||
def redo(self) -> None:
|
||||
self.document._set_component_icon(self.component_id, self.new_icon)
|
||||
|
||||
def undo(self) -> None:
|
||||
self.document._set_component_icon(self.component_id, self.old_icon)
|
||||
Reference in New Issue
Block a user