Start of the icon editor

This commit is contained in:
Joppe Blondel
2026-07-27 13:08:15 +02:00
parent 713d094b08
commit 09a9e3f12f
11 changed files with 686 additions and 5 deletions
@@ -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)