box module#
Box symbol module for JITX Standard Library
This module provides box symbol definitions for creating rectangular symbols with configurable pin layouts and spacing.
- Quick Start:
>>> # Auto-generated symbol >>> class MyComponent(Component): ... GND = Port() ... VCC = Port() ... IN = [Port() for _ in range(3)] ... OUT = [Port() for _ in range(5)] ... symbol = BoxSymbol()
>>> # Custom layout >>> class MyComponent(Component): ... GND = Port() ... VCC = Port() ... IN = [Port() for _ in range(3)] ... OUT = [Port() for _ in range(5)] ... symbol = BoxSymbol( ... rows=[ ... Row(left=PinGroup(IN), right=PinGroup(OUT)), ... ], ... columns=[ ... Column(up=PinGroup(VCC), down=PinGroup(GND)), ... ], ... )
- class SpaceType(*values)[source]#
Bases:
EnumTypes of spaces in box symbol layout
- CORNER = 'corner'#
- ROW_COL_SPACING = 'row_col_spacing'#
- ROW_COL_SPACING_ALIGN = 'row_col_spacing_align'#
- GROUP_SPACING = 'group_spacing'#
- PIN_SPACING = 'pin_spacing'#
- PRE_PIN_SPACING = 'pre_pin_spacing'#
- class SpaceEntry(value, type)[source]#
Bases:
objectEntry describing a space in the box symbol layout
- class PinGroup(pins, *args, pre_margin=None, post_margin=None)[source]#
Bases:
StructurableA group of pins with optional positioning and margins.
>>> # Group of input pins >>> IN = [Port() for _ in range(3)] >>> input_group = PinGroup(IN)
- class Row(left=(), right=(), top_margin=None, bottom_margin=None)[source]#
Bases:
StructurableA row in the box symbol grid, containing Left and Right pin groups.
Rows define horizontal arrangements of pins. Pins on the left extend outward to the left, and pins on the right extend outward to the right. Pins are arranged in the order they are given, from top to bottom.
>>> # Single row with inputs on left, outputs on right >>> row = Row( ... left=PinGroup(IN), ... right=PinGroup(OUT) ... )
- Parameters:
- class Column(up=(), down=(), left_margin=None, right_margin=None)[source]#
Bases:
StructurableA column in the box symbol grid, containing Up and Down pin groups.
Columns define vertical arrangements of pins. Pins on top extend upward, and pins on bottom extend downward. Pins are arranged in the order they are given, from left to right.
>>> # Column with power pins on top, ground on bottom >>> col = Column( ... up=PinGroup(VCC, VREF), ... down=PinGroup(GND) ... )
- Parameters:
- class BoxConfig(label_config=None, min_width=2.0, min_height=2.0, pin_spacing=2.0, corner_margin=2.0, group_spacing=2.0, row_spacing=2.0, col_spacing=2.0, pin_length=2, pin_name_size=0.65, pad_name_size=0.65)[source]#
Bases:
LabelConfigurableConfiguration for box symbols.
Controls spacing, sizing, and text appearance for box-style schematic symbols. Can be set on a box symbol or globally via SymbolStyleContext.
>>> # Custom configuration for a compact symbol >>> config = BoxConfig( ... pin_spacing=1.0, ... corner_margin=1.0, ... group_spacing=1.0, ... ) >>> symbol = BoxSymbol(rows=rows, columns=columns, config=config)
- Parameters:
- class SymbolBox(config)[source]#
Bases:
LabelledSymbolBox-shaped symbol
- Parameters:
config (BoxConfig)
- class BoxSymbol(rows=(), columns=(), config=None, debug=False, **kwargs)[source]#
Bases:
ContainerContainer for a box-shaped symbol with pins, artwork, labels, and a symbol mapping.
BoxSymbol creates rectangular schematic symbols with pins on all four sides. Pins are organized into Rows of left and right pins and Columns of up and down pins. If no rows/columns are provided, the symbol auto-generates from component ports.
Examples
>>> # Auto-generated symbol from component ports >>> class MyComponent(Component): ... IN = [Port() for _ in range(4)] ... OUT = [Port() for _ in range(4)] ... VCC = Port() ... GND = Port() ... ... def __init__(self): ... self.symbol = BoxSymbol() # Auto-arranges all ports
>>> # Manual layout with rows and columns >>> class MyComponent(Component): ... IN = [Port() for _ in range(8)] ... OUT = [Port() for _ in range(8)] ... CLK = Port() ... RST = Port() ... VCC = Port() ... GND = Port() ... ... def __init__(self): ... self.symbol = BoxSymbol( ... rows=Row( ... left=PinGroup(self.IN), ... right=PinGroup(self.OUT) ... ), ... columns=Column( ... up=PinGroup([self.CLK, self.RST, self.VCC]), ... down=PinGroup(self.GND) ... ) ... )
>>> # Multiple rows for complex layouts >>> symbol = BoxSymbol( ... rows=[ ... Row(left=PinGroup(data_pins), right=PinGroup(status_pins)), ... Row(left=PinGroup(addr_pins), right=PinGroup(control_pins)) ... ], ... columns=Column(up=PinGroup(power_pins), down=PinGroup(gnd_pins)), ... config=BoxConfig(pin_spacing=1.0) ... )
- Parameters:
- mapping: SymbolMapping#