JCAP Integrated Development Environment (JIDE) Documentation

Main JIDE Class

class jide.jide[source]

This is the primary class which serves as the glue for JIDE.

This class interfaces between the various canvases, pixel and color palettes, centralized data source, and data output routines.

setupWindow()[source]

Entry point to set up primary window attributes

setupDocks()[source]

Set up pixel palette, color palette, and tile map docks

setupToolbar()[source]

Set up graphics tools toolbar

setupTabs()[source]

Set up main window sprite/tile/tile map tabs

setupActions()[source]

Set up main menu actions

setupStatusBar()[source]

Set up bottom status bar

setCopyActive(active)[source]

Set whether the copy action is available

Parameters

active (bool) – Variable representing whether copy action should be set to available or unavailable

setPasteActive(active)[source]

Set whether the paste action is available

Parameters

active (bool) – Variable representing whether paste action should be set to available or unavailable

selectFile()[source]

Open file action to hand file handle to GameData

loadProject(file_name)[source]

Load project file data and populate UI elements/set up signals and slots

setCanvas(index)[source]

Set the dock and signal/slot layout to switch between sprite/tile/ tile map tabs

Parameters

index (int) – Index of canvas tab

genDATFiles()[source]

Generate .dat files from project for use by JCAP

genPixelDATFile(source, path)[source]

Generate sprite/tile pixel palette .dat file

Parameters
  • source (list) – List containing sprite/tile pixel data

  • path (str) – File path to .dat

genColorDATFile(source, path)[source]

Generate sprite/tile color palette .dat file

Parameters
  • source (list) – List containing sprite/tile color data

  • path (str) – File path to .dat

loadJCAP()[source]

Generate .dat files and execute command-line serial loading of JCAP

Game Data Management

class gamedata.ColorPalettes(data, source, parent=None)[source]

Data container for sprite/tile color palettes

Parameters
  • data (list(dict)) – List containing JSON color palette data

  • source (Source) – Subject source of palette, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

keys()[source]

Retrieve color palette dict keys

Returns

Color palette dict keys

Return type

odict_keys

values()[source]

Retrieve color palette dict values

Returns

Color palette dict values

Return type

odict_values

items()[source]

Retrieve color palette dict items

Returns

Color palette dict items

Return type

odict_items

setName(cur_name, new_name)[source]

Sets the names of a color palette

Parameters
  • cur_name (str) – Name of target color palette

  • new_name (str) – New name for color palette

addPalette(name, contents, index=None)[source]

Add a new color palette

Parameters
  • name (str) – New color palette name

  • contents (list(QColor)) – New color palette contents

  • index (int, optional) – Index in palettes to insert new palette, defaults to None

remPalette(name)[source]

Removes color palette

Parameters

name (str) – Name of color palette to be removed

class gamedata.PixelPalettes(data, source, parent=None)[source]

Data container for sprite/tile pixel palettes

Parameters
  • data (list(dict)) – List containing JSON pixel palette data

  • source (Source) – Subject source of palette, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

batchUpdate()[source]

Updates the pixel palette date based on self.update_manifest

getPalettes()[source]

Returns the pixel palettes

Returns

Pixel palettes

Return type

list(list)

addRow(row=None)[source]

Adds a row of sprites/tiles to palette

Parameters

row (list(list), optional) – Row data to be added, defaults to None

remRow()[source]

Removes a row of sprites/tiles from the palette

Returns

The removed row

Return type

list(list)

class gamedata.GameData(data, parent=None)[source]

Represents centralized data object for JIDE, containing all sprite/tile/ tile map data and CRUD functions

Parameters
  • data (dict) – Dict containing project JSON data

  • parent (QWidget, optional) – Parent widget, defaults to None

getPixelPalettes(source)[source]

Retrieve sprite/tile pixel palettes

Parameters

source (Source) – Subject source of palettes, either sprite or tile

Returns

Pixel palettes

Return type

list

getElement(index, source)[source]

Retrieve a sprite/tile pixel value

Parameters
  • index (tuple(int, int, int)) – Index/row/col of pixel

  • source (Source) – Subject source of pixel, either sprite or tile

Returns

Pixel value at index

Return type

int

getColPals(source)[source]

Retrieve sprite/tile color palettes

Parameters

source (Source) – Subject source of palettes, either sprite or tile

Returns

Color palettes of target source

Return type

