foundry.graphic_editor package#
Submodules#
foundry.graphic_editor.Canvas module#
- class Canvas(model: BaseModel, parent: foundry.core.gui.Object | None = None, *args, **kwargs)#
Bases:
GridMouseHandler
,Widget
- class Model(bitmap: ndarray[Any, dtype[ScalarType]] = NOTHING, bitmap_palette: Palette = NOTHING, zoom: int = 16)#
Bases:
BaseModel
- bitmap: NDArray#
- property bitmap#
- property bitmap_palette#
- click_released: SignalInstance[MouseEvent] = Signal(subscribers=[], name='click_released', _dead_subscribers=False)#
- click_released_grid: SignalInstance[MouseEvent] = Signal(subscribers=[], name='click_released_grid', _dead_subscribers=False)#
- clicked: SignalInstance[MouseEvent] = Signal(subscribers=[], name='clicked', _dead_subscribers=False)#
- clicked_grid: SignalInstance[MouseEvent] = Signal(subscribers=[], name='clicked_grid', _dead_subscribers=False)#
- cursor_moved: SignalInstance[MouseEvent] = Signal(subscribers=[], name='cursor_moved', _dead_subscribers=False)#
- cursor_moved_grid: SignalInstance[MouseEvent] = Signal(subscribers=[], name='cursor_moved_grid', _dead_subscribers=False)#
- double_clicked: SignalInstance[MouseEvent] = Signal(subscribers=[], name='double_clicked', _dead_subscribers=False)#
- double_clicked_grid: SignalInstance[MouseEvent] = Signal(subscribers=[], name='double_clicked_grid', _dead_subscribers=False)#
- draw_point(point: Point, color: int | foundry.core.palette.Color)#
- grid_scale_updated: SignalInstance[Size] = Signal(subscribers=[], name='grid_scale_updated', _dead_subscribers=False)#
- grid_size_updated: SignalInstance[Size] = Signal(subscribers=[], name='grid_size_updated', _dead_subscribers=False)#
- staticMetaObject = PySide6.QtCore.QMetaObject("Canvas" inherits "Widget": )#
- updated: SignalInstance[BaseModel] = Signal(subscribers=[], name='updated', _dead_subscribers=False)#
- wheel_moved: SignalInstance[MouseWheelEvent] = Signal(subscribers=[], name='wheel_moved', _dead_subscribers=False)#
- property zoom#
foundry.graphic_editor.GraphicEditor module#
- class GraphicEditor(path: str | None, parent: Any = None, *args, **kwargs)#
Bases:
MainWindow
- display_settings_dialog()#
- initialize_state(path: str | None, user_settings: foundry.gui.settings.UserSettings | None = None, gui_loader: foundry.gui.settings.GUILoader | None = None)#
Required actions for an undo and redo controller on initialize_state up.
Notes
This does not use __init__ to be compatible with Object.
- staticMetaObject = PySide6.QtCore.QMetaObject("GraphicEditor" inherits "MainWindow": )#
- property updated: SignalInstance[str | None]#
- ask_user_to_select_file(parent: QWidget) str | None #
Asks the user to select a ROM file.
- Parameters:
- parentQWidget
The parent to make the dialog from.
- Returns:
- str | None
The path the user selected, otherwise None.
- open_file(parent: QWidget, path: str | None = None) str | None #
Opens the ROM file provided from the user or requests that they select another path.
- Parameters:
- parentQWidget
The parent to make the dialogs from.
- pathstr | None, optional
The path to default the user to, by default None
- Returns:
- str | None
The path the user selected, None if the ROM failed to load.
foundry.graphic_editor.PatternEditor module#
foundry.graphic_editor.PatternMatrix module#
- class PatternMatrix(size: Size, default: int = 0)#
Bases:
object
A matrix of pattern indexes that is intelligently resizes and mutates pattern index data.
- Attributes:
- size: Size
The size of the matrix.
- default: int = 0
The value that will be filled when a value is initialized.
- get_index(point: Point) int #
Gets the index of a pattern inside the matrix to the pattern at point.
- Parameters:
- pointPoint
The point inside the matrix to get.
- Returns:
- int
The value of the pattern index at point inside the matrix.
- Raises:
- IndexError
If point is not inside the matrix.
- is_inside(point: Point) bool #
Determines if point is inside size.
- Parameters:
- point: Point
The point to evaluate.
- Returns:
- bool
If point is inside the matrix.
- resize(size: Size)#
Resizes the matrix to account for a different size.
- Parameters:
- sizeSize
The new size of the matrix.
Notes
- When resizing to a smaller size, the data will still be stored. If rexpanding to this size,
the old data will be retained.
When resizing to a larger width, the right will be expanded with default. When resizing to a larger height, the bottom will be expanded with default.
Examples
>>> a = PatternMatrix(Size(2, 2), 0) array([ [0, 0], [0, 0] ]) >>> a.default = 1 >>> a.resize(Size(2, 1)) array([[0, 0]]) >>> a.resize(Size(2, 3)) array([ [0, 0], [0, 0], [1, 1] ]) >>> a.default = 2 >>> a.resize(Size(3, 3)) array([ [0, 0, 2], [0, 0, 2], [1, 1, 2] ])
foundry.graphic_editor.PatternViewer module#
- class PatternViewerController(parent: PySide6.QtWidgets.QWidget | None, groups: list[foundry.core.graphics_page.GraphicsGroup.GraphicsGroup], group_indexes: list[int], palette_group: PaletteGroup, palette_index: int, zoom: int = 4)#
Bases:
QWidget
- PATTERNS = 256#
- PATTERNS_PER_COLUMN = 16#
- PATTERNS_PER_ROW = 16#
- property graphics_set: GraphicsSet#
- normalize_point(point: foundry.core.geometry.Point | PySide6.QtCore.QPoint) Point #
- property palette_group: PaletteGroup#
- pattern_selected: SignalInstance#
- patterns_changed: SignalInstance#
- staticMetaObject = PySide6.QtCore.QMetaObject("PatternViewerController" inherits "QWidget": Methods: #34 type=Signal, signature=patterns_changed() #35 type=Signal, signature=pattern_selected(int), parameters=int #36 type=Signal, signature=status_message_changed() )#
- status_message_changed: SignalInstance#
- class PatternViewerModel(groups: list[foundry.core.graphics_page.GraphicsGroup.GraphicsGroup], group_indexes: list[int], palette_group: PaletteGroup, palette_index: int, zoom: int)#
Bases:
object
- palette_group: PaletteGroup#
foundry.graphic_editor.internal_plugins module#
- class CommonIcons(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
-
- FOLDER = 'folder_icon'#
- HELP = 'help_icon'#
- PLAY = 'play_icon'#
- REDO = 'redo_icon'#
- SAVE = 'save_icon'#
- SETTINGS = 'settings_icon'#
- UNDO = 'undo_icon'#
- ZOOM_IN = 'zoom_in_icon'#
- ZOOM_OUT = 'zoom_out_icon'#
- classmethod to_icon(icon: CommonIcons) QIcon #
foundry.graphic_editor.main module#
- main(path: str | None = None)#
Starts the graphical application with path specified from the user.
- Parameters:
- pathstr | None, optional
The path to the ROM to edit, by default None
- start()#
The starting point to the command line application for the graphical editor.
Notes
The options are as follows:
- -h, --help
Show a help message and exit
- --path PATH
The path to the ROM
- --dev, --no-dev
Override path with system path to SMB3_TEST_ROM, by default False