commands package

Submodules

commands.tile_edit_command module

class ui.commands.tile_edit_command.TileEditCommand(tile_data, new_state_preset, logic, description='Edit Tile')

Bases: QUndoCommand

QUndoCommand for editing a tile’s properties with undo/redo support.

This command stores the original state of a tile and applies a new preset state, allowing changes to be undone and redone as needed.

Parameters:
  • tile_data (TileData) – The tile data object to be modified.

  • new_state_preset (TilePreset) – The preset containing the new state to apply to the tile.

  • logic (object) – The logic context required for applying the preset.

  • description (str, optional) – Description for the undo command (default is “Edit Tile”).

Variables:
  • tile_data (TileData) – The tile data object being edited.

  • old_state (dict) – A deep copy of the original tile state for undo operations.

  • preset (TilePreset) – The preset to apply to the tile.

  • logic (object) – The logic context for preset application.

redo()

Apply the new preset to the tile.

This method is called when the command is executed or redone.

undo()

Restore the tile to its previous state.

This method is called when the command is undone.