list

getColPalNames(source)[source]

Retrieve sprite/tile color palette names

Parameters

source (Source) – Subject source of palette names, either sprite or tile

Returns

Names of target source color palettes

Return type

list

getColPal(name, source)[source]

Retrieve a specific sprite/tile color palette

Parameters
  • name (str) – Name of color palette to retrieve

  • source (Source) – Subject source of palette, either sprite or tile

Returns

Color palette specified by name

Return type

list

setColor(name, index, color, source, orig=None)[source]

Sets a color in a specific color palette

Parameters
  • name (str) – Name of color palette containing target color

  • index (int) – Index of color in color palette

  • color (QColor) – New color to be set to

  • source (Source) – Subject source of target palette, either sprite or tile

  • orig (QColor, optional) – Original color of the target color, defaults to None

previewColor(name, index, color, source)[source]

Previews a color without committing it to the data; used by colorpalette.ColorPreview

Parameters
  • name (str) – Name of color palette containing target color

  • index (int) – Index of color in color palette

  • color (QColor) – Color to preview

  • source (Source) – Subject source of target palette, either sprite or tile

setColPalName(cur_name, new_name, source)[source]

Set name of a color palette

Parameters
  • cur_name (str) – Current name of target color palette

  • new_name (str) – New name for target palette

  • source (Source) – Subject source of target palette, either sprite or tile

addColPal(name, source)[source]

Add a new color palette

Parameters
  • name (str) – Name for the new color palette

  • source (Source) – Subject source of new palette, either sprite or tile

remColPal(name, source)[source]

Remove a color palette

Parameters
  • name (str) – Name for the target color palette

  • source (Source) – Subject source of target palette, either sprite or tile

setPixBatch(batch, source)[source]

Sets pixels to new values based on the contents of a set of pixel deltas

Parameters
  • batch (defaultdict) – Set of pixel deltas represented by pixel indexes and new values

  • source ([type]) – Subject source of pixels, either sprite or tile

addPixRow(source)[source]

Add a new row of sprites or tiles

Parameters

source (Source) – Subject source to add the row to, either sprite or tile

remPixRow(source)[source]

Remove a row of sprites or tiles

Parameters

source (Source) – Subject source to remove the row from, either sprite or tile

setUndoStack(undo_stack)[source]

Sets the undo stack for the GameData object

Parameters

undo_stack (QUndoStack) – The undo stack to set

classmethod fromFilename(file_name, parent=None)[source]

Class method to instantiate the GameData object from a JSON file containing project data

Parameters
  • file_name (str) – Path to project data JSON file

  • parent (QWidget, optional) – Parent widget for GameData object, defaults to None

Returns

Instance of GameData instantiated with data from file

Return type

GameData

Undo/Redo History Management

class history.cmdSetCol(palette, name, index, color, orig, desc, parent=None)[source]

Sets a color in a color palette

Parameters
  • palette (gamedata.ColorPalettes) – Target set of color palettes

  • name (str) – Name of target color palette

  • index (int) – Index of target color

  • color (QColor) – New color to set to

  • orig (QColor) – Original color

  • desc (Str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo setting a color

undo()[source]

Undo setting a color

class history.cmdSetColPalName(palette, cur_name, new_name, desc, parent=None)[source]

Set the name of a color palette

Parameters
  • palette (gamedata.ColorPalettes) – Target set of color palettes

  • cur_name (str) – Target name of color palette

  • new_name (str) – New name for color palette

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo setting a color palette name

undo()[source]

Undo setting a color palette name

class history.cmdAddColPal(palette, name, contents, desc, parent=None)[source]

Add a new sprite/tile color palette

Parameters
  • palette (gamedata.ColorPalettes) – Target set of color palettes

  • name (str) – Name of target color palette

  • contents (list) – Contents of new color palette

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo adding a color palette

undo()[source]

Undo adding a color palette

class history.cmdRemColPal(palette, name, desc, parent=None)[source]

Remove a sprite/tile color palette

Parameters
  • palette (gamedata.ColorPalettes) – Target set of color palettes

  • name (str) – Name of target color palette

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo removing a color palette

undo()[source]

Undo removing a color palette

class history.cmdSetPixBatch(palette, batch, desc, parent=None)[source]

Apply a pixel batch update

Parameters
  • palette (gamedata.PixelPalettes) – Target set of pixel palettes

  • batch (defaultdict) – Set of pixel deltas represented by pixel indexes and new values

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo updating with a pixel batch

undo()[source]

Undo updating with a pixel batch

class history.cmdAddPixRow(palette, desc, parent=None)[source]

Add a row of sprite/tiles to a pixel palette

Parameters
  • palette (gamedata.PixelPalettes) – Target set of pixel palettes

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo adding a row of sprites/tiles

undo()[source]

Undo addign a row of sprites/tiles

class history.cmdRemPixRow(palette, desc, parent=None)[source]

Remove a row of sprite/tiles from a pixel palette

Parameters
  • palette (gamedata.PixelPalettes) – Target set of pixel palettes

  • desc (str) – Text description of action

  • parent (QWidget, optional) – Parent widget, defaults to None

redo()[source]

Redo removing a row of sprites/tiles

undo()[source]

Undo removing a row of sprites/tiles

Canvas Display/Manipulation

class canvas.GraphicsView(scene=None, parent=None)[source]

QGraphicsView into sprite/tile canvas

Parameters
  • scene (QGraphicsScene, defaults to None) – QGraphicsScene representing sprite/tile canvas

  • parent (QWidget) – Parent widget, defaults to None

eventFilter(source, event)[source]

Event filter for handling zoom/pan events

Parameters
  • source (QObject) – Source of event

  • event (QEvent) – Triggered event

Returns

Whether to continue processing event downstream

Return type

bool

zoomCanvas(event)[source]

Zoom view into sprite/tile canvas

Parameters

event (QEvent) – Source event

class canvas.Subject(parent=None)[source]

Object representing pixel contents of canvas

Parameters

parent (QWidget) – Parent widget, defaults to None

setPixel(x, y, value)[source]

Set value of pixel in subject at (x,y) coordinates

Parameters
  • x (int) – X-coordinate of pixel

  • y (int) – Y-coordinate of pixel

  • value (int) – Color table index value to set pixel to

setColorTable(colors)[source]

Set color table of currently rendered subject

Parameters

colors (list(int)) – List of colors to set color table to

update()[source]

Trigger update of subject pixmap

setWidth(width)[source]

Set width of subject in pixels

Parameters

width (int) – New width of subject in pixels

setHeight(height)[source]

Set height of subject in pixels

Parameters

height (int) – New height of subject in pixels

resizeSubject()[source]

Perform re-generation of subject QImage proceeding resize

copy(selected_region)[source]

Copy selected region of pixels to the QGuiApplication clipboard

Parameters

selected_region (QRect) – Rectangular region of pixels to copy to clipboard

class canvas.Overlay(parent=None)[source]

Overlay of canvas which handles graphics tools interactions

Parameters

parent (QWidget, optional) – Parent widget, defaults to None

setTool(tool, filled=False)[source]

Sets the active tool based on user selection in toolbar

Parameters
  • tool (Tools) – Tool selection

  • filled (bool, optional) – Whether a selected shape tool will be filled or outline, defaults to False

setColor(color)[source]

Sets the color of the selected tool

Parameters

color (int) – Color of the selected tool to set

setWidth(width)[source]

Set the width of the overlay to remain consistent with the underlying subject

Parameters

width (int) – New width of the overlay

setHeight(height)[source]

Set the height of the overlay to remain consistent with the underlying subject

Parameters

width (int) – New height of the overlay

clear()[source]

Clear the overlay

floodFill(x, y)[source]

Recursive floodfill tool entry point

Parameters
  • x (int) – Starting x coordinate for floodfill

  • y (int) – Starting y coordinate for floodfill

fillPixel(x, y, old_color, new_color)[source]

Recursive floodfill function

Parameters
  • x (int) – Current x coordinate

  • y (int) – Current y coordinate

  • old_color (int) – Target color to fill

  • new_color (int) – New color to replace target color

paste()[source]

Entry point for pasting a pixel region after a selection is copied

setColorTable(color_table)[source]

Set color table used by overlay when pasting

Parameters

color_table (list(int)) – List of RGB values to set color table to

hoverMoveEvent(event)[source]

Mouse hover move event for handling updating pasting location

Parameters

event (QGraphicsSceneHoverEvent) – Source event

renderPaste(position)[source]

Render a currently pasting pixel region onto the overlay

Parameters

position (QPointF) – Location on overlay to render paste

mousePressEvent(event)[source]

Mouse press event to handle mouse clicks with various tools

Parameters

event (QGraphicsSceneMouseEvent) – Source event

mouseMoveEvent(event)[source]

Mouse move event to handle mouse movement after clicking with various tools

Parameters

event (QGraphicsSceneMouseEvent) – Source event

mouseReleaseEvent(event)[source]

Mouse release event to handle mouse release with various tools

Parameters

event (QGraphicsSceneMouseEvent) – Source event

marchAnts()[source]

Simply updates the offset of marching ants offset for box around a selected area

updateSceneForeground()[source]

Updates the foreground of the overlay to update selection box when selecting

class canvas.GraphicsScene(data, source, parent=None)[source]

Canvas representing the current state of the subject including overlayed grid lines

Parameters
  • data (GameData) – Source of sprite/tile data

  • source (Source) – Specifies the subject of the table, either tile or sprite

  • parent (QWidget, optional) – Parent widget, defaults to None

setColorSwitchEnabled(enabled)[source]

Emits signal to disable the color palette primary/secondary color switch functionality

Parameters

enabled (bool) – Whether to enable or disable the switch functionality

setSubject(root, width, height)[source]

Sets the pixel contents of the canvas

Parameters
  • root (int) – The root index of the tiles/sprites to be rendered

  • width (int) – The width of sprites/tiles starting at the root to render

  • height (int) – The height of sprites/tiles starting at the root to render

setTool(tool)[source]

Set the current tool being used on the canvas

Parameters

tool (Tools) – Current tool to be used

setColorPalette(palette)[source]

Set the color palette used by the canvas subject

Parameters

palette (str) – Name of the target color palette

setPrimaryColor(color)[source]

Set the color used by graphics tools

Parameters

color (int) – Index of the color in the current color table to be set as the primary

copy()[source]

Initiate copying of a selected region of pixels

startPasting()[source]

Initiate pasting a copied region of pixels

selectRegion(region)[source]

Select a region of pixels chosen with the select tool

Parameters

region (QRect) – Rectangular region of pixels to select

bakeDiff(image)[source]

Generate a differential list of pixel values based on the overlay and bake it onto the centralized GameData data.

Parameters

image (QImage) – Image derived from overlay to bake

bakeOverlay(overlay)[source]

Bake the overlay data directly into the centralized GameData data

Parameters

overlay (QImage) – Overlay to bake

drawForeground(painter, rect)[source]

Draw the gridlines overlaying the canvas

Parameters
  • painter (QPainter) – QPainter object to paint with

  • rect (QRectF) – Exposed rectangle to paint over

drawBackground(painter, rect)[source]

Draw the magenta transparency background, used by the sprite canvas

Parameters
  • painter (QPainter) – QPainter object to paint with

  • rect (QRectF) – Exposed rectangle to paint over

Sprite/Tile Palette Display

class pixelpalette.Overlay(parent=None)[source]

Pixel palette overlay used to draw gridlines and selection box

Parameters

parent (QWidget, optional) – Parent widget, defaults to None

setDims(height)[source]

Set height in sprites/tiles of pixel palette

Parameters

height (int) – Number of rows in pixel palette

selectSubjects(root, width, height)[source]

Select rectangular region of sprites/tiles

Parameters
  • root (int) – Index of root selected element

  • width (int) – Width of selection from root

  • height (int) – Height of selection from root

paintEvent(event)[source]

Paint event for the overlay

Parameters

event (QPaintEvent) – QPaintEvent event

getCoords(event)[source]

Get bounded coordinates of a mouse event

Parameters

event (QMouseEvent) – Source event

Returns

Bounded horizontal and vertical coordinate of mouse event

Return type

tuple(int, int)

clamp(value, lower=0, upper=16)[source]

Clamp a coordinate to bounded dimensions

Parameters
  • value (int) – Value to clamp

  • lower (int, optional) – Lower bound of clamp, defaults to 0

  • upper (int, optional) – Upper bound of clamp, defaults to 16

Returns

Clamped coordinate

Return type

int

mousePressEvent(event)[source]

Event to handle mouse clicks on overlay

Parameters

event (QMouseEvent) – Source event

mouseMoveEvent(event)[source]

Event to handle mouse movement after clicking on overlay

Parameters

event (QMouseEvent) – Source event

class pixelpalette.Tile(index, parent=None)[source]
setData(data)[source]

Set pixel data of tile

Parameters

data (list(int)) – Pixel data list

setColors(palette)[source]

Set color palette of tile

Parameters

palette (list(QColor)) – List of colors representing color palette

update()[source]

Update the tile QImage

class pixelpalette.PixelPalette(source, parent=None)[source]

Palette of sprite/tiles to be used to select canvas editing area

Parameters
  • source (Source) – Source subject of the palette, either tile or sprite

  • parent (QWidget, optional) – Parent widget, defaults to None

setup(data)[source]

Sets up the data source for the palette and generates the palette

Parameters

data (GameData) – Data source of palette

genPalette()[source]

Generates the palette based on the data source

selectSubjects(index=None, width=- 1, height=- 1)[source]

Selects a rectangular region of tiles in the palette. None and negative index/width/height values result in internal values being used.

Parameters
  • index (int, optional) – Root index of selection, defaults to None

  • width (int, optional) – Width of selection from index, defaults to -1

  • height (int, optional) – Height of selection from index, defaults to -1

updateSubjects(source, subjects)[source]

Updates the palette’s tiles with data from the centralized GameData

Parameters
  • source (Source) – Source subject of update, either sprite or tile

  • subjects (set(int)) – A set of subject indexes which need to be updated

setColorPalette(palette)[source]

Set the color palette to be used by the sprites/tiles

Parameters

palette (str) – Name of the color palette

inSelection(index)[source]

Determine if an index is inside the rectangular selection area

Parameters

index (int) – Target index

Returns

Whether the target index is inside the selection

Return type

bool

genLocCache(height)[source]

Generates a cache of 2D locations for indexes

Parameters

height (int) – Height of the pixel palette in tiles/sprites

genCoords(index)[source]

Generates the 2D coordinates for a given element index

Parameters

index (int) – Index of the element

Returns

(x,y) coordinates of the element

Return type

tuple(int, int)

class pixelpalette.Contents(source, palette, parent=None)[source]

Visual contents of the pixel palette

Parameters
  • source (Source) – Subject source of the contents, either sprite or tile

  • palette (PixelPalette) – Palette to render in contents

  • parent (QWidget, optional) – Parent widget, defaults to None

setup(data)[source]

Sets up the data source for the contents and set dimensions

Parameters

data (GameData) – Data source of contents

addPalRow()[source]

Appends a row to the content palette

remPalRow()[source]

Removes the last rom from the content palette

palRowCntChanged(source, num_rows)[source]

Limits changes to the palette row count by enabling/disable UI elements

Parameters
  • source ([type]) – [description]

  • num_rows ([type]) – [description]

class pixelpalette.PixelPaletteDock(source, parent=None)[source]

Dock containing the pixel palette

Parameters
  • source (Source) – Subject source of the dock, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

setup(data)[source]

Sets up the data source for the dock

Parameters

data (GameData) – Data source of dock

closeEvent(event)[source]

Handles the close event of the dock by disable it

Parameters

event (QCloseEvent) – Close event

Color Palette Display

class colorpalette.ColorPreview(source, parent=None)[source]

Color preview widget showing primary and secondary color selections

Parameters
  • source (Source) – Subject source of preview, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

paintEvent(event)[source]

Preview paint event to draw regular and transparent color selections

Parameters

event (QPaintEvent) – Paint event

setPrimaryColor(color)[source]

Sets the primary color of the preview

Parameters

color (QColor) – Color to be set as the primary

setPrimaryIndex(index)[source]

Sets the index of the chosen primary color of the preview

Parameters

index (int) – Index to be set as the primary

setSecondaryColor(color)[source]

Sets the secondary color of the preview

Parameters

color (QColor) – Color to be set as the secondary

setSecondaryIndex(index)[source]

Sets the index of the chosen secondary color of the preview

Parameters

index (int) – Index to be set as the secondary

setColorSwitchEnabled(enabled)[source]

Sets the switch color aciton/button to be enabled/disabled

Parameters

enabled (bool) – Whether color switch is to be enabled or disabled

class colorpalette.Color(index, source, parent=None)[source]

Representation of a single color in the color palette

Parameters
  • index (int) – Numerical index of the color in a color table

  • source (Source) – Source subject of the color, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

paintEvent(event)[source]

Color paint event to draw grid and transaprency indications

Parameters

event (QPaintEvent) – Paint event

fill(color)[source]

Fills color

Parameters

color (QColor) – Color to be filled with

mouseDoubleClickEvent(event)[source]

Handles double clicking on a given color to open the color picker

Parameters

event (QMouseEvent) – Source event

mousePressEvent(event)[source]

Handles clicking on a given color to select that color

Parameters

event (QMouseEvent) – Source event

deselect()[source]

Handles deselecting a color

select()[source]

Handles selecting a color

class colorpalette.ColorPalette(source, parent=None)[source]

Represents a palette of colors

Parameters
  • source (Source) – Subject source of the palette, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

setup(data)[source]

Sets up the data source for the palette and initial selection

Parameters

data (GameData) – Data source of palette

openPicker(index, orig_color)[source]

Handles opening the color picker after double-clicking on a color

Parameters
  • index (int) – Index of the color selected

  • orig_color (QColor) – Original color of the selection color

sendColorUpdate(index, new_color, orig_color=None)[source]

Sends color update to centralized GameData data

Parameters
  • index (int) – Index of changed color in palette

  • new_color (QColor) – Color to be changed to

  • orig_color (QColor, optional) – Original color, defaults to None

previewColor(index, color)[source]

Triggers preview of color throughout application when interacting with color picker

Parameters
  • index (int) – Index of the color being changed

  • color (QColor) – Color to be previewed

setPalette(source, palette)[source]

Sets the overall color palette colors

Parameters
  • source (Source) – Subject source of color palette, either sprite or tile

  • palette (str) – Name of the color palette to be set to

switchColors()[source]

Switches the active color between the primary and secondary colors

selectColor(index, color, button)[source]

Selects a primary or secondary color from the palette

Parameters
  • index (int) – Index of the chosen color

  • color (QColor) – Color chosen

  • button (Qt.MouseButton) – Which mouse button was used to select the primary or secondary color

class colorpalette.ColorPaletteDock(source, parent=None)[source]

Dock containing the color palette and preview area

Parameters
  • source (Source) – Subject source for the dock and its contents, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

setup(data)[source]

Sets up the data source for the dock’s contents and enables UI elements

Parameters

data (GameData) – Data source of dock

addPaletteReq(event=None)[source]

Sends command to GameData source to add a color palette

Parameters

event (QMouseEvent, optional) – Mouse click event which triggered the request, defaults to None

removePaletteReq(event=None)[source]

Sends command to GameData source to remove a color palette

Parameters

event (QMouseEvent, optional) – Mouse click event which triggered the request, defaults to None

renamePaletteReq(event=None)[source]

Sends command to GameData source to rename a color palette

Parameters

event (QMouseEvent, optional) – Mouse click event which triggered the request, defaults to None

addPalette(source, name, index)[source]

Adds a new color palette

Parameters
  • source (Source) – Subject source of the addition, either sprite or tile

  • name (str) – Name of the added color palette

  • index (int) – Index in color palette list to insert the new palette

removePalette(source, name)[source]

Removes a color palette

Parameters
  • source (Source) – Subject source of the removal, either sprite or tile

  • name (str) – Name of the removed color palette

renamePalette(source, cur_name, new_name)[source]

Renames a color palette

Parameters
  • source (Source) – Subject source of the removal, either sprite or tile

  • cur_name (str) – Current name of the target color palette

  • new_name (str) – New name of the target color palette

verifyCurrentPalette(name)[source]

Ensures that the current color palette in the selection list is accurate

Parameters

name (str) – Name of the selected color palette

setColorPalette()[source]

Sets the active color palette to the one chosen in the selection list

closeEvent(event)[source]

Intercepts the dock close event to prevent its closure

Parameters

event (QEvent) – Source event

Color Picker Display

colorpicker.upsample(red, green, blue)[source]

Upsamples RGB from 8-bit to 24-bit

Parameters
  • red (int) – 8-bit red value

  • green (int) – 8-bit green value

  • blue (int) – 8-bit blue value

Returns

24-bit upscaled RGB tuple

Return type

tuple(int, int, int)

colorpicker.downsample(red, green, blue)[source]

Downsamples RGB from 24-bit to 8-bit

Parameters
  • red (int) – 24-bit red value

  • green (int) – 24-bit green value

  • blue (int) – 24-bit blue value

Returns

8-bit downscaled RGB tuple

Return type

tuple(int, int, int)

colorpicker.normalize(red, green, blue)[source]

Normalizes any RGB value to be representable by a whole 8-bit value

Parameters
  • red (int) – Red value

  • green (int) – Green value

  • blue (int) – Blue value

Returns

24-bit normalized RGB tuple

Return type

tuple(int, int, int)

class colorpicker.Color(index, parent=None)[source]

Represents a single color tile in the color picker

Parameters
  • index (int) – Index of the color tile

  • parent (QWidget, optional) – Parent widget, defaults to None

fill(color)[source]

Fills the tile with the specified color

Parameters

color (QColor) – Target color

paintEvent(event)[source]

Paint event for the color tile which draws the grid

Parameters

event (QPaintEvent) – QPaintEvent event

mousePressEvent(event)[source]

Handles clicking on the color tile to select it

Parameters

event (QMouseEvent) – Source event

select()[source]

Handles selecting the color tile

deselect()[source]

Handles de-selecting the color tile

class colorpicker.ColorPalette[source]

Represents the entire grid of color tiles in the color picker

selectColor(index)[source]

Selects a color in the color picker

Parameters

index (int) – Index of the selected color

class colorpicker.ColorValidator(top, parent=None)[source]

Provides input field validation to color picker RGB values

Parameters
  • top (int) – RGB value ceiling

  • parent (QWidget, optional) – Parent widget, defaults to None

validate(value, pos)[source]

Validates an RGB input

Parameters
  • value (int) – Value of the RGB input

  • pos (int) – Position of the cursor in the input field

Returns

Result of the validation

Return type

QValidator

class colorpicker.ColorPicker(parent=None)[source]

Represents the dialog containing the color picker

Parameters

parent (QWidget, optional) – Parent widget, defaults to None

eventFilter(source, event)[source]

Event filter to handle the dialog losing focus

Parameters
  • source (QObject) – Event source

  • event (QEvent) – Source event

Returns

Whether to handle the event further down

Return type

bool

getColor()[source]

Gets the chosen color from the color picker

Returns

Chosen color

Return type

QColor

setColor(value)[source]

Sets the chosen color of the color picker

Parameters

value (QColor) – The color to be set

set8BitColors()[source]

Sets the active color to that chosen by the 8-bit input fields

set24BitColors()[source]

Sets the active color to that chosen by the 24-bit input fields

set8BitHex()[source]

Sets the active color to that chosen by the 8-bit hex input field

set24BitHex()[source]

Sets the active color to that chosen by the 24-bit hex input field

Preferences Management

class preferences.Preferences(parent=None)[source]

Represents the dialog containg the application settings

Parameters

parent (QWidget, optional) – Parent widget, defaults to None

idUcs()[source]

Executes the serial routines necessary to identify which COM ports the GPU and CPU are on

setCpuPort(port)[source]

Sets the GPU COM port in preferences

Parameters

port (str) – COM port hosting the CPU

setGpuPort(port)[source]

Sets the GPU COM port in preferences

Parameters

port (str) – COM port hosting the GPU

handlePrefsBtns(button)[source]

Handles Ok/Apply/Cancel preferences buttons

Parameters

button (QPushButton) – Button which triggered the actions

Graphics Toolbox

class gamedata.ColorPalettes(data, source, parent=None)[source]

Data container for sprite/tile color palettes

Parameters
  • data (list(dict)) – List containing JSON color palette data

  • source (Source) – Subject source of palette, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

keys()[source]

Retrieve color palette dict keys

Returns

Color palette dict keys

Return type

odict_keys

values()[source]

Retrieve color palette dict values

Returns

Color palette dict values

Return type

odict_values

items()[source]

Retrieve color palette dict items

Returns

Color palette dict items

Return type

odict_items

setName(cur_name, new_name)[source]

Sets the names of a color palette

Parameters
  • cur_name (str) – Name of target color palette

  • new_name (str) – New name for color palette

addPalette(name, contents, index=None)[source]

Add a new color palette

Parameters
  • name (str) – New color palette name

  • contents (list(QColor)) – New color palette contents

  • index (int, optional) – Index in palettes to insert new palette, defaults to None

remPalette(name)[source]

Removes color palette

Parameters

name (str) – Name of color palette to be removed

class gamedata.PixelPalettes(data, source, parent=None)[source]

Data container for sprite/tile pixel palettes

Parameters
  • data (list(dict)) – List containing JSON pixel palette data

  • source (Source) – Subject source of palette, either sprite or tile

  • parent (QWidget, optional) – Parent widget, defaults to None

batchUpdate()[source]

Updates the pixel palette date based on self.update_manifest

getPalettes()[source]

Returns the pixel palettes

Returns

Pixel palettes

Return type

list(list)

addRow(row=None)[source]

Adds a row of sprites/tiles to palette

Parameters

row (list(list), optional) – Row data to be added, defaults to None

remRow()[source]

Removes a row of sprites/tiles from the palette

Returns

The removed row

Return type

list(list)

class gamedata.GameData(data, parent=None)[source]

Represents centralized data object for JIDE, containing all sprite/tile/ tile map data and CRUD functions

Parameters
  • data (dict) – Dict containing project JSON data

  • parent (QWidget, optional) – Parent widget, defaults to None

getPixelPalettes(source)[source]

Retrieve sprite/tile pixel palettes

Parameters

source (Source) – Subject source of palettes, either sprite or tile

Returns

Pixel palettes

Return type

list

getElement(index, source)[source]

Retrieve a sprite/tile pixel value

Parameters
  • index (tuple(int, int, int)) – Index/row/col of pixel

  • source (Source) – Subject source of pixel, either sprite or tile

Returns

Pixel value at index

Return type

int

getColPals(source)[source]

Retrieve sprite/tile color palettes

Parameters

source (Source) – Subject source of palettes, either sprite or tile

Returns

Color palettes of target source

Return type

list

getColPalNames(source)[source]

Retrieve sprite/tile color palette names

Parameters

source (Source) – Subject source of palette names, either sprite or tile

Returns

Names of target source color palettes

Return type

list

getColPal(name, source)[source]

Retrieve a specific sprite/tile color palette

Parameters
  • name (str) – Name of color palette to retrieve

  • source (Source) – Subject source of palette, either sprite or tile

Returns

Color palette specified by name

Return type

list

setColor(name, index, color, source, orig=None)[source]

Sets a color in a specific color palette

Parameters
  • name (str) – Name of color palette containing target color

  • index (int) – Index of color in color palette

  • color (QColor) – New color to be set to

  • source (Source) – Subject source of target palette, either sprite or tile

  • orig (QColor, optional) – Original color of the target color, defaults to None

previewColor(name, index, color, source)[source]

Previews a color without committing it to the data; used by colorpalette.ColorPreview

Parameters
  • name (str) – Name of color palette containing target color

  • index (int) – Index of color in color palette

  • color (QColor) – Color to preview

  • source (Source) – Subject source of target palette, either sprite or tile

setColPalName(cur_name, new_name, source)[source]

Set name of a color palette

Parameters
  • cur_name (str) – Current name of target color palette

  • new_name (str) – New name for target palette

  • source (Source) – Subject source of target palette, either sprite or tile

addColPal(name, source)[source]

Add a new color palette

Parameters
  • name (str) – Name for the new color palette

  • source (Source) – Subject source of new palette, either sprite or tile

remColPal(name, source)[source]

Remove a color palette

Parameters
  • name (str) – Name for the target color palette

  • source (Source) – Subject source of target palette, either sprite or tile

setPixBatch(batch, source)[source]

Sets pixels to new values based on the contents of a set of pixel deltas

Parameters
  • batch (defaultdict) – Set of pixel deltas represented by pixel indexes and new values

  • source ([type]) – Subject source of pixels, either sprite or tile

addPixRow(source)[source]

Add a new row of sprites or tiles

Parameters

source (Source) – Subject source to add the row to, either sprite or tile

remPixRow(source)[source]

Remove a row of sprites or tiles

Parameters

source (Source) – Subject source to remove the row from, either sprite or tile

setUndoStack(undo_stack)[source]

Sets the undo stack for the GameData object

Parameters

undo_stack (QUndoStack) – The undo stack to set

classmethod fromFilename(file_name, parent=None)[source]

Class method to instantiate the GameData object from a JSON file containing project data

Parameters
  • file_name (str) – Path to project data JSON file

  • parent (QWidget, optional) – Parent widget for GameData object, defaults to None

Returns

Instance of GameData instantiated with data from file

Return type

GameData

Data Sources

class source.Source(value)[source]

Represents a data source, either sprite or tile

Indices and tables