foundry.gui package#

Submodules#

foundry.gui.AboutWindow module#

class AboutDialog(parent)#

Bases: CustomDialog

staticMetaObject = PySide6.QtCore.QMetaObject("AboutDialog" inherits "CustomDialog": )#
class LinkLabel(parent, text)#

Bases: QLabel

staticMetaObject = PySide6.QtCore.QMetaObject("LinkLabel" inherits "QLabel": )#

foundry.gui.AutoSaveDialog module#

class AutoSaveDialog#

Bases: QMessageBox

staticMetaObject = PySide6.QtCore.QMetaObject("AutoSaveDialog" inherits "QMessageBox": )#

foundry.gui.AutoScrollDrawer module#

class AutoScrollDrawer(auto_scroll_row: int, level: Level)#

Bases: object

draw(painter: QPainter, block_length: int)#

foundry.gui.AutoScrollEditor module#

class AutoScrollEditor(parent, level_ref: LevelRef)#

Bases: CustomDialog

closeEvent(self, arg__1: PySide6.QtGui.QCloseEvent) None#
staticMetaObject = PySide6.QtCore.QMetaObject("AutoScrollEditor" inherits "CustomDialog": )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None

foundry.gui.BlockEditor module#

class BlockEditorController(parent: PySide6.QtWidgets.QWidget | None, tsa_data: bytearray, block_index: int, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: CustomChildWindow

property block_index: int#
block_index_changed: SignalInstance#
closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property graphics_set: GraphicsSet#
graphics_set_changed: SignalInstance#
property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
property palette_index: int#
palette_index_changed: SignalInstance#
silent_update_tsa_data(value: bytearray)#
staticMetaObject = PySide6.QtCore.QMetaObject("BlockEditorController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=tile_square_assembly_changed(PyObject), parameters=PyObject   #41 type=Signal, signature=block_index_changed(int), parameters=int   #42 type=Signal, signature=graphics_set_changed(PyObject), parameters=PyObject   #43 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject   #44 type=Signal, signature=palette_index_changed(int), parameters=int )#
tile_square_assembly_changed: SignalInstance#
property tsa_data: bytearray#
class BlockEditorModel(tile_square_assembly: bytearray, block_index: int, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: object

block_index: int#
graphics_set: GraphicsSet#
palette_group: PaletteGroup#
palette_index: int#
tile_square_assembly: bytearray#
class BlockEditorView(parent: PySide6.QtWidgets.QWidget | None, tsa_data: bytearray, block_index: int, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int, zoom: int = 16)#

Bases: QWidget

property block_scale: int#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
pattern_selected: SignalInstance#
resizeEvent(self, event: PySide6.QtGui.QResizeEvent) None#
staticMetaObject = PySide6.QtCore.QMetaObject("BlockEditorView" inherits "QWidget": Methods:   #34 type=Signal, signature=pattern_selected(PyObject), parameters=PyObject )#
property zoom: int#

foundry.gui.BlockViewer module#

class BlockViewerController(parent)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property palette_group: int#
palette_group_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("BlockViewerController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=tile_square_assembly_changed(PyObject), parameters=PyObject   #41 type=Signal, signature=tileset_changed(int), parameters=int   #42 type=Signal, signature=palette_group_changed(int), parameters=int )#
tile_square_assembly_changed: SignalInstance#
property tileset: int#
tileset_changed: SignalInstance#
property tsa_data: bytearray#
class BlockViewerModel(tileset: int, palette_group: int)#

Bases: object

palette_group: int#
tileset: int#
class BlockViewerView(parent, tileset=0, palette_group=0, zoom=2)#

Bases: QWidget

BLOCKS = 256#
BLOCKS_PER_COLUMN = 16#
BLOCKS_PER_ROW = 16#
property block_scale: int#
block_selected: SignalInstance#
mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
resizeEvent(self, event: PySide6.QtGui.QResizeEvent) None#
staticMetaObject = PySide6.QtCore.QMetaObject("BlockViewerView" inherits "QWidget": Methods:   #34 type=Signal, signature=block_selected(int), parameters=int )#
property zoom: int#

foundry.gui.ColorButtonWidget module#

class ColorButtonWidget(parent: PySide6.QtWidgets.QWidget | None, color: PySide6.QtGui.QColor | None = None, size: PySide6.QtCore.QSize | None = None, selected: bool = False)#

Bases: QLabel

clicked: SignalInstance#
property color: QColor#
color_changed: SignalInstance#
mouseReleaseEvent(self, ev: PySide6.QtGui.QMouseEvent) None#
property selected: bool#
selected_changed: SignalInstance#
property size_: QSize#
size_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("ColorButtonWidget" inherits "QLabel": Methods:   #47 type=Signal, signature=clicked()   #48 type=Signal, signature=size_changed(QSize), parameters=QSize   #49 type=Signal, signature=color_changed(QColor), parameters=QColor   #50 type=Signal, signature=selected_changed(bool), parameters=bool )#

foundry.gui.ColorSelector module#

class ColorSelector(parent: PySide6.QtWidgets.QWidget | None, title: str = 'NES Color Table', size: PySide6.QtCore.QSize | None = None, color_palette: foundry.core.palette.ColorPalette | None = None)#

Bases: CustomDialog

COLUMNS = 16#
ROWS = 4#
property last_selected_color_index: int#
ok_clicked: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("ColorSelector" inherits "CustomDialog": Methods:   #42 type=Signal, signature=ok_clicked(int), parameters=int )#

foundry.gui.ContextMenu module#

class CMAction(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

ADD_OBJECT = 2#
BACKGROUND = 7#
COPY = 4#
CUT = 6#
FOREGROUND = 8#
PASTE = 5#
REMOVE = 1#
class CMMode(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

BG = 1#
LIST = 3#
OBJ = 2#
class ContextMenu(level_ref: LevelRef)#

Bases: QMenu

as_background_menu() ContextMenu#
as_list_menu() ContextMenu#
as_object_menu() ContextMenu#
copied_objects_origin: Point#
get_all_menu_item_ids()#
get_copied_objects() tuple[list[foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject], foundry.core.geometry.Point]#
get_position() tuple[int, int]#
set_copied_objects(objects: list[foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject])#
set_position(point: QPoint)#
staticMetaObject = PySide6.QtCore.QMetaObject("ContextMenu" inherits "QMenu": )#

foundry.gui.CustomChildWindow module#

class CustomChildWindow(parent, title='Title')#

Bases: QMainWindow

keyPressEvent(self, event: PySide6.QtGui.QKeyEvent) None#
on_exit()#
staticMetaObject = PySide6.QtCore.QMetaObject("CustomChildWindow" inherits "QMainWindow": )#

foundry.gui.CustomDialog module#

class CustomDialog(parent, title='Title')#

Bases: QDialog

closeEvent(self, arg__1: PySide6.QtGui.QCloseEvent) None#
keyPressEvent(self, arg__1: PySide6.QtGui.QKeyEvent) None#
on_exit()#
staticMetaObject = PySide6.QtCore.QMetaObject("CustomDialog" inherits "QDialog": )#

foundry.gui.FlowLayout module#

class FlowLayout(parent=None)#

Bases: QLayout

addItem(self, arg__1: PySide6.QtWidgets.QLayoutItem) None#
clear()#
count(self) int#
expandingDirections(self) PySide6.QtCore.Qt.Orientation#
fromItems(items: list)#
hasHeightForWidth(self) bool#
heightForWidth(self, arg__1: int) int#
itemAt(self, index: int) PySide6.QtWidgets.QLayoutItem#
minimumSize(self) PySide6.QtCore.QSize#
removeItem(self, arg__1: PySide6.QtWidgets.QLayoutItem) None#
setGeometry(self, arg__1: PySide6.QtCore.QRect) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("FlowLayout" inherits "QLayout": )#
takeAt(self, index: int) PySide6.QtWidgets.QLayoutItem#

foundry.gui.HeaderEditor module#

class HeaderDisplay(parent: QWidget, data: LevelDataState, start: LevelStartState, graphics: LevelGraphicsState, warp: LevelWarpState, info: Level, level_bytes: bytearray, file_settings: FileSettings)#

Bases: QVBoxLayout

property current_page: int#

The current page accessed by the user.

Returns:
int

The index of the current page accessed.

property data: LevelDataState#

Provides the data of the level.

Returns:
LevelDataState

The data of the level.

data_editor: LevelDataEditor#
property graphics: LevelGraphicsState#

Provides the graphics of the level.

Returns:
LevelGraphicsState

The graphics of the level.

graphics_editor: LevelGraphicsEditor#
property info: Level#

Provides the info of the level.

Returns:
LevelInformationState

The info of the level.

info_editor: LevelInformationEditor#
property level_bytes: bytearray#

Provides the bytes for the level header.

Returns:
bytearray

The bytes for the level header.

property start: LevelStartState#

Provides the start of the level.

Returns:
LevelStartState

The start of the level.

start_editor: LevelStartEditor#
staticMetaObject = PySide6.QtCore.QMetaObject("HeaderDisplay" inherits "QVBoxLayout": )#
property warp: LevelWarpState#

Provides the warp of the level.

Returns:
LevelWarpState

The warp of the level.

warp_editor: LevelWarpEditor#
class HeaderEditor(parent: PySide6.QtWidgets.QWidget | None, state: HeaderState, file_settings: FileSettings, undo_controller: Optional[UndoController[HeaderState]] = None)#

Bases: CustomDialog

property action: int#

Provides the action the player starts at.

Returns:
int

The action the player starts at.

action_changed: SignalInstance#
property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

property current_page: int#

The current page accessed by the user.

Returns:
int

The index of the current page accessed.

property description: str#

Provides the description of the level.

Returns:
str

The description of the level.

description_changed: SignalInstance#
do(new_state: HeaderState) HeaderState#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateHeaderState

The new state to be stored.

Returns:
HeaderState

The new state that has been stored.

property enemy_palette: int#

Provides the enemy palette of this level.

Returns:
int

The enemy palette of for this level.

enemy_palette_changed: SignalInstance#
property enemy_space: int#

Provides the space for enemies inside of the level.

Returns:
int

The space for enemies inside of the level.

enemy_space_changed: SignalInstance#
property generator_palette: int#

Provides the generator palette of this level.

Returns:
int

The generator palette of for this level.

generator_palette_changed: SignalInstance#
property generator_space: int#

Provides the space for generators inside of the level.

Returns:
int

The space for generators inside of the level.

generator_space_changed: SignalInstance#
property graphics_set: int#

Provides the graphics set of this level.

Returns:
int

The graphics set of for this level.

graphics_set_changed: SignalInstance#
property horizontal: bool#

Provides if the level is horizontal.

Returns:
bool

If the level is horizontal.

horizontal_changed: SignalInstance#
property level_length: int#

Provides the length of the level.

Returns:
int

The length of the level.

level_length_changed: SignalInstance#
property music: int#

Provides the music of the level.

Returns:
int

The music of the level.

music_changed: SignalInstance#
property name: str#

Provides the name of the level.

Returns:
str

The name of the level.

name_changed: SignalInstance#
property next_level_enemy_pointer: int#

Provides the enemy pointer of the level that it will be warped to.

Returns:
int

The enemy pointer of the next level.

next_level_enemy_pointer_changed: SignalInstance#
property next_level_generator_pointer: int#

Provides the generator pointer of the level that it will be warped to.

Returns:
int

The generator pointer of the next level.

next_level_generator_pointer_changed: SignalInstance#
property next_level_tileset: int#

Provides the tileset of the level that it will be warped to.

Returns:
int

The tileset of the next level.

next_level_tileset_changed: SignalInstance#
property pipe_ends_level: bool#

Provides if entering a pipe will end the level.

Returns:
bool

If the entering pipes end the level.

pipe_ends_level_changed: SignalInstance#
redo() HeaderState#

Redoes the previously undone state.

Returns:
HeaderState

The new state that has been stored.

property scroll: int#

Provides the scroll of the level.

Returns:
int

The scroll of the level.

scroll_changed: SignalInstance#
property state: HeaderState#
state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("HeaderEditor" inherits "CustomDialog": Methods:   #42 type=Signal, signature=level_length_changed(int), parameters=int   #43 type=Signal, signature=music_changed(int), parameters=int   #44 type=Signal, signature=time_changed(int), parameters=int   #45 type=Signal, signature=scroll_changed(int), parameters=int   #46 type=Signal, signature=horizontal_changed(bool), parameters=bool   #47 type=Signal, signature=pipe_ends_level_changed(bool), parameters=bool   #48 type=Signal, signature=x_position_changed(int), parameters=int   #49 type=Signal, signature=y_position_changed(int), parameters=int   #50 type=Signal, signature=action_changed(int), parameters=int   #51 type=Signal, signature=generator_palette_changed(int), parameters=int   #52 type=Signal, signature=enemy_palette_changed(int), parameters=int   #53 type=Signal, signature=graphics_set_changed(int), parameters=int   #54 type=Signal, signature=next_level_generator_pointer_changed(int), parameters=int   #55 type=Signal, signature=next_level_enemy_pointer_changed(int), parameters=int   #56 type=Signal, signature=next_level_tileset_changed(int), parameters=int   #57 type=Signal, signature=name_changed(QString), parameters=QString   #58 type=Signal, signature=description_changed(QString), parameters=QString   #59 type=Signal, signature=generator_space_changed(int), parameters=int   #60 type=Signal, signature=enemy_space_changed(int), parameters=int   #61 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
property time: int#

Provides the time of the level.

Returns:
int

The time of the level.

time_changed: SignalInstance#
undo() HeaderState#

Undoes the last state, bring the previous.

Returns:
HeaderState

The new state that has been stored.

undo_controller: UndoController[HeaderState]#
property x_position: int#

Provides the x position the player starts at.

Returns:
int

The x position for the player starts at.

x_position_changed: SignalInstance#
property y_position: int#

Provides the y position the player starts at.

Returns:
int

The y position the player starts at.

y_position_changed: SignalInstance#
class HeaderState(data: LevelDataState, start: LevelStartState, graphics: LevelGraphicsState, warp: LevelWarpState, info: Level)#

Bases: object

The representation of a the level header.

Attributes:
data: LevelDataState

The miscellaneous level data.

start: LevelStartState

The starting conditions of the level.

graphics: LevelGraphicsState

The graphics of the level.

warp: LevelWarpState

The next level to be warped to.

info: LevelInformationState

The editor specific information associated with the level.

data: LevelDataState#
graphics: LevelGraphicsState#
info: Level#
start: LevelStartState#
warp: LevelWarpState#
header_state_to_level_header(state: HeaderState) bytearray#

Generates a 9-byte header for a level for SMB3 from a header state.

Parameters:
stateHeaderState

To be converted to a level header.

Returns:
bytearray

A series of nine bytes that represent a level header inside SMB3.

Notes

The format of the level header is as follows

Byte 0x02-1:

The next level’s generator pointer.

Byte 0x04-3:

The next level’s enemy pointer.

Byte 0x05:

The level length in increments of 16 followed by the y start of the player.

Byte 0x06:

The generator’s palette, enemy’s palette followed by the x start of the player.

Byte 0x07:

The tileset of the level, if the level is vertical, the type of scroll used by the level, followed by if the level ends when the player enters a pipe.

Byte 0x08:

The graphics set of the level followed by the starting action of the player.

Byte 0x09:

The music of the level followed by the time provided to the player.

level_to_header_state(level: Level, file_settings: FileSettings) HeaderState#

Generates a header state from a level.

Parameters:
levelLevel

To generate the header state from.

file_settings: FileSettings

To generate the level information from.

Returns:
HeaderState

The header state that corresponds to the level.

foundry.gui.HorizontalLine module#

class HorizontalLine#

Bases: QFrame

staticMetaObject = PySide6.QtCore.QMetaObject("HorizontalLine" inherits "QFrame": )#

foundry.gui.JumpCreator module#

class JumpCreator(level_view: LevelView, parent: PySide6.QtWidgets.QWidget | None = None)#

Bases: QWidget

add_jump(*args)#
show_jump_dest()#
staticMetaObject = PySide6.QtCore.QMetaObject("JumpCreator" inherits "QWidget": )#

foundry.gui.JumpEditor module#

class JumpEditor(parent: PySide6.QtWidgets.QWidget | None, jump: Jump, is_horizontal: bool, suggested_max_size: int = 15)#

Bases: CustomDialog

static edit_jump(parent: PySide6.QtWidgets.QWidget | None, jump: Jump, is_horizontal: bool, suggested_max_size: int = 15)#
on_ok()#
staticMetaObject = PySide6.QtCore.QMetaObject("JumpEditor" inherits "CustomDialog": )#

foundry.gui.JumpList module#

class JumpList(parent: QWidget, level_ref: LevelRef)#

Bases: QListWidget

add_jump: SignalInstance#
contextMenuEvent(self, arg__1: PySide6.QtGui.QContextMenuEvent) None#
delete()#
edit_jump: SignalInstance#
remove_jump: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("JumpList" inherits "QListWidget": Methods:   #105 type=Signal, signature=add_jump()   #106 type=Signal, signature=edit_jump()   #107 type=Signal, signature=remove_jump() )#
update(self, index: Union[PySide6.QtCore.QModelIndex, PySide6.QtCore.QPersistentModelIndex]) None#

foundry.gui.LevelDataEditor module#

class LevelDataDisplay(parent: PySide6.QtWidgets.QWidget | None, level_length: int, music: int, time: int, scroll: int, horizontal: bool, pipe_ends_level: bool)#

Bases: QFormLayout

property horizontal: bool#

Provides if the level is horizontal.

Returns:
bool

If the level is horizontal.

horizontal_editor: QCheckBox#
property level_length: int#

Provides the length of this level.

Returns:
int

The length of this level.

level_length_editor: QComboBox#
property music: int#

Provides the music of this level.

Returns:
int

The music of this level.

music_editor: QComboBox#
property pipe_ends_level: bool#

Provides if entering a pipe will end the level.

Returns:
bool

If entering a pipe will end the level.

pipe_ends_level_editor: QCheckBox#
property scroll: int#

Provides the scroll of this level.

Returns:
int

The scroll of this level.

scroll_editor: QComboBox#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelDataDisplay" inherits "QFormLayout": )#
property time: int#

Provides the time of this level.

Returns:
int

The time of this level.

time_editor: QComboBox#
class LevelDataEditor(parent: PySide6.QtWidgets.QWidget | None, state: LevelDataState, undo_controller: Optional[UndoController[LevelDataState]] = None)#

Bases: QWidget

property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

do(new_state: LevelDataState) LevelDataState#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateLevelDataState

The new state to be stored.

Returns:
LevelDataState

The new state that has been stored.

property horizontal: bool#

Provides if the level is horizontal.

Returns:
bool

If the level is horizontal.

horizontal_changed: SignalInstance#
property level_length: int#

Provides the length of the level.

Returns:
int

The length of the level.

level_length_changed: SignalInstance#
property music: int#

Provides the music of the level.

Returns:
int

The music of the level.

music_changed: SignalInstance#
property pipe_ends_level: bool#

Provides if entering a pipe will end the level.

Returns:
bool

If the entering pipes end the level.

pipe_ends_level_changed: SignalInstance#
redo() LevelDataState#

Redoes the previously undone state.

Returns:
LevelDataState

The new state that has been stored.

property scroll: int#

Provides the scroll of the level.

Returns:
int

The scroll of the level.

scroll_changed: SignalInstance#
property state: LevelDataState#

Provides the current state of the instance.

Returns:
LevelDataState

A tuple of the level length, music, time, scroll, and other data associated with the current instance’s level.

state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelDataEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=level_length_changed(int), parameters=int   #35 type=Signal, signature=music_changed(int), parameters=int   #36 type=Signal, signature=time_changed(int), parameters=int   #37 type=Signal, signature=scroll_changed(int), parameters=int   #38 type=Signal, signature=horizontal_changed(bool), parameters=bool   #39 type=Signal, signature=pipe_ends_level_changed(bool), parameters=bool   #40 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
property time: int#

Provides the time of the level.

Returns:
int

The time of the level.

time_changed: SignalInstance#
undo() LevelDataState#

Undoes the last state, bring the previous.

Returns:
LevelDataState

The new state that has been stored.

undo_controller: UndoController[LevelDataState]#
class LevelDataState(level_length: int, music: int, time: int, scroll: int, horizontal: bool, pipe_ends_level: bool)#

Bases: object

The representation of the start parameters for the player for a given level.

level_length: int

The length of the level.

music: int

The music selected for the level.

time: int

The time provided to the player to complete the level.

scroll: int

The rules applied to the scroll for the level.

horizontal: bool

If the level is horizontal.

pipe_ends_level: bool

If entering a pipe ends the level.

horizontal: bool#
level_length: int#
music: int#
pipe_ends_level: bool#
scroll: int#
time: int#

foundry.gui.LevelDrawer module#

COIN()#
CONTINUOUS_STAR()#
DOWN_ARROW()#
EMPTY_IMAGE()#
FIRE_FLOWER()#
INVISIBLE_1_UP()#
INVISIBLE_COIN()#
ITEM_ARROW()#
LEAF()#
LEFT_ARROW()#
class LevelDrawer(user_settings: UserSettings)#

Bases: object

draw(painter: QPainter, level: Level)#
MULTI_COIN()#
NORMAL_STAR()#
NO_JUMP()#
ONE_UP()#
P_SWITCH()#
RIGHT_ARROW()#
SILVER_COIN()#
UP_ARROW()#
VINE()#
load_namespace() Namespace#

foundry.gui.LevelGraphicsEditor module#

class LevelGraphicsDisplay(parent: PySide6.QtWidgets.QWidget | None, generator_palette: int, enemy_palette: int, graphics_set: int)#

Bases: QFormLayout

property enemy_palette: int#

Provides the enemy palette of this level.

Returns:
int

The enemy palette of for this level.

enemy_palette_editor: Spinner#
property generator_palette: int#

Provides the generator palette of this level.

Returns:
int

The generator palette of for this level.

generator_palette_editor: Spinner#
property graphics_set: int#

Provides the graphics_set of this level.

Returns:
int

The graphics_set of for this level.

graphics_set_editor: QComboBox#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelGraphicsDisplay" inherits "QFormLayout": )#
class LevelGraphicsEditor(parent: PySide6.QtWidgets.QWidget | None, state: LevelGraphicsState, undo_controller: Optional[UndoController[LevelGraphicsState]] = None)#

Bases: QWidget

property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

do(new_state: LevelGraphicsState) LevelGraphicsState#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateLevelGraphicsState

The new state to be stored.

Returns:
LevelGraphicsState

The new state that has been stored.

property enemy_palette: int#

Provides the enemy palette of this level.

Returns:
int

The enemy palette of for this level.

enemy_palette_changed: SignalInstance#
property generator_palette: int#

Provides the generator palette of this level.

Returns:
int

The generator palette of for this level.

generator_palette_changed: SignalInstance#
property graphics_set: int#

Provides the graphics set of this level.

Returns:
int

The graphics set of for this level.

graphics_set_changed: SignalInstance#
redo() LevelGraphicsState#

Redoes the previously undone state.

Returns:
LevelGraphicsState

The new state that has been stored.

property state: LevelGraphicsState#

Provides the current state of the instance.

Returns:
LevelGraphicsState

A tuple of the name, description, generator size, and enemy size for the current instance’s level.

state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelGraphicsEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=generator_palette_changed(int), parameters=int   #35 type=Signal, signature=enemy_palette_changed(int), parameters=int   #36 type=Signal, signature=graphics_set_changed(int), parameters=int   #37 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
undo() LevelGraphicsState#

Undoes the last state, bring the previous.

Returns:
LevelGraphicsState

The new state that has been stored.

undo_controller: UndoController[LevelGraphicsState]#
class LevelGraphicsState(generator_palette: int, enemy_palette: int, graphics_set: int)#

Bases: object

for this level for a level to warp to.

generator_palette: int

The generator palette for for this level.

enemy_palette: int

The enemy palette for for this level.

graphics_set: int

The graphics_set for for this level.

enemy_palette: int#
generator_palette: int#
graphics_set: int#

foundry.gui.LevelInformationEditor module#

class LevelInformationEditor(parent: PySide6.QtWidgets.QWidget | None, level: Level, undo_controller: Optional[UndoController[tuple[str, str, int, int]]] = None)#

Bases: QWidget

property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

property description: str#

Provides the description of the level.

Returns:
str

The description of the level.

description_changed: SignalInstance#
do(new_state: tuple[str, str, int, int]) tuple[str, str, int, int]#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateLevelDataState

The new state to be stored.

Returns:
LevelDataState

The new state that has been stored.

property enemy_space: int#

Provides the space for enemies inside of the level.

Returns:
int

The space for enemies inside of the level.

enemy_space_changed: SignalInstance#
property generator_space: int#

Provides the space for generators inside of the level.

Returns:
int

The space for generators inside of the level.

generator_space_changed: SignalInstance#
level: Level#
property name: str#

Provides the name of the level.

Returns:
str

The name of the level.

name_changed: SignalInstance#
redo() tuple[str, str, int, int]#

Redoes the previously undone state.

Returns:
LevelDataState

The new state that has been stored.

property state: tuple[str, str, int, int]#

Provides the current state of the instance.

Returns:
LevelDataState

A tuple of the name, description, generator size, and enemy size for the current instance’s level.

state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelInformationEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=name_changed(QString), parameters=QString   #35 type=Signal, signature=description_changed(QString), parameters=QString   #36 type=Signal, signature=generator_space_changed(int), parameters=int   #37 type=Signal, signature=enemy_space_changed(int), parameters=int   #38 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
undo() tuple[str, str, int, int]#

Undoes the last state, bring the previous.

Returns:
LevelDataState

The new state that has been stored.

undo_controller: UndoController[tuple[str, str, int, int]]#
class LevelInformationEditorDisplay(parent: PySide6.QtWidgets.QWidget | None, name: str, description: str, generator_space: int, enemy_space: int)#

Bases: QFormLayout

property description: str#

Provides the description of the level.

Returns:
str

The description of the level.

description_editor: QLineEdit#
property enemy_space: int#

Provides the space for enemies inside of the level.

Returns:
int

The space for enemies inside of the level.

enemy_space_editor: QSpinBox#
property generator_space: int#

Provides the space for generators inside of the level.

Returns:
int

The space for generators inside of the level.

generator_space_editor: QSpinBox#
property name: str#

Provides the name of the level.

Returns:
str

The name of the level.

name_editor: QLineEdit#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelInformationEditorDisplay" inherits "QFormLayout": )#

foundry.gui.LevelSelector module#

class LevelSelector(parent, file_settings: FileSettings, *, start_level: tuple[int, int] | None = None)#

Bases: QDialog

closeEvent(self, arg__1: PySide6.QtGui.QCloseEvent) None#
property current_level_index: tuple[int, int]#
keyPressEvent(self, arg__1: PySide6.QtGui.QKeyEvent) None#
on_level_click()#
on_ok(_=None)#
on_world_click()#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelSelector" inherits "QDialog": )#
class WorldMapLevelSelect(world_number: int)#

Bases: QScrollArea

accepted: SignalInstance#
level_selected: SignalInstance#
mouseDoubleClickEvent(self, arg__1: PySide6.QtGui.QMouseEvent) None#
mouseMoveEvent(self, arg__1: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, arg__1: PySide6.QtGui.QMouseEvent) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("WorldMapLevelSelect" inherits "QScrollArea": Methods:   #37 type=Signal, signature=level_selected(QString,int,int,int), parameters=QString, int, int, int   #38 type=Signal, signature=accepted() )#
select_by_world_and_level(world: int, level: int, levels: list[foundry.game.level.util.Level]) Level#

Selects a level by its world and level index.

Parameters:
worldint

The world the level is inside.

levelint

The index of the level inside the world.

levelslist[Level]

The list of levels to search.

Returns:
Level

The level at the world and index.

foundry.gui.LevelSizeBar module#

class LevelSizeBar(parent, label: str, current_value: int, maximum_value: int)#

Bases: QWidget

property current_value: int#
property maximum_value: int#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelSizeBar" inherits "QWidget": )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None
class SizeBar(parent: QWidget, current_value: int, maximum_value: int)#

Bases: QWidget

property current_value: int#
property display_color: QColor#
property maximum_value: int#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("SizeBar" inherits "QWidget": )#

foundry.gui.LevelStartEditor module#

class LevelStartDisplay(parent: PySide6.QtWidgets.QWidget | None, x_position: int, y_position: int, action: int)#

Bases: QFormLayout

property action: int#

Provides the action of this level.

Returns:
int

The action of for this level.

action_editor: QComboBox#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelStartDisplay" inherits "QFormLayout": )#
property x_position: int#

Provides the x position of this level.

Returns:
int

The x position of for this level.

x_position_editor: QComboBox#
property y_position: int#

Provides the y position of this level.

Returns:
int

The y position of for this level.

y_position_editor: QComboBox#
class LevelStartEditor(parent: PySide6.QtWidgets.QWidget | None, state: LevelStartState, undo_controller: Optional[UndoController[LevelStartState]] = None)#

Bases: QWidget

property action: int#

Provides the action the player starts at.

Returns:
int

The action the player starts at.

action_changed: SignalInstance#
property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

do(new_state: LevelStartState) LevelStartState#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateLevelStartState

The new state to be stored.

Returns:
LevelStartState

The new state that has been stored.

redo() LevelStartState#

Redoes the previously undone state.

Returns:
LevelStartState

The new state that has been stored.

property state: LevelStartState#

Provides the current state of the instance.

Returns:
LevelStartState

A tuple of the x position, y position, and action for the current instance’s level.

state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelStartEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=x_position_changed(int), parameters=int   #35 type=Signal, signature=y_position_changed(int), parameters=int   #36 type=Signal, signature=action_changed(int), parameters=int   #37 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
undo() LevelStartState#

Undoes the last state, bring the previous.

Returns:
LevelStartState

The new state that has been stored.

undo_controller: UndoController[LevelStartState]#
property x_position: int#

Provides the x position the player starts at.

Returns:
int

The x position for the player starts at.

x_position_changed: SignalInstance#
property y_position: int#

Provides the y position the player starts at.

Returns:
int

The y position the player starts at.

y_position_changed: SignalInstance#
class LevelStartState(x_position: int, y_position: int, action: int)#

Bases: object

The representation of the start parameters for the player for a given level.

x_position: int

The start position for the player.

y_position: int

The start position for the player.

action: int

The action the player starts the level doing.

action: int#
x_position: int#
y_position: int#

foundry.gui.LevelView module#

class LevelView(parent: PySide6.QtWidgets.QWidget | None, level: LevelRef, context_menu: ContextMenu, file_settings: FileSettings, user_settings: UserSettings)#

Bases: QWidget

add_enemy(enemy_index: int, point: Point, index: int) None#
add_jump()#
add_object(domain: int, obj_index: int, point: Point, length: int, index: int = -1) None#
create_enemy_at(point: Point)#
create_object_at(point: Point, domain: int = 0, object_index: int = 0) None#
dragEnterEvent(self, event: PySide6.QtGui.QDragEnterEvent) None#
dragLeaveEvent(self, event: PySide6.QtGui.QDragLeaveEvent) None#
dragMoveEvent(self, event: PySide6.QtGui.QDragMoveEvent) None#
drag_start_point: Point#
dragging_happened: bool#
dropEvent(self, event: PySide6.QtGui.QDropEvent) None#
get_object_names()#
get_selected_objects() list[foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject]#
last_mouse_position: Point#
level_safe_to_save() tuple[bool, str, str]#
make_screenshot() QPixmap#
mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mousePressEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
object_at(point: Point) foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject | None#

Returns an object at the supplied point relative to the level view.

Parameters:
pointPoint

The point of the object to return.

Returns:
LevelObject | EnemyObject | None

The object, if one is found at the supplied point.

object_created: SignalInstance#
objects_selected: SignalInstance#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
paste_objects_at(objects: list[foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject], origin: Point, point: foundry.core.geometry.Point | None = None)#
remove_jump(index: int)#
remove_object(obj)#
remove_selected_objects()#
replace_enemy(old_enemy: EnemyObject, enemy_index: int)#
replace_object(obj: LevelObject, domain: int, obj_index: int, length: int | None)#
resize_obj_start_point: Point#
resizing_happened: bool#
scroll_to_objects(objects: list[foundry.game.gfx.objects.LevelObject.LevelObject])#
select_all()#
select_objects(objects)#
selection_square: SelectionSquare#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelView" inherits "QWidget": Methods:   #34 type=Signal, signature=objects_selected(PyObject), parameters=PyObject   #35 type=Signal, signature=object_created(PyObject), parameters=PyObject )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None
user_settings: UserSettings#
wheelEvent(self, event: PySide6.QtGui.QWheelEvent) None#
zoom_in()#
zoom_out()#
undoable(func)#

foundry.gui.LevelWarpEditor module#

class LevelWarpDisplay(parent: PySide6.QtWidgets.QWidget | None, generator_pointer: int, enemy_pointer: int, tileset: int)#

Bases: QFormLayout

property enemy_pointer: int#

Provides the enemy pointer of the level that it will be warped to.

Returns:
int

The enemy pointer of the next level.

enemy_pointer_editor: Spinner#
property generator_pointer: int#

Provides the generator pointer of the level that it will be warped to.

Returns:
int

The generator pointer of the next level.

generator_pointer_editor: Spinner#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelWarpDisplay" inherits "QFormLayout": )#
property tileset: int#

Provides the tileset of the level that it will be warped to.

Returns:
int

The tileset of the next level.

tileset_editor: QComboBox#
class LevelWarpEditor(parent: PySide6.QtWidgets.QWidget | None, state: LevelWarpState, undo_controller: Optional[UndoController[LevelWarpState]] = None, file_settings: foundry.gui.settings.FileSettings | None = None)#

Bases: QWidget

property can_redo: bool#

Determines if there is any states inside the redo stack.

Returns:
bool

If there is an redo state available.

property can_undo: bool#

Determines if there is any states inside the undo stack.

Returns:
bool

If there is an undo state available.

do(new_state: LevelWarpState) LevelWarpState#

Does an action through the controller, adding it to the undo stack and clearing the redo stack, respectively.

Parameters:
new_stateLevelWarpState

The new state to be stored.

Returns:
LevelWarpState

The new state that has been stored.

property enemy_pointer: int#

Provides the enemy pointer of the level that it will be warped to.

Returns:
int

The enemy pointer of the next level.

enemy_pointer_changed: SignalInstance#
property generator_pointer: int#

Provides the generator pointer of the level that it will be warped to.

Returns:
int

The generator pointer of the next level.

generator_pointer_changed: SignalInstance#
redo() LevelWarpState#

Redoes the previously undone state.

Returns:
LevelWarpState

The new state that has been stored.

property state: LevelWarpState#

Provides the current state of the instance.

Returns:
LevelWarpState

A tuple of the name, description, generator size, and enemy size for the current instance’s level.

state_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("LevelWarpEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=generator_pointer_changed(int), parameters=int   #35 type=Signal, signature=enemy_pointer_changed(int), parameters=int   #36 type=Signal, signature=tileset_changed(int), parameters=int   #37 type=Signal, signature=state_changed(PyObject), parameters=PyObject )#
property tileset: int#

Provides the tileset of the level that it will be warped to.

Returns:
int

The tileset of the next level.

tileset_changed: SignalInstance#
undo() LevelWarpState#

Undoes the last state, bring the previous.

Returns:
LevelWarpState

The new state that has been stored.

undo_controller: UndoController[LevelWarpState]#
class LevelWarpState(generator_pointer: int, enemy_pointer: int, tileset: int)#

Bases: object

The next level for a level to warp to.

generator_pointer: int

The generator pointer for the next level.

enemy_pointer: int

The enemy pointer for the next level.

tileset: int

The tileset for the next level.

enemy_pointer: int#
generator_pointer: int#
tileset: int#

foundry.gui.MainWindow module#

class MainWindow(path_to_rom='', world=None, level=None, user_settings: foundry.gui.settings.UserSettings | None = None, gui_loader: foundry.gui.settings.GUILoader | None = None)#

Bases: QMainWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
level_selector_last_level: tuple[int, int] | None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
on_about(_)#
on_block_viewer(_)#
on_check_for_update()#
on_edit_autoscroll(_)#
on_header_editor(_)#
on_jump_edit()#
on_menu(action: QAction)#
on_menu_item_checked(action: QAction)#
on_object_viewer()#
on_open_m3l(_) bool#
on_open_rom(path_to_rom='', world: int | None = None, level: int | None = None) bool#
on_orb_options(_)#

Shows the Orb Options UI

on_palette_viewer(_)#
on_play()#

Copies the ROM, including the current level, to a temporary directory, saves the current level as level 1-1 and opens the rom in an emulator.

on_player_lives(_)#

Shows the Player Lives UI

on_player_viewer()#
on_save_m3l(_)#
on_save_rom(_)#
on_save_rom_as(_)#
on_screenshot(_) bool#
open_level_selector(_)#
reload_level()#
safe_to_change() bool#
save_m3l(pathname: str, m3l_bytes: bytearray)#
save_rom(is_save_as)#
staticMetaObject = PySide6.QtCore.QMetaObject("MainWindow" inherits "QMainWindow": )#
update_title()#

foundry.gui.ObjectDropdown module#

class ObjectDropdown(parent: QWidget)#

Bases: QComboBox

object_selected: SignalInstance#
select_object(level_object: ObjectLike)#

Called, when the current placeable object was selected from outside and we need to update the selection in the dropdown. This is not the selected object inside the level!

Parameters:

level_object – The type of object, that was selected to be placeable in the level.

setFocus(self) None#
setFocus(self, reason: PySide6.QtCore.Qt.FocusReason) None
set_tileset(tileset_index: int, graphic_set_index: int, bg_palette_index: int = 0, spr_palette_index: int = 0) None#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectDropdown" inherits "QComboBox": Methods:   #60 type=Signal, signature=object_selected(PyObject), parameters=PyObject )#

foundry.gui.ObjectIcon module#

class ObjectButton(parent: PySide6.QtWidgets.QWidget | None, item: T, background_color: bool = False)#

Bases: ObjectIcon

mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
object_created: SignalInstance#
selected: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectButton" inherits "ObjectIcon": Methods:   #34 type=Signal, signature=selected()   #35 type=Signal, signature=object_created() )#
class ObjectIcon(parent: PySide6.QtWidgets.QWidget | None, item: T, background_color: bool = False)#

Bases: QWidget, Generic[T]

property background_color: bool#
property item: T#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectIcon" inherits "QWidget": )#
class ObjectViewer(parent: PySide6.QtWidgets.QWidget | None, icon: foundry.gui.ObjectIcon.ObjectButton | None = None)#

Bases: QWidget

property icon: foundry.gui.ObjectIcon.ObjectButton | None#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectViewer" inherits "QWidget": )#
get_minimal_icon_object(level_object: T) T#

Returns the object with a length, so that every block is rendered. E. g. clouds with length 0, don’t have a face.

foundry.gui.ObjectList module#

class ObjectList(parent: QWidget, level_ref: LevelRef, context_menu: ContextMenu)#

Bases: QListWidget

mousePressEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, e: PySide6.QtGui.QMouseEvent) None#
on_right_down(event: QMouseEvent)#
on_right_up(event)#
on_selection_changed()#
selected_objects()#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectList" inherits "QListWidget": )#
update_content()#

A new item has been selected, so select the new item.

foundry.gui.ObjectStatusBar module#

class ObjectStatusBar(parent: QMainWindow, level_ref: LevelRef)#

Bases: QStatusBar

clear()#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectStatusBar" inherits "QStatusBar": )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None

foundry.gui.ObjectToolBar module#

class ObjectToolBar(parent=None)#

Bases: QWidget

add_recent_object(level_object: foundry.game.gfx.objects.EnemyItem.EnemyObject | foundry.game.gfx.objects.LevelObject.LevelObject)#
select_object(tab_index: int, object_index: int)#
selected: SignalInstance#
set_tileset(tileset_index: int, graphic_set_index: int = -1, bg_palette_index: int = 0, spr_palette_index: int = 0)#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectToolBar" inherits "QWidget": Methods:   #34 type=Signal, signature=selected(PyObject), parameters=PyObject )#

foundry.gui.ObjectToolBox module#

class ObjectToolBox(parent: PySide6.QtWidgets.QWidget | None = None)#

Bases: QWidget

add_from_enemy_set(tileset_index: int, spr_palette_index: int = 0)#
add_from_tileset(tileset_index: int, graphic_set_index: int = -1, bg_palette_index: int = 0)#
add_object(level_object: foundry.game.gfx.objects.EnemyItem.EnemyObject | foundry.game.gfx.objects.LevelObject.LevelObject)#
clear()#
property draw_background_color#
object_icon_clicked: SignalInstance#
object_placed: SignalInstance#
object_selected: SignalInstance#
place_at_front(object: foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject)#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectToolBox" inherits "QWidget": Methods:   #34 type=Signal, signature=object_icon_clicked(QWidget*), parameters=QWidget*   #35 type=Signal, signature=object_placed(QWidget*), parameters=QWidget*   #36 type=Signal, signature=object_selected(int), parameters=int )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None

foundry.gui.ObjectViewer module#

class BlockArea(image: QImage, index: int)#

Bases: QWidget

paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("BlockArea" inherits "QWidget": )#
class BlockArray(parent, level_object: LevelObject)#

Bases: QWidget

staticMetaObject = PySide6.QtCore.QMetaObject("BlockArray" inherits "QWidget": )#
update_object(level_object: LevelObject)#
class ObjectDrawArea(parent, tileset, graphic_set=1, palette_index=0)#

Bases: QWidget

change_graphic_set(graphic_set: int)#
change_tileset(tileset: int)#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
resize(self, arg__1: PySide6.QtCore.QSize) None#
resize(self, w: int, h: int) None
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectDrawArea" inherits "QWidget": )#
update_object(object_data: bytearray | foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.Jump.Jump | None = None)#
class ObjectViewer(parent)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
on_graphic_set()#
on_spin(_)#
on_tileset()#
set_object(domain: int, obj_index: int, secondary_length: int)#
set_object_and_graphic_set(tileset: int, graphics_set: int)#
staticMetaObject = PySide6.QtCore.QMetaObject("ObjectViewer" inherits "CustomChildWindow": )#

foundry.gui.PaletteEditorWidget module#

class PaletteEditorWidget(parent: PySide6.QtWidgets.QWidget | None, palette: Palette)#

Bases: PaletteWidget

staticMetaObject = PySide6.QtCore.QMetaObject("PaletteEditorWidget" inherits "PaletteWidget": )#

foundry.gui.PaletteGroupController module#

class PaletteGroupController(parent: PySide6.QtWidgets.QWidget | None, tileset: int = 0, bg_offset: int = 0, spr_offset: int = 0, bg_palette_group: foundry.core.palette.PaletteGroup | None = None, spr_palette_group: foundry.core.palette.PaletteGroup | None = None)#

Bases: QWidget

property changed: bool#
load_from_level(level: Level)#
on_palette_update()#
palette_group_changed: SignalInstance#
restore()#
save(rom: foundry.game.File.ROM | None = None)#
silent_update()#
staticMetaObject = PySide6.QtCore.QMetaObject("PaletteGroupController" inherits "QWidget": Methods:   #34 type=Signal, signature=palette_group_changed(PyObject,PyObject), parameters=PyObject, PyObject )#

foundry.gui.PaletteGroupEditor module#

class PaletteGroupEditor(parent: PySide6.QtWidgets.QWidget | None, palette_group: PaletteGroup)#

Bases: QWidget

property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("PaletteGroupEditor" inherits "QWidget": Methods:   #34 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject )#

foundry.gui.PaletteGroupModel module#

class PaletteGroupModel(tileset: int, background_index: int, sprite_index: int, background_palette_group: PaletteGroup, sprite_palette_group: PaletteGroup, changed: bool = False, background_palette_group_backup: foundry.core.palette.PaletteGroup | None = None, sprite_palette_group_backup: foundry.core.palette.PaletteGroup | None = None)#

Bases: object

background_index: int#
background_palette_group: PaletteGroup#
background_palette_group_backup: foundry.core.palette.PaletteGroup | None#
changed: bool#
restore()#
save(rom: foundry.game.File.ROM | None = None)#
soft_save()#
sprite_index: int#
sprite_palette_group: PaletteGroup#
sprite_palette_group_backup: foundry.core.palette.PaletteGroup | None#
tileset: int#

foundry.gui.PaletteViewer module#

class PaletteViewer(parent, level_ref: LevelRef)#

Bases: CustomDialog

palettes_per_row = 4#
staticMetaObject = PySide6.QtCore.QMetaObject("PaletteViewer" inherits "CustomDialog": )#

foundry.gui.PaletteWidget module#

class PaletteWidget(parent: PySide6.QtWidgets.QWidget | None, palette: Palette)#

Bases: QWidget

property palette: Palette#
palette_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("PaletteWidget" inherits "QWidget": Methods:   #34 type=Signal, signature=palette_changed(PyObject), parameters=PyObject )#

foundry.gui.PatternViewer module#

class PatternViewerController(parent: PySide6.QtWidgets.QWidget | None, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property graphics_set: GraphicsSet#
graphics_set_changed: SignalInstance#
property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
property palette_index: int#
palette_index_changed: SignalInstance#
pattern_selected: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("PatternViewerController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=graphics_set_changed(PyObject), parameters=PyObject   #41 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject   #42 type=Signal, signature=palette_index_changed(int), parameters=int   #43 type=Signal, signature=pattern_selected(int), parameters=int )#
class PatternViewerModel(graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: object

graphics_set: GraphicsSet#
palette_group: PaletteGroup#
palette_index: int#
class PatternViewerView(parent: PySide6.QtWidgets.QWidget | None, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int, zoom: int = 4)#

Bases: QWidget

PATTERNS = 256#
PATTERNS_PER_COLUMN = 16#
PATTERNS_PER_ROW = 16#
mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
property pattern_scale: int#
pattern_selected: SignalInstance#
resizeEvent(self, event: PySide6.QtGui.QResizeEvent) None#
staticMetaObject = PySide6.QtCore.QMetaObject("PatternViewerView" inherits "QWidget": Methods:   #34 type=Signal, signature=pattern_selected(int), parameters=int )#
property zoom: int#

foundry.gui.PlayerFrameEditor module#

class PlayerFrameEditorController(parent: PySide6.QtWidgets.QWidget | None, animation: PlayerAnimation, power_up_offsets: list[int], palette_group: PaletteGroup, is_mario: bool = True, title: str = 'Player Frame Editor', zoom: int = 2)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property frame: bytearray#
frames_changed: SignalInstance#
property is_mario: bool#
offset_changed: SignalInstance#
property page_offset: int#
property palette_group: PaletteGroup#
property power_up_offsets: list[int]#
property sprite_groups: list[foundry.core.drawable.SpriteGroup]#
staticMetaObject = PySide6.QtCore.QMetaObject("PlayerFrameEditorController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=frames_changed(PyObject), parameters=PyObject   #41 type=Signal, signature=offset_changed(int), parameters=int )#
class PlayerFrameEditorModel(animation: PlayerAnimation, power_up_offsets: list[int], palette_group: PaletteGroup, is_mario: bool)#

Bases: object

animation: PlayerAnimation#
is_mario: bool#
palette_group: PaletteGroup#
power_up_offsets: list[int]#
class PlayerFrameEditorView(parent: PySide6.QtWidgets.QWidget | None, sprite_groups: list[foundry.core.drawable.SpriteGroup], zoom: int = 2)#

Bases: QWidget

clicked: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("PlayerFrameEditorView" inherits "QWidget": Methods:   #34 type=Signal, signature=clicked(int,int), parameters=int, int )#
property zoom: int#

foundry.gui.PlayerViewer module#

class PlayerViewerController(parent: PySide6.QtWidgets.QWidget | None, title: str = 'Player Viewer', is_mario: bool = True, power_up: int = 0, power_up_offsets: list[int] | None = None, palette_group: foundry.core.palette.PaletteGroup | None = None, animations: list[foundry.core.player_animations.PlayerAnimation.PlayerAnimation] | None = None)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property is_mario: bool#
is_mario_changed: SignalInstance#
property palette: Palette#
property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
property power_up: int#
power_up_changed: SignalInstance#
property power_up_offset: int#
property power_up_offsets: list[int]#
power_up_offsets_changed: SignalInstance#
property sprite_groups: list[foundry.core.drawable.SpriteGroup]#
staticMetaObject = PySide6.QtCore.QMetaObject("PlayerViewerController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=power_up_changed(int), parameters=int   #41 type=Signal, signature=is_mario_changed(bool), parameters=bool   #42 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject   #43 type=Signal, signature=power_up_offsets_changed(PyObject), parameters=PyObject )#
class PlayerViewerModel(is_mario: bool, power_up: int, power_up_offsets: list[int], palette_group: PaletteGroup, animations: list[foundry.core.player_animations.PlayerAnimation.PlayerAnimation])#

Bases: object

animations: list[foundry.core.player_animations.PlayerAnimation.PlayerAnimation]#
classmethod from_bytes(is_mario: bool, power_up: int, power_up_offsets: bytes, palette_group: bytes, animations: bytes, page_offsets: bytes)#
classmethod from_rom(is_mario: bool = True, power_up: int = 0, power_up_offsets: list[int] | None = None, palette_group: foundry.core.palette.PaletteGroup | None = None, animations: list[foundry.core.player_animations.PlayerAnimation.PlayerAnimation] | None = None)#
is_mario: bool#
palette_group: PaletteGroup#
power_up: int#
power_up_offsets: list[int]#
to_bytes() tuple[bytes, bytes, bytes, bytes]#
class PlayerViewerView(parent: PySide6.QtWidgets.QWidget | None, sprite_groups: list[foundry.core.drawable.SpriteGroup], zoom: int = 2)#

Bases: QWidget

ANIMATIONS_PER_COLUMN = 9#
ANIMATIONS_PER_ROW = 9#
clicked: SignalInstance#
mouse_moved_over_widget: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("PlayerViewerView" inherits "QWidget": Methods:   #34 type=Signal, signature=mouse_moved_over_widget(int,int,int,QString), parameters=int, int, int, QString   #35 type=Signal, signature=clicked(int), parameters=int )#
property zoom: int#

foundry.gui.SelectionSquare module#

class SelectionSquare(start_point: Point = Point(x=0, y=0), end_point: Point = Point(x=0, y=0), is_active: bool = False, should_draw: bool = False)#

Bases: object

draw(painter: QPainter)#
end_point: Point#
get_adjusted_rect(scale_factor: Size) Rect#
is_active: bool#
property rect: Rect#
set_current_end(point: Point) None#
should_draw: bool#
start(point: Point) None#
start_point: Point#
stop()#

foundry.gui.SettingsDialog module#

class SettingsDialog(parent=None, user_settings: foundry.gui.settings.UserSettings | None = None, gui_loader: foundry.gui.settings.GUILoader | None = None)#

Bases: CustomDialog

gui_loader: GUILoader#
on_exit()#
staticMetaObject = PySide6.QtCore.QMetaObject("SettingsDialog" inherits "CustomDialog": )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None
user_settings: UserSettings#

foundry.gui.Spinner module#

class Spinner(parent, maximum=16777215, base=16)#

Bases: QSpinBox

staticMetaObject = PySide6.QtCore.QMetaObject("Spinner" inherits "QSpinBox": )#

foundry.gui.SpinnerPanel module#

class SpinnerPanel(parent: PySide6.QtWidgets.QWidget | None, level_ref: LevelRef)#

Bases: QWidget

clear_spinners()#
disable_all()#
enable_domain(enable: bool, value: int = 0)#
enable_length(enable: bool, value: int = 0)#
enable_type(enable: bool, value: int = 0)#
get_domain()#
get_length() int#
get_type()#
object_change: SignalInstance#
set_domain(domain: int)#
set_length(length: int)#
set_type(object_type: int)#
staticMetaObject = PySide6.QtCore.QMetaObject("SpinnerPanel" inherits "QWidget": Methods:   #34 type=Signal, signature=object_change(int), parameters=int   #35 type=Signal, signature=zoom_in_triggered()   #36 type=Signal, signature=zoom_out_triggered() )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None
zoom_in_triggered: SignalInstance#
zoom_out_triggered: SignalInstance#

foundry.gui.SpriteViewer module#

class SpriteViewerController(parent: PySide6.QtWidgets.QWidget | None, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: CustomChildWindow

closeEvent(self, event: PySide6.QtGui.QCloseEvent) None#
destroyed: SignalInstance#
property graphics_set: GraphicsSet#
graphics_set_changed: SignalInstance#
property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
property palette_index: int#
palette_index_changed: SignalInstance#
sprite_selected: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("SpriteViewerController" inherits "CustomChildWindow": Methods:   #40 type=Signal, signature=graphics_set_changed(PyObject), parameters=PyObject   #41 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject   #42 type=Signal, signature=palette_index_changed(int), parameters=int   #43 type=Signal, signature=sprite_selected(int), parameters=int )#
class SpriteViewerModel(graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int)#

Bases: object

graphics_set: GraphicsSet#
palette_group: PaletteGroup#
palette_index: int#
class SpriteViewerView(parent: PySide6.QtWidgets.QWidget | None, graphics_set: GraphicsSet, palette_group: PaletteGroup, palette_index: int, zoom: int = 4)#

Bases: QWidget

SPRITES = 32#
SPRITES_PER_COLUMN = 2#
SPRITES_PER_ROW = 16#
mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouse_moved: SignalInstance#
paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
resizeEvent(self, event: PySide6.QtGui.QResizeEvent) None#
sprite_selected: SignalInstance#
property sprite_size: Size#
staticMetaObject = PySide6.QtCore.QMetaObject("SpriteViewerView" inherits "QWidget": Methods:   #34 type=Signal, signature=sprite_selected(int), parameters=int   #35 type=Signal, signature=mouse_moved(int,int,int,QString), parameters=int, int, int, QString )#
property zoom: int#

foundry.gui.SpriteViewerWidget module#

class SpriteViewerWidget(parent: PySide6.QtWidgets.QWidget | None, sprite_group: SpriteGroup, zoom: int = 2, transparent: bool = True)#

Bases: QFrame

clicked: SignalInstance#
property graphics_set: GraphicsSet#
graphics_set_changed: SignalInstance#
mouseMoveEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouseReleaseEvent(self, event: PySide6.QtGui.QMouseEvent) None#
mouse_moved_over_widget: SignalInstance#
paintEvent(self, arg__1: PySide6.QtGui.QPaintEvent) None#
property palette_group: PaletteGroup#
palette_group_changed: SignalInstance#
sizeHint(self) PySide6.QtCore.QSize#
property sprites: tuple[foundry.core.drawable.Sprite, ...]#
sprites_changed: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("SpriteViewerWidget" inherits "QFrame": Methods:   #34 type=Signal, signature=sprites_changed()   #35 type=Signal, signature=graphics_set_changed(PyObject), parameters=PyObject   #36 type=Signal, signature=palette_group_changed(PyObject), parameters=PyObject   #37 type=Signal, signature=transparency_changed(bool), parameters=bool   #38 type=Signal, signature=zoom_changed(int), parameters=int   #39 type=Signal, signature=mouse_moved_over_widget(QMouseEvent*), parameters=QMouseEvent*   #40 type=Signal, signature=clicked(int,int), parameters=int, int )#
transparency_changed: SignalInstance#
property transparent: bool#
property zoom: int#
zoom_changed: SignalInstance#

foundry.gui.TabbedToolBox module#

class TabbedToolBox(parent=None)#

Bases: QTabWidget

add_recent_object(level_object: foundry.game.gfx.objects.EnemyItem.EnemyObject | foundry.game.gfx.objects.LevelObject.LevelObject)#
object_placed: SignalInstance#
select_object(tab_index: int, object_index: int) foundry.game.gfx.objects.LevelObject.LevelObject | foundry.game.gfx.objects.EnemyItem.EnemyObject#
selected: SignalInstance#
selected_index: SignalInstance#
set_tileset(tileset_index, graphic_set_index=-1, bg_palette_index: int = 0, spr_palette_index: int = 0)#
show_enemy_item_tab()#
show_level_object_tab()#
show_recent_tab()#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("TabbedToolBox" inherits "QTabWidget": Methods:   #43 type=Signal, signature=selected(QWidget*), parameters=QWidget*   #44 type=Signal, signature=selected_index(int,int), parameters=int, int   #45 type=Signal, signature=object_placed(QWidget*), parameters=QWidget* )#

foundry.gui.Toolbar module#

class Toolbar#

Bases: QToolBar

add_action(text: str, *args: Callable[[], Any], icon: PySide6.QtGui.QIcon | None = None) QAction#

Adds a toolbar option with text that will call *args when selected.

Parameters:
textstr

The text that will be displayed next to the option to select.

iconQIcon | None, optional

The icon that will be displayed next to the option, by default None will be displayed.

Returns:
QAction

The action associated with the toolbar option generated.

staticMetaObject = PySide6.QtCore.QMetaObject("Toolbar" inherits "QToolBar": )#
create_toolbar(parent: QMainWindow, name: str, widgets: list[PySide6.QtWidgets.QWidget] | None = None, area: PySide6.QtCore.Qt.ToolBarArea | None = None) QToolBar#

Creates a QToolbar with the default arguments for this repository.

Theses arguments include context menu policy, size policy, orientation, and floatable.

Parameters:
parentQMainWindow

The parent of the toolbar

namestr

The name of the toolbar

widgets: Optional[list[QWidget]]

The widgets to attach to the toolbar

Returns:
QToolBar

with the default arguments

foundry.gui.WarningList module#

class WarningLabel(text: str, related_objects: list[foundry.game.gfx.objects.LevelObject.LevelObject])#

Bases: QLabel

enterEvent(self, event: PySide6.QtGui.QEnterEvent) None#
hovered: SignalInstance#
staticMetaObject = PySide6.QtCore.QMetaObject("WarningLabel" inherits "QLabel": Methods:   #47 type=Signal, signature=hovered() )#
class WarningList(parent, level_ref: LevelRef, level_view_ref: LevelView, object_list_ref: ObjectList)#

Bases: QWidget

focusOutEvent(self, event: PySide6.QtGui.QFocusEvent) None#
show(self) None#
staticMetaObject = PySide6.QtCore.QMetaObject("WarningList" inherits "QWidget": Methods:   #34 type=Signal, signature=warnings_updated(bool), parameters=bool )#
update(self) None#
update(self, arg__1: PySide6.QtCore.QRect) None
update(self, arg__1: Union[PySide6.QtGui.QRegion, PySide6.QtGui.QBitmap, PySide6.QtGui.QPolygon, PySide6.QtCore.QRect]) None
update(self, x: int, y: int, w: int, h: int) None
warnings_updated: SignalInstance#

foundry.gui.WorldMapView module#

class WorldMapView(parent: PySide6.QtWidgets.QWidget | None, world: WorldMap)#

Bases: QWidget

paintEvent(self, event: PySide6.QtGui.QPaintEvent) None#
sizeHint(self) PySide6.QtCore.QSize#
staticMetaObject = PySide6.QtCore.QMetaObject("WorldMapView" inherits "QWidget": )#

foundry.gui.orb module#

Implements a UI to modify the player lives.

Supported editing various characteristics of the player lives such as the number of starting lives, the number of lives on continues, if a death lowers the life count, if a 1-up mushroom increases the life count, etc.

This UI uses a Redux pattern instead of MVC to increase the testability of the code. If you are if you want to try to reason about Redux in terms of MVC, then the Redux state is the model, the Redux reducer is the Controller, and obviously both still have a view.

class Actions(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

All user actions that can be performed.

MOVE_TIMER_TO_EXIT = '[Orb] MoveTimerToExit'#
MOVE_TOUCH_TO_TIMER = '[Orb] MoveTouchToTimer'#
TOUCH_GAME_TIMER_STOPS = '[Orb] TouchGameTimerStops'#
class Orb(parent)#

Bases: object

Main entry point from main menu.

This creates the Store, the View, and the RomInterface.

class RomInterface(rom: Rom)#

Bases: object

Handles all the read/write operations to the ROM.

This reads out the initial state of the ROM into a new State object. It can also take in a State object and write that into the ROM data.

class StrayOrb(rom: Rom)#

Bases: object

read() bool | None#
write(option: bool)#
read_state() State#

Reads the ROM and creates a cooresponding abstract State instance.

write_state(state: State)#

Takes in an abstract State instance, and writes to the ROM.

NOTE: This writes to the specified ROM which is not writing to the file itself. The caller/user is responsible for requesting the changes be saved to the file.

class State(move_touch_to_timer: bool | None, move_timer_to_exit: bool | None, touch_game_timer_stops: bool | None)#

Bases: object

Stores the current state of the UI

The initial state is read from the ROM. The final state is written to the ROM. The intermediate values are stored in this state object while the user is modifying them.

NOTE: Some of these values may be optional/None if the search for these code regions fails when reading to the ROM. Invalid values written to the state may also be rejected when trying to write the state to the ROM.

move_timer_to_exit: bool | None#
move_touch_to_timer: bool | None#
touch_game_timer_stops: bool | None#
class Store(state: S)#

Bases: ReduxStore[State]

Concrete implementation of the ReduxStore for the PlayerLives UI

class View(parent, store: Store, rom_interface: RomInterface)#

Bases: CustomDialog

WARNING_STYLE = 'QLabel { background-color : pink; }'#
render()#

Updates the UI with the current state values.

This function is the subscriber to the store so that whenever there is a state change in the system, this render function is called automatically and the new state is rendered on screen.

rom_interface: RomInterface#
staticMetaObject = PySide6.QtCore.QMetaObject("View" inherits "CustomDialog": )#
store: Store#

foundry.gui.player_lives module#

Implements a UI to modify the player lives.

Supported editing various characteristics of the player lives such as the number of starting lives, the number of lives on continues, if a death lowers the life count, if a 1-up mushroom increases the life count, etc.

This UI uses a Redux pattern instead of MVC to increase the testability of the code. If you are if you want to try to reason about Redux in terms of MVC, then the Redux state is the model, the Redux reducer is the Controller, and obviously both still have a view.

class ActionNames(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: Enum

All user actions that can be performed.

CARD_GAME_1UP = '[PlayerLives] CardGame'#
CONTINUE_LIVES = '[PlayerLives] ContinueLives'#
DEATH_TAKES_LIVES = '[PlayerLives] DeathTakesLives'#
DICE_GAME_1UP = '[PlayerLives] DiceGame'#
END_CARD_1UP = '[PlayerLives] EndCard'#
HUNDRED_COINS_1UP = '[PlayerLives] 100Coins'#
LOAD = '[PlayerLives] Load'#
MUSHROOM_1UP = '[PlayerLives] Mushroom'#
ROULETTE_1UP = '[PlayerLives] Roulette'#
STARTING_LIVES = '[PlayerLives] StartingLives'#
class PlayerLives(parent)#

Bases: object

Main entry point from main menu.

This creates the Store, the View, and the RomInterface.

class RomInterface(rom: Rom)#

Bases: object

Handles all the read/write operations to the ROM.

This reads out the initial state of the ROM into a new State object. It can also take in a State object and write that into the ROM data.

read_state() State#

Reads the ROM and creates a cooresponding abstract State instance.

write_state(state: State)#

Takes in an abstract State instance, and writes to the ROM.

NOTE: This writes to the specified ROM which is not writing to the file itself. The caller/user is responsible for requesting the changes be saved to the file.

class State(starting_lives: int, continue_lives: int, death_takes_lives: bool, hundred_coins_1up: bool, end_card_1up: bool, mushroom_1up: bool, dice_game_1up: bool, roulette_1up: bool, card_game_1up: bool)#

Bases: object

Stores the current state of the UI

The initial state is read from the ROM. The final state is written to the ROM. The intermediate values are stored in this state object while the user is modifying them.

NOTE: Some of these values may be optional/None if the search for these code regions fails when reading to the ROM. Invalid values written to the state may also be rejected when trying to write the state to the ROM.

card_game_1up: bool#
continue_lives: int#
death_takes_lives: bool#
dice_game_1up: bool#
end_card_1up: bool#
hundred_coins_1up: bool#
mushroom_1up: bool#
roulette_1up: bool#
starting_lives: int#
class Store(state: S)#

Bases: ReduxStore[State]

Concrete implementation of the ReduxStore for the PlayerLives UI

class View(parent, store: Store, rom_interface: RomInterface)#

Bases: CustomDialog

WARNING_STYLE = 'QLabel { background-color : pink; }'#
render()#

Updates the UI with the current state values.

This function is the subscriber to the store so that whenever there is a state change in the system, this render function is called automatically and the new state is rendered on screen.

rom_interface: RomInterface#
staticMetaObject = PySide6.QtCore.QMetaObject("View" inherits "CustomDialog": )#
store: Store#

foundry.gui.settings module#

class FileSettings(levels: list[foundry.game.level.util.Level] = NOTHING)#

Bases: object

Settings dedicated to a specific file.

Attributes:
levels: list[Level]

The list of all levels contained inside the file.

levels: list[foundry.game.level.util.Level]#
pydantic model GUILoader#

Bases: BaseModel

Show JSON schema
{
   "title": "GUILoader",
   "type": "object",
   "properties": {
      "style": {
         "title": "Style",
         "type": "object",
         "additionalProperties": {
            "type": "string"
         }
      }
   },
   "required": [
      "style"
   ]
}

Config:
  • use_enum_values: bool = True

Fields:
field style: dict[foundry.gui.settings.GUIStyle, str] [Required]#
load_style(style: GUIStyle)#
class GUIStyle(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

A declaration of the possible GUI Styles offered by Foundry.

DARK_AMBER = 'DARK AMBER'#
DARK_BLUE = 'DARK BLUE'#
DARK_CYAN = 'DARK CYAN'#
DARK_GREEN = 'DARK GREEN'#
DARK_PINK = 'DARK PINK'#
DARK_PURPLE = 'DARK PURPLE'#
DARK_RED = 'DARK RED'#
DARK_TEAL = 'DARK TEAL'#
DARK_YELLOW = 'DARK YELLOW'#
LIGHT_AMBER = 'LIGHT AMBER'#
LIGHT_BLUE = 'LIGHT BLUE'#
LIGHT_CYAN = 'LIGHT CYAN'#
LIGHT_GREEN = 'LIGHT GREEN'#
LIGHT_PINK = 'LIGHT PINK'#
LIGHT_PURPLE = 'LIGHT PURPLE'#
LIGHT_RED = 'LIGHT RED'#
LIGHT_TEAL = 'LIGHT TEAL'#
LIGHT_YELLOW = 'LIGHT YELLOW'#
pydantic model PydanticFileSettings#

Bases: BaseModel

Show JSON schema
{
   "title": "PydanticFileSettings",
   "type": "object",
   "properties": {
      "levels": {
         "title": "Levels",
         "type": "array",
         "items": {
            "$ref": "#/definitions/PydanticLevel"
         }
      }
   },
   "required": [
      "levels"
   ],
   "definitions": {
      "PydanticLocation": {
         "title": "PydanticLocation",
         "description": "A representation of a location of a level.\n\nworld: int\n    The world the level is located inside.\nindex: int\n    The index the level is inside the world.",
         "type": "object",
         "properties": {
            "world": {
               "title": "World",
               "type": "integer"
            },
            "index": {
               "title": "Index",
               "type": "integer"
            }
         },
         "required": [
            "world",
            "index"
         ]
      },
      "PydanticDisplayInformation": {
         "title": "PydanticDisplayInformation",
         "description": "The display information to nicely sort levels.\n\nAttributes\n----------\nname: Optional[str]\n    The name of the level.\ndescription: Optional[str]\n    The description of the level.\nlocations: list[PydanticLocation]\n    The locations that the level is inside.",
         "type": "object",
         "properties": {
            "name": {
               "title": "Name",
               "type": "string"
            },
            "description": {
               "title": "Description",
               "type": "string"
            },
            "locations": {
               "title": "Locations",
               "type": "array",
               "items": {
                  "$ref": "#/definitions/PydanticLocation"
               }
            }
         },
         "required": [
            "locations"
         ]
      },
      "PydanticLevel": {
         "title": "PydanticLevel",
         "description": "The representation of a level inside the game.\n\nAttributes\n----------\ndisplay_information: PydanticDisplayInformation\n    Useful information regarding the level to make it human usable.\ngenerator_pointer: int\n    The location this level's generators are located at.\nenemy_pointer: int\n    The location this level's enemies are located at.\ntileset: int\n    The tileset of the this level.\ngenerator_size: int\n    The amount of space the generator data takes inside the game.\nenemy_size: int\n    The amount of space the enemy data takes inside the game.",
         "type": "object",
         "properties": {
            "display_information": {
               "$ref": "#/definitions/PydanticDisplayInformation"
            },
            "generator_pointer": {
               "title": "Generator Pointer",
               "type": "integer"
            },
            "enemy_pointer": {
               "title": "Enemy Pointer",
               "type": "integer"
            },
            "tileset": {
               "title": "Tileset",
               "type": "integer"
            },
            "generator_size": {
               "title": "Generator Size",
               "type": "integer"
            },
            "enemy_size": {
               "title": "Enemy Size",
               "type": "integer"
            }
         },
         "required": [
            "display_information",
            "generator_pointer",
            "enemy_pointer",
            "tileset",
            "generator_size",
            "enemy_size"
         ]
      }
   }
}

Fields:
field levels: list[foundry.game.level.util.PydanticLevel] [Required]#
pydantic model PydanticUserSettings#

Bases: BaseModel

Show JSON schema
{
   "title": "PydanticUserSettings",
   "type": "object",
   "properties": {
      "gui_style": {
         "default": "LIGHT BLUE",
         "allOf": [
            {
               "$ref": "#/definitions/GUIStyle"
            }
         ]
      },
      "instaplay_emulator": {
         "title": "Instaplay Emulator",
         "default": "fceux",
         "type": "string"
      },
      "instaplay_arguments": {
         "title": "Instaplay Arguments",
         "default": "%f",
         "type": "string"
      },
      "default_powerup": {
         "title": "Default Powerup",
         "default": 0,
         "type": "integer"
      },
      "default_power_has_star": {
         "title": "Default Power Has Star",
         "default": false,
         "type": "boolean"
      },
      "default_starting_world": {
         "title": "Default Starting World",
         "default": 0,
         "type": "integer"
      },
      "resize_mode": {
         "default": "LMB",
         "allOf": [
            {
               "$ref": "#/definitions/ResizeModes"
            }
         ]
      },
      "draw_mario": {
         "title": "Draw Mario",
         "default": true,
         "type": "boolean"
      },
      "draw_jumps": {
         "title": "Draw Jumps",
         "default": false,
         "type": "boolean"
      },
      "draw_grid": {
         "title": "Draw Grid",
         "default": false,
         "type": "boolean"
      },
      "draw_expansion": {
         "title": "Draw Expansion",
         "default": false,
         "type": "boolean"
      },
      "draw_jump_on_objects": {
         "title": "Draw Jump On Objects",
         "default": true,
         "type": "boolean"
      },
      "draw_items_in_blocks": {
         "title": "Draw Items In Blocks",
         "default": true,
         "type": "boolean"
      },
      "draw_invisible_items": {
         "title": "Draw Invisible Items",
         "default": true,
         "type": "boolean"
      },
      "draw_autoscroll": {
         "title": "Draw Autoscroll",
         "default": false,
         "type": "boolean"
      },
      "block_transparency": {
         "title": "Block Transparency",
         "default": true,
         "type": "boolean"
      },
      "object_scroll_enabled": {
         "title": "Object Scroll Enabled",
         "default": false,
         "type": "boolean"
      },
      "object_tooltip_enabled": {
         "title": "Object Tooltip Enabled",
         "default": true,
         "type": "boolean"
      }
   },
   "definitions": {
      "GUIStyle": {
         "title": "GUIStyle",
         "description": "\n    A declaration of the possible GUI Styles offered by Foundry.\n    ",
         "enum": [
            "DARK AMBER",
            "DARK BLUE",
            "DARK CYAN",
            "DARK GREEN",
            "DARK PINK",
            "DARK PURPLE",
            "DARK RED",
            "DARK TEAL",
            "DARK YELLOW",
            "LIGHT AMBER",
            "LIGHT BLUE",
            "LIGHT CYAN",
            "LIGHT GREEN",
            "LIGHT PINK",
            "LIGHT PURPLE",
            "LIGHT RED",
            "LIGHT TEAL",
            "LIGHT YELLOW"
         ],
         "type": "string"
      },
      "ResizeModes": {
         "title": "ResizeModes",
         "description": "\n    A declaration of the possible resize modes accepted by the editor.\n    ",
         "enum": [
            "LMB",
            "RMB"
         ],
         "type": "string"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field block_transparency: bool = True#
field default_power_has_star: bool = False#
field default_powerup: int = 0#
field default_starting_world: int = 0#
field draw_autoscroll: bool = False#
field draw_expansion: bool = False#
field draw_grid: bool = False#
field draw_invisible_items: bool = True#
field draw_items_in_blocks: bool = True#
field draw_jump_on_objects: bool = True#
field draw_jumps: bool = False#
field draw_mario: bool = True#
field gui_style: GUIStyle = GUIStyle.LIGHT_BLUE#
field instaplay_arguments: str = '%f'#
field instaplay_emulator: str = 'fceux'#
field object_scroll_enabled: bool = False#
field object_tooltip_enabled: bool = True#
field resize_mode: ResizeModes = ResizeModes.RESIZE_LEFT_CLICK#
to_user_settings() UserSettings#

Generates a user setting.

Returns:
UserSettings

The representation of this instance as a user setting.

class ResizeModes(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

A declaration of the possible resize modes accepted by the editor.

RESIZE_LEFT_CLICK = 'LMB'#
RESIZE_RIGHT_CLICK = 'RMB'#
class UserSettings(gui_style: GUIStyle = GUIStyle.LIGHT_BLUE, instaplay_emulator: str = 'fceux', instaplay_arguments: str = '%f', default_powerup: int = 0, default_power_has_star: bool = False, default_starting_world: int = 0, resize_mode: ResizeModes = ResizeModes.RESIZE_LEFT_CLICK, draw_mario: bool = True, draw_jumps: bool = False, draw_grid: bool = False, draw_expansion: bool = False, draw_jump_on_objects: bool = True, draw_items_in_blocks: bool = True, draw_invisible_items: bool = True, draw_autoscroll: bool = False, block_transparency: bool = True, object_scroll_enabled: bool = False, object_tooltip_enabled: bool = True)#

Bases: object

The settings for the user for Foundry.

Attributes:
gui_style: GUIStyle

The style used for the GUI.

instaplay_emulator: str

The path to the emulator.

instaplay_arguments: str

Any additional arguments passed to the emulator.

default_powerup: int

The default powerup to start the player with for testing.

default_power_has_star: bool

If the player will start with a star for testing.

default_starting_world: int

Which world the player will start in for testing.

resize_mode: ResizeModes

Determines how generators can be expanded.

draw_mario: bool

Draws the start location of Mario.

draw_jumps: bool

Draws the warp indexes of the level.

draw_grid: bool

Draws a grid for the level.

draw_expansion: bool

Draws the ways generators can expand.

draw_jump_on_objects: bool

Draws if an generator will warp the player.

draw_items_in_blocks: bool

Draw any items located inside a generator.

draw_invisible_items: bool

Draw invisible items.

draw_autoscroll: bool

Draws autoscroll routes.

block_transparency: bool

Causes generators to be drawn with transparency.

object_scroll_enabled: bool

Enables the editing of generators through the use of the scroll wheel.

object_tooltip_enabled: bool

Enables tooltips for generators.

block_transparency: bool#
default_power_has_star: bool#
default_powerup: int#
default_starting_world: int#
draw_autoscroll: bool#
draw_expansion: bool#
draw_grid: bool#
draw_invisible_items: bool#
draw_items_in_blocks: bool#
draw_jump_on_objects: bool#
draw_jumps: bool#
draw_mario: bool#
gui_style: GUIStyle#
instaplay_arguments: str#
instaplay_emulator: str#
object_scroll_enabled: bool#
object_tooltip_enabled: bool#
resize_mode: ResizeModes#
load_file_settings(file_id: str) FileSettings#

Attempts to load the file settings for a given file. If none exists, then the default file settings will be utilized instead.

Parameters:
file_idstr

The file name for the file settings.

Returns:
FileSettings

The file settings that best match the provided file.

load_gui_loader() GUILoader#

Generates mappings to load the possible GUI styles.

Returns:
GUILoader

The loader for the GUI styles.

load_settings(file_path: Path = PosixPath('/home/runner/.smb3foundry/settings')) UserSettings#

Provides the user settings.

Returns:
UserSettings

The current user settings.

save_file_settings(file_id: str, file_settings: FileSettings)#

Saves file settings to a file.

Parameters:
file_idstr

The file to save the settings for.

file_settingsFileSettings

The settings to save.

save_settings(user_settings: UserSettings)#

Saves the user settings to a file.

Parameters:
user_settingsUserSettings

The user settings to save.

set_style(theme)#
to_pydantic_file_settings(file_settings: FileSettings) PydanticFileSettings#

Converts file settings to its pydantic equivelant.

Parameters:
file_settingsFileSettings

The file settings to convert.

Returns:
PydanticFileSettings

The pydantic equivelant of the file settings provided.

user_setting_to_json(user_setting: UserSettings, path: str)#

foundry.gui.util module#

pydantic model BoxLayout#

Bases: LayoutMeta

A layout which the widgets are laid in a linear fashion in a single direction.

Attributes:
widgets: list[WidgetCreator]

A list of widgets that are inside the layout, which will start from the origin to the layout’s ending point.

Show JSON schema
{
   "title": "BoxLayout",
   "description": "A layout which the widgets are laid in a linear fashion in a single direction.\n\nAttributes\n----------\nwidgets: list[WidgetCreator]\n    A list of widgets that are inside the layout, which will start from the origin to the\n    layout's ending point.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/LayoutType"
      },
      "widgets": {
         "title": "Widgets",
         "type": "array",
         "items": {
            "$ref": "#/definitions/WidgetCreator"
         }
      }
   },
   "required": [
      "type",
      "widgets"
   ],
   "definitions": {
      "LayoutType": {
         "title": "LayoutType",
         "description": "\n    A declaration of the layouts possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "HORIZONTAL",
            "VERTICLE",
            "FORM"
         ],
         "type": "string"
      },
      "WidgetCreator": {
         "title": "WidgetCreator",
         "description": "A generator for a :class:`~foundry.gui.util.Widget`.  Creates the widget dynamically from\nits type attribute to provide it additional information required to be a subclass of\nwidget.\n\nFor example a widget of type button will become a button, instead of a plain widget.",
         "type": "object",
         "properties": {}
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field widgets: list[foundry.gui.util.WidgetCreator] [Required]#
get_widgets() list[foundry.gui.util.Widget]#

A helper function to get the list of widgets with the correct typing hint.

Returns:
list[Widget]

The list of widgets as defined in self.widgets.

pydantic model Button#

Bases: Widget

A button representation of PySide6.QtWidgets.QPushButton.

Attributes:
name: str

The text that appears on the button.

action: Optional[str]

The name of the callable that will be acted upon when clicked.

Show JSON schema
{
   "title": "Button",
   "description": "A button representation of :class:`PySide6.QtWidgets.QPushButton`.\n\nAttributes\n----------\nname: str\n    The text that appears on the button.\naction: Optional[str]\n    The name of the callable that will be acted upon when clicked.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/WidgetType"
      },
      "parent_attribute_name": {
         "title": "Parent Attribute Name",
         "type": "string"
      },
      "what_is_this": {
         "$ref": "#/definitions/WhatIsThis"
      },
      "name": {
         "title": "Name",
         "type": "string"
      },
      "action": {
         "title": "Action",
         "type": "string"
      }
   },
   "required": [
      "type"
   ],
   "definitions": {
      "WidgetType": {
         "title": "WidgetType",
         "description": "\n    A declaration of the widgets possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "BUTTON",
            "SPINNER"
         ],
         "type": "string"
      },
      "WhatIsThis": {
         "title": "WhatIsThis",
         "description": "A generic representation of the what's this description.  This enables a multi-line\ndescription to easily transfer from JSON and similar formats.\n\nAttributes\n----------\nelements: list[str]\n    A list of strings that represent each line of the description.",
         "type": "object",
         "properties": {
            "elements": {
               "title": "Elements",
               "type": "array",
               "items": {
                  "type": "string"
               }
            }
         },
         "required": [
            "elements"
         ]
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field action: str | None = None#
field name: str [Optional]#
pydantic model Form#

Bases: BaseModel

A layout which sets a series of widgets adjacent to their respective labels.

Attributes:
label: str

The description of the following widget to its side.

widget: WidgetCreator

The widget that is displayed in the given form.

Show JSON schema
{
   "title": "Form",
   "description": "A layout which sets a series of widgets adjacent to their respective labels.\n\nAttributes\n----------\nlabel: str\n    The description of the following widget to its side.\nwidget: WidgetCreator\n    The widget that is displayed in the given form.",
   "type": "object",
   "properties": {
      "label": {
         "title": "Label",
         "type": "string"
      },
      "widget": {
         "$ref": "#/definitions/WidgetCreator"
      }
   },
   "required": [
      "label",
      "widget"
   ],
   "definitions": {
      "WidgetCreator": {
         "title": "WidgetCreator",
         "description": "A generator for a :class:`~foundry.gui.util.Widget`.  Creates the widget dynamically from\nits type attribute to provide it additional information required to be a subclass of\nwidget.\n\nFor example a widget of type button will become a button, instead of a plain widget.",
         "type": "object",
         "properties": {}
      }
   }
}

Fields:
field label: str [Required]#
field widget: WidgetCreator [Required]#
get_widget() Widget#

A helper function to get the widget with the correct typing hint.

Returns:
Widget

The widget as defined in self.widget.

pydantic model FormLayout#

Bases: LayoutMeta

A layout which widgets are adjacent to their respective labels.

Attributes:
forms: list[Form]

The respective forms that compose the layout with their respective widgets and labels.

Show JSON schema
{
   "title": "FormLayout",
   "description": "A layout which widgets are adjacent to their respective labels.\n\nAttributes\n----------\nforms: list[Form]\n    The respective forms that compose the layout with their respective widgets and labels.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/LayoutType"
      },
      "forms": {
         "title": "Forms",
         "type": "array",
         "items": {
            "$ref": "#/definitions/Form"
         }
      }
   },
   "required": [
      "type",
      "forms"
   ],
   "definitions": {
      "LayoutType": {
         "title": "LayoutType",
         "description": "\n    A declaration of the layouts possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "HORIZONTAL",
            "VERTICLE",
            "FORM"
         ],
         "type": "string"
      },
      "WidgetCreator": {
         "title": "WidgetCreator",
         "description": "A generator for a :class:`~foundry.gui.util.Widget`.  Creates the widget dynamically from\nits type attribute to provide it additional information required to be a subclass of\nwidget.\n\nFor example a widget of type button will become a button, instead of a plain widget.",
         "type": "object",
         "properties": {}
      },
      "Form": {
         "title": "Form",
         "description": "A layout which sets a series of widgets adjacent to their respective labels.\n\nAttributes\n----------\nlabel: str\n    The description of the following widget to its side.\nwidget: WidgetCreator\n    The widget that is displayed in the given form.",
         "type": "object",
         "properties": {
            "label": {
               "title": "Label",
               "type": "string"
            },
            "widget": {
               "$ref": "#/definitions/WidgetCreator"
            }
         },
         "required": [
            "label",
            "widget"
         ]
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field forms: list[foundry.gui.util.Form] [Required]#
pydantic model Layout#

Bases: BaseModel

A helper class to allow for easier use of LayoutCreator as it does not provide type hints.

Attributes:
layout: LayoutCreator

The layout creator, which generates the layout automatically in accordance to layout creator.

Show JSON schema
{
   "title": "Layout",
   "description": "A helper class to allow for easier use of :class:`~foundry.gui.util.LayoutCreator` as\nit does not provide type hints.\n\nAttributes\n----------\nlayout: LayoutCreator\n    The layout creator, which generates the layout automatically in accordance to layout\n    creator.",
   "type": "object",
   "properties": {
      "layout": {
         "$ref": "#/definitions/LayoutCreator"
      }
   },
   "required": [
      "layout"
   ],
   "definitions": {
      "LayoutCreator": {
         "title": "LayoutCreator",
         "description": "A generator for a :class:`~foundry.gui.util.LayoutMeta`.  Creates the layout dynamically\nfrom its type attribute to provide it additional information required to be a subclass of\nlayout.\n\nFor example a layout of type horizontal will become a box layout, instead of a plain layout.",
         "type": "object",
         "properties": {}
      }
   }
}

Fields:
field layout: LayoutCreator [Required]#
get_layout() LayoutMeta#

A helper method that provides correct typing hints for layout.

Returns:
LayoutMeta

The LayoutMeta as described in self.layout.

pydantic model LayoutCreator#

Bases: BaseModel

A generator for a LayoutMeta. Creates the layout dynamically from its type attribute to provide it additional information required to be a subclass of layout.

For example a layout of type horizontal will become a box layout, instead of a plain layout.

Show JSON schema
{
   "title": "LayoutCreator",
   "description": "A generator for a :class:`~foundry.gui.util.LayoutMeta`.  Creates the layout dynamically\nfrom its type attribute to provide it additional information required to be a subclass of\nlayout.\n\nFor example a layout of type horizontal will become a box layout, instead of a plain layout.",
   "type": "object",
   "properties": {}
}

classmethod generate_layout(v: dict) LayoutMeta#

The constructor for each specific layout.

Parameters:
vdict

The dictionary to create the layout.

Returns:
LayoutMeta

The created layout as defined by v[“type”]

Raises:
NotImplementedError

If the constructor does not have a valid constructor for v[“type”].

classmethod validate(v)#

Validates that the provided object is a valid LayoutMeta.

Parameters:
vdict

The dictionary to create the layout.

Returns:
Widget

If validated, a layout will be created in accordance to generate_layout.

Raises:
TypeError

If a dictionary is not provided.

TypeError

If the dictionary does not contain the key “type”.

TypeError

If the type provided is not inside LayoutType.

pydantic model LayoutMeta#

Bases: BaseModel

A generic representation of QLayout.

Attributes:
type: LayoutType

The type of layout this layout represents. This determines how constructors will treat the layout, often providing it additional parameters.

Show JSON schema
{
   "title": "LayoutMeta",
   "description": "A generic representation of :class:`~PySide6.QtWidgets.QLayout`.\n\nAttributes\n----------\ntype: LayoutType\n    The type of layout this layout represents.  This determines how constructors\n    will treat the layout, often providing it additional parameters.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/LayoutType"
      }
   },
   "required": [
      "type"
   ],
   "definitions": {
      "LayoutType": {
         "title": "LayoutType",
         "description": "\n    A declaration of the layouts possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "HORIZONTAL",
            "VERTICLE",
            "FORM"
         ],
         "type": "string"
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field type: LayoutType [Required]#
class LayoutType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

A declaration of the layouts possible to be created through JSON and Pydantic.

form = 'FORM'#
classmethod has_value(value)#

A convenience method to quickly determine if a value is a valid enumeration.

Parameters:
valuestr

The value to check against the enumeration.

Returns:
bool

If the value is inside the enumeration.

horizontal = 'HORIZONTAL'#
verticle = 'VERTICLE'#
pydantic model Spinner#

Bases: Widget

A spinner representation of PySide6.QtWidgets.QSpinBox.

Attributes:
enabled: bool

Decides if the spinner will be activated on start.

minimum: Optional[int]

Will provide a lower bound that will be applied to the spinner, if present.

maximum: Optional[int]

Will provide an upper bound that will be applied to the spinner, if present.

hexadecimal: bool

Decides if the spinner should use hex as its base.

value_change_action: Optional[str]

The name of the callable that will be acted upon when the value changes.

Show JSON schema
{
   "title": "Spinner",
   "description": "A spinner representation of :class:`PySide6.QtWidgets.QSpinBox`.\n\n\nAttributes\n----------\nenabled: bool\n    Decides if the spinner will be activated on start.\nminimum: Optional[int]\n    Will provide a lower bound that will be applied to the spinner, if present.\nmaximum: Optional[int]\n    Will provide an upper bound that will be applied to the spinner, if present.\nhexadecimal: bool\n    Decides if the spinner should use hex as its base.\nvalue_change_action: Optional[str]\n    The name of the callable that will be acted upon when the value changes.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/WidgetType"
      },
      "parent_attribute_name": {
         "title": "Parent Attribute Name",
         "type": "string"
      },
      "what_is_this": {
         "$ref": "#/definitions/WhatIsThis"
      },
      "enabled": {
         "title": "Enabled",
         "default_factor": "default=True extra={}",
         "type": "boolean"
      },
      "minimum": {
         "title": "Minimum",
         "type": "integer"
      },
      "maximum": {
         "title": "Maximum",
         "type": "integer"
      },
      "hexadecimal": {
         "title": "Hexadecimal",
         "default_factor": "default=False extra={}",
         "type": "boolean"
      },
      "value_change_action": {
         "title": "Value Change Action",
         "type": "string"
      }
   },
   "required": [
      "type",
      "enabled",
      "hexadecimal"
   ],
   "definitions": {
      "WidgetType": {
         "title": "WidgetType",
         "description": "\n    A declaration of the widgets possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "BUTTON",
            "SPINNER"
         ],
         "type": "string"
      },
      "WhatIsThis": {
         "title": "WhatIsThis",
         "description": "A generic representation of the what's this description.  This enables a multi-line\ndescription to easily transfer from JSON and similar formats.\n\nAttributes\n----------\nelements: list[str]\n    A list of strings that represent each line of the description.",
         "type": "object",
         "properties": {
            "elements": {
               "title": "Elements",
               "type": "array",
               "items": {
                  "type": "string"
               }
            }
         },
         "required": [
            "elements"
         ]
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field enabled: bool [Required]#
field hexadecimal: bool [Required]#
field maximum: int | None = None#
field minimum: int | None = None#
field value_change_action: str | None = None#
pydantic model WhatIsThis#

Bases: BaseModel

A generic representation of the what’s this description. This enables a multi-line description to easily transfer from JSON and similar formats.

Attributes:
elements: list[str]

A list of strings that represent each line of the description.

Show JSON schema
{
   "title": "WhatIsThis",
   "description": "A generic representation of the what's this description.  This enables a multi-line\ndescription to easily transfer from JSON and similar formats.\n\nAttributes\n----------\nelements: list[str]\n    A list of strings that represent each line of the description.",
   "type": "object",
   "properties": {
      "elements": {
         "title": "Elements",
         "type": "array",
         "items": {
            "type": "string"
         }
      }
   },
   "required": [
      "elements"
   ]
}

Fields:
field elements: list[str] [Required]#
property description: str#

The description of the what’s this field in its entirety.

Returns:
str

The description of what the object is.

pydantic model Widget#

Bases: BaseModel

A generic representation of QWidget.

Attributes:
type: WidgetType

The type of widget this widget represents. This determines how constructors will treat the widget, often providing it additional parameters.

parent_attribute_name: Optional[str]

If provided, will be used to set this widget to its parent’s name.

what_is_this: Optional[WhatIsThis]

The type hint for the given widget, if provided.

Show JSON schema
{
   "title": "Widget",
   "description": "A generic representation of :class:`~PySide6.QtWidgets.QWidget`.\n\nAttributes\n----------\ntype: WidgetType\n    The type of widget this widget represents.  This determines how constructors\n    will treat the widget, often providing it additional parameters.\nparent_attribute_name: Optional[str]\n    If provided, will be used to set this widget to its parent's name.\nwhat_is_this: Optional[WhatIsThis]\n    The type hint for the given widget, if provided.",
   "type": "object",
   "properties": {
      "type": {
         "$ref": "#/definitions/WidgetType"
      },
      "parent_attribute_name": {
         "title": "Parent Attribute Name",
         "type": "string"
      },
      "what_is_this": {
         "$ref": "#/definitions/WhatIsThis"
      }
   },
   "required": [
      "type"
   ],
   "definitions": {
      "WidgetType": {
         "title": "WidgetType",
         "description": "\n    A declaration of the widgets possible to be created through\n    `JSON <https://en.wikipedia.org/wiki/JSON>`_ and\n    `Pydantic <https://pydantic-docs.helpmanual.io/>`_.\n    ",
         "enum": [
            "BUTTON",
            "SPINNER"
         ],
         "type": "string"
      },
      "WhatIsThis": {
         "title": "WhatIsThis",
         "description": "A generic representation of the what's this description.  This enables a multi-line\ndescription to easily transfer from JSON and similar formats.\n\nAttributes\n----------\nelements: list[str]\n    A list of strings that represent each line of the description.",
         "type": "object",
         "properties": {
            "elements": {
               "title": "Elements",
               "type": "array",
               "items": {
                  "type": "string"
               }
            }
         },
         "required": [
            "elements"
         ]
      }
   }
}

Config:
  • use_enum_values: bool = True

Fields:
field parent_attribute_name: str | None = None#
field type: WidgetType [Required]#
field what_is_this: foundry.gui.util.WhatIsThis | None = None#
pydantic model WidgetCreator#

Bases: BaseModel

A generator for a Widget. Creates the widget dynamically from its type attribute to provide it additional information required to be a subclass of widget.

For example a widget of type button will become a button, instead of a plain widget.

Show JSON schema
{
   "title": "WidgetCreator",
   "description": "A generator for a :class:`~foundry.gui.util.Widget`.  Creates the widget dynamically from\nits type attribute to provide it additional information required to be a subclass of\nwidget.\n\nFor example a widget of type button will become a button, instead of a plain widget.",
   "type": "object",
   "properties": {}
}

classmethod generate_widget(v: dict) Widget#

The constructor for each specific widget.

Parameters:
vdict

The dictionary to create the widget.

Returns:
Widget

The created widget as defined by v[“type”].

Raises:
NotImplementedError

If the constructor does not have a valid constructor for v[“type”].

classmethod validate(v: dict) Widget#

Validates that the provided object is a valid Widget.

Parameters:
vdict

The dictionary to create the widget.

Returns:
Widget

If validated, a widget will be created in accordance to generate_widget.

Raises:
TypeError

If a dictionary is not provided.

TypeError

If the dictionary does not contain the key “type”.

TypeError

If the type provided is not inside WidgetType.

class WidgetType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#

Bases: str, Enum

A declaration of the widgets possible to be created through JSON and Pydantic.

button = 'BUTTON'#
classmethod has_value(value: str) bool#

A convenience method to quickly determine if a value is a valid enumeration.

Parameters:
valuestr

The value to check against the enumeration.

Returns:
bool

If the value is inside the enumeration.

spinner = 'SPINNER'#
clear_layout(layout)#
create_widget(parent: QWidget, meta: Widget) QWidget#

Creates a widget from a Widget, providing its actual implementation.

Parameters:
parentQWidget

The widget which houses the widget’s actions.

metaWidget

The instance that holds the widget’s attributes.

Returns:
QWidget

The created instance of a QWidget in accordance to meta.

Raises:
NotImplementedError

If the constructor does not implement a valid implementation for a given meta.type.

ease_color(color1: QColor, color2: QColor, amount: float) QColor#

Eases between two colors, providing a combination of the two.

Parameters:
color1QColor

The color which will be displayed with respect to amount.

color2QColor

The color which will be displayed with respect to 1 - amount.

amountfloat

The amount as a decimal, where 1 represents everything and 0 represents nothing, that color1 will be shown and color2 will not.

Returns:
QColor

The intermediary color from color1 and color2.

setup_description(parent: QWidget, flags: dict)#

Generates any descriptions for a widget. Most commonly the what’s this field.

Parameters:
parentQWidget

The widget to apply the description to.

flagsdict

The dict that describes the description.

setup_layout(parent: QWidget, flags: dict) QLayout#

Creates a layout from a series of flags and a parent. The layout will pass any events automatically to the parent and will work identically to one created through code.

Parameters:
parentQWidget

The parent of the layout. Typically the layout becomes the main layout of the parent.

flagsdict

The dict that described the layout.

Returns:
QLayout

The instance of the well formed layout.

Raises:
NotImplementedError

If the provided meta.type is not implemened.

setup_widget_menu(widget: QMainWindow, flags, user_settings: UserSettings)#
setup_window(widget: QMainWindow, flags, user_settings: UserSettings)#

Module contents#