ClassicModernTemplate¶
src.templates.normal.ClassicModernTemplate
¶
Bases: VectorTransformMod, VectorMDFCMod, VectorTemplate
A modern frame version of iDerp's 'Classic Remastered' template.
Source code in src\templates\normal.py
1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968 1969 1970 1971 1972 1973 1974 1975 1976 1977 1978 1979 1980 1981 1982 1983 1984 1985 1986 1987 1988 1989 1990 1991 1992 1993 1994 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019 2020 2021 2022 2023 2024 2025 2026 2027 2028 2029 2030 2031 2032 2033 2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 2050 2051 2052 2053 2054 2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070 2071 2072 2073 2074 2075 2076 2077 2078 2079 2080 2081 2082 2083 2084 2085 2086 2087 2088 2089 2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114 2115 2116 2117 2118 2119 2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130 2131 2132 2133 2134 2135 2136 2137 2138 2139 2140 2141 2142 2143 2144 2145 2146 2147 2148 2149 2150 2151 2152 2153 2154 2155 2156 2157 2158 2159 2160 2161 2162 2163 2164 2165 2166 2167 2168 2169 2170 2171 2172 2173 2174 2175 2176 2177 | |
Attributes¶
RGB_BLACK: SolidColor
¶
RGB_WHITE: SolidColor
¶
active_layer: Union[ArtLayer, LayerSet]
¶
Union[ArtLayer, LayerSet]: Get the currently active layer in the Photoshop document.
app: PhotoshopHandler
¶
art_action: Optional[Callable]
¶
Function that is called to perform an action on the imported art.
art_action_args: Optional[dict]
¶
Args to pass to art_action.
art_frame: str
¶
art_frame_vertical: str
¶
art_layer: ArtLayer
¶
art_reference: ReferenceLayer
¶
background: str
¶
background_colors: str
¶
Must be returned as color combination or layer name, e.g. WU or Artifact.
background_group: Optional[LayerSet]
¶
Optional[LayerSet]: Group containing background texture layers.
background_layer: Optional[ArtLayer]
¶
Background texture layer.
background_masks: list[ArtLayer]
¶
List of layers containing masks used to blend background layers. Default: mask_layers.
basic_watermark_color: SolidColor
¶
Color to use for the Basic Land Watermark.
basic_watermark_color_map: dict
¶
Maps color values for Basic Land Watermark.
basic_watermark_fx: list[LayerEffects]
¶
Defines the layer effects used on the Basic Land Watermark.
border_color: str
¶
Use 'black' unless an alternate color and a valid border group is provided.
border_group: Optional[Union[LayerSet, ArtLayer]]
¶
Optional[Union[LayerSet, ArtLayer]]: Group, or sometimes a layer, containing the card border.
color_indicator_layer: Optional[ArtLayer]
¶
Color indicator icon layer.
color_limit: int
¶
console: type[CONSOLE]
¶
type[CONSOLE]: Console output object used to communicate with the user.
crown_color_map: dict
¶
Maps color values for the Legendary Crown.
crown_colors: str
¶
Support multicolor based on color limit.
crown_group: Optional[LayerSet]
¶
Group containing Legendary Crown texture layers.
crown_layer: Optional[ArtLayer]
¶
Legendary crown layer.
crown_masks: list[ArtLayer]
¶
List of layers containing masks used to blend legendary crown layers. Default: mask_layers.
crown_mode: str
¶
Whether to use pinlines when generating the Legendary Crown.
crown_shadow_layer: Union[ArtLayer, LayerSet, None]
¶
Legendary crown hollow shadow layer.
dfc_group: Optional[LayerSet]
¶
Optional[LayerSet]: Group containing double face elements.
divider_layer: Optional[ArtLayer]
¶
Optional[ArtLayer]: Divider layer between rules text and flavor text.
doc_selection: Selection
¶
docref: Optional[Document]
¶
Optional[Document]: This template's document open in Photoshop.
enabled_shapes: list[Union[ArtLayer, LayerSet, None]]
¶
Vector shapes that should be enabled during the enable_shape_layers step. Should be a list of layer, layer group, or None objects.
event: Event
¶
expansion_reference: Optional[ArtLayer]
¶
Expansion symbol reference layer
expansion_symbol_alignments: list[Dimensions]
¶
Alignments used for positioning the expansion symbol
expansion_symbol_layer: Optional[ArtLayer]
¶
Expansion symbol layer, value set during the load_expansion_symbol method.
frame_layer_methods: list[Callable]
¶
Add Transform frame layers step.
hooks: list[Callable]
¶
list[Callable]: List of methods that will be called during the hooks execution step
identity: str
¶
indicator_color_map: dict
¶
Maps color values for the Color Indicator.
indicator_colors: list[list[int]]
¶
list[list[int]]: Must be returned as list of RGB/CMYK color notations.
indicator_group: Optional[LayerSet]
¶
Group where Color Indicator colors will be generated.
indicator_masks: list[ArtLayer]
¶
List of layers containing masks used to build the Color Indicator.
is_art_vertical: bool
¶
is_artifact: bool
¶
is_basic_land: bool
¶
is_centered: bool
¶
is_collector_promo: bool
¶
is_colorless: bool
¶
is_companion: bool
¶
is_content_aware_enabled: bool
¶
Force enabled if 'is_extended' setting is enabled.
is_creature: bool
¶
is_emblem: bool
¶
is_extended: bool
¶
is_flipside_creature: bool
¶
is_front: bool
¶
is_fullart: bool
¶
Colorless cards use Fullart reference.
is_hollow_crown: bool
¶
is_hybrid: bool
¶
is_land: bool
¶
is_legendary: bool
¶
is_mdfc: bool
¶
is_miracle: bool
¶
is_name_shifted: bool
¶
is_nyx: bool
¶
is_snow: bool
¶
is_token: bool
¶
is_transform: bool
¶
is_type_shifted: bool
¶
is_within_color_limit: bool
¶
legal_group: LayerSet
¶
mask_group: Optional[LayerSet]
¶
mask_layers: list[ArtLayer]
¶
List of layers containing masks used to blend multicolored layers.
mdfc_bar_color: str
¶
Layer name for the MDFC top icon color.
mdfc_icon_color: str
¶
Layer name for the MDFC top icon color.
name_reference: Optional[ArtLayer]
¶
output_directory: Path
¶
PathL Directory to save the rendered image.
output_file_name: Path
¶
pinlines: str
¶
pinlines_color_map = {None: pinlines_color_map.copy(), 'Land': '#604a33'}
¶
- Bool
pinlines_colors: Union[list[int], list[dict]]
¶
Must be returned as SolidColor or gradient notation.
pinlines_group: Optional[LayerSet]
¶
Group containing pinlines colors, textures, or other groups.
pinlines_groups: list[LayerSet]
¶
Groups where pinline colors will be generated.
pinlines_layer: Optional[ArtLayer]
¶
Pinlines (and textbox) layer.
pinlines_masks: list[ArtLayer]
¶
List of layers containing masks used to blend Pinlines layers. Default: mask_layers.
post_save_methods: list[Callable]
¶
list[Callable]: Methods called after the rendered image is saved.
post_text_methods: list[Callable]
¶
list[Callable]: Methods called after text is inserted and formatted.
pre_render_methods: list[Callable]
¶
list[Callable]: Methods called before rendering begins.
Functions:
| Name | Description |
|---|---|
`process_layout_data` |
Processes layout data before it is used to generate the card. |
pt_colors: str
¶
Optional[str]: returned as a color combination or layer name, e.g. WU or Artifact.
pt_group: Optional[LayerSet]
¶
Group containing PT Box texture layers.
pt_layer: Optional[ArtLayer]
¶
Power and toughness box layer.
pt_masks: list[ArtLayer]
¶
List of layers containing masks used to blend PT box layers. Default: mask_layers.
pt_reference: Optional[ReferenceLayer]
¶
save_mode: Callable
¶
text: list[FormattedTextLayer]
¶
List of text layer objects to execute.
text_group: Optional[LayerSet]
¶
Optional[LayerSet]: Text and icon group, contains rules text and necessary symbols.
text_layer_creator: Optional[ArtLayer]
¶
Optional[ArtLayer]: Proxy creator name text layer.
text_layer_flipside_pt: Optional[ArtLayer]
¶
Flipside power/toughness layer for front face Transform cards.
text_layer_mana: Optional[ArtLayer]
¶
Optional[ArtLayer]: Card mana cost text layer.
text_layer_mdfc_left: Optional[ArtLayer]
¶
The back face card type.
text_layer_mdfc_right: Optional[ArtLayer]
¶
The back face mana cost or land tap ability.
text_layer_methods: list[Callable]
¶
Add Transform text layers step.
text_layer_name: Optional[ArtLayer]
¶
Optional[ArtLayer]: Card name text layer.
text_layer_pt: Optional[ArtLayer]
¶
Optional[ArtLayer]: Card power and toughness text layer.
text_layer_rules: Optional[ArtLayer]
¶
Supports noncreature and creature, with or without flipside PT.
text_layer_type: Optional[ArtLayer]
¶
Optional[ArtLayer]: Card typeline text layer.
textbox_group: Optional[LayerSet]
¶
Group containing textbox texture layers.
textbox_masks: list[ArtLayer]
¶
List of layers containing masks used to blend textbox layers. Default: mask_layers.
textbox_reference: Optional[ArtLayer]
¶
Use a mask to reduce reference size for MDFC cards.
transform_icon_layer: Optional[ArtLayer]
¶
Optional[ArtLayer]: Transform icon layer.
twins: str
¶
twins_colors: str
¶
Must be returned as color combination or layer name, e.g. WU or Artifact.
twins_group: Optional[LayerSet]
¶
Group containing twins texture layers.
twins_layer: Optional[ArtLayer]
¶
Name and title boxes layer.
twins_masks: list[ArtLayer]
¶
List of layers containing masks used to blend background layers. Default: mask_layers.
twins_shape: Union[LayerObjectTypes, list[LayerObjectTypes], None]
¶
Vector shape representing the card name and title boxes.
type_reference: Optional[ArtLayer]
¶
otherwise fallback to the expansion symbols reference layer.
watermark_blend_mode: BlendMode
¶
Blend mode to use on the Watermark layer.
watermark_color_map: dict
¶
Maps color values for Watermark.
watermark_colors: list[SolidColor]
¶
Colors to use for the Watermark.
watermark_fx: list[LayerEffects]
¶
Defines the layer effects to use for the Watermark.
Functions¶
add_basic_watermark_snow_effects(wm: ArtLayer)
¶
Adds optional snow effects for 'Snow' Basic Land watermarks.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wm
|
ArtLayer
|
ArtLayer containing the Basic Land Watermark. |
required |
basic_text_layers() -> None
¶
Add essential text layers: Mana cost, Card name, Typeline.
Source code in src\templates\_core.py
check_photoshop() -> None
¶
Check if Photoshop is responsive to automation.
Source code in src\templates\_core.py
collector_info() -> None
¶
Format and add the collector info at the bottom.
Source code in src\templates\_core.py
collector_info_artist_only() -> None
¶
Called to generate 'Artist Only' collector info.
Source code in src\templates\_core.py
collector_info_authentic() -> None
¶
Called to generate realistic collector info.
Source code in src\templates\_core.py
collector_info_basic() -> None
¶
Called to generate basic collector info.
Source code in src\templates\_core.py
color_border() -> None
¶
Color this card's border based on given setting.
Source code in src\templates\_core.py
create_basic_watermark() -> None
¶
Builds a basic land watermark.
Source code in src\templates\_core.py
create_blended_layer(group: LayerSet, colors: Union[None, str, list[str]] = None, masks: Optional[list[ArtLayer]] = None, **kwargs)
¶
Either enable a single frame layer or create a multicolor layer using a gradient mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
LayerSet
|
Group to look for the color layers within. |
required |
colors
|
None | str | list[str]
|
Color layers to look for. |
None
|
masks
|
list[ArtLayer] | None
|
Masks to use for blending the layers. |
None
|
Source code in src\templates\_core.py
create_blended_solid_color(group: LayerSet, colors: list[ColorObject], masks: Optional[list[Union[ArtLayer, LayerSet]]] = None, **kwargs) -> None
¶
Either enable a single frame layer or create a multicolor layer using a gradient mask.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
LayerSet
|
Group to look for the color layers within. |
required |
colors
|
list[ColorObject]
|
Color layers to look for. |
required |
masks
|
list[ArtLayer | LayerSet] | None
|
Masks to use for blending the layers. |
None
|
Source code in src\templates\_core.py
create_watermark() -> None
¶
Builds the watermark.
Source code in src\templates\_core.py
enable_crown() -> None
¶
Enable the Legendary crown, only called if card is Legendary.
Source code in src\templates\normal.py
enable_frame_layers() -> None
¶
Build the card frame by enabling and/or generating various layer.
Source code in src\templates\_vector.py
enable_hollow_crown(**kwargs) -> None
¶
Enable the Hollow Crown within the Legendary Crown, only called if card is Legendary Nyx or Companion.
Source code in src\templates\_vector.py
enable_layer_masks() -> None
¶
Enable or copy required layer masks provided by enabled_masks.
Source code in src\templates\_vector.py
enable_mdfc_layers() -> None
¶
enable_mdfc_layers_front() -> None
¶
enable_shape_layers() -> None
¶
Enable required vector shape layers provided by enabled_shapes.
Source code in src\templates\_vector.py
enable_transform_layers() -> None
¶
enable_transform_layers_front() -> None
¶
execute() -> bool
¶
Perform actions to render the card using this template.
Notes
- Each action is wrapped in an exception check and breakpoint to cancel the thread if a cancellation signal was sent by the user.
- Never override this method!
Source code in src\templates\_core.py
1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 | |
format_text_layers() -> None
¶
Validate and execute each formatted text layer.
Source code in src\templates\_core.py
generate_layer(group: Union[ArtLayer, LayerSet], colors: Union[str, ColorObject, list[ColorObject], list[dict]], masks: Optional[list[ArtLayer]] = None, **kwargs) -> Optional[ArtLayer]
¶
Takes information about a frame layer group and routes it to the correct generation function which blends rasterized layers, blends solid color layers, or generates a solid color/gradient adjustment layer.
Notes
The result for a given 'colors' schema: - str: Enable and/or blend one or more texture layers, unless string is a hex color, in which case create a solid color adjustment layer. - list[str]: Blend multiple texture layers. - list[int]: Create a solid color adjustment layer. - list[dict]: Create a gradient adjustment layer. - list[list[int]]: Blend multiple solid color adjustment layers. - list[SolidColor]: Blend multiple solid color adjustment layers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group
|
ArtLayer | LayerSet
|
Layer or group containing layers. |
required |
colors
|
str | ColorObject | list[ColorObject] | list[dict]
|
Color definition for this frame layer generation. |
required |
masks
|
list[ArtLayer] | None
|
Masks used to blend this generated layer. |
None
|
Source code in src\templates\_core.py
1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 | |
get_template_route(layout, **kwargs) -> BaseTemplate
¶
Overwrite this method to reroute a template class to another class under a set of conditions. See the 'IxalanTemplate' class for an example.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
layout
|
The card layout object. |
required |
Returns:
| Type | Description |
|---|---|
BaseTemplate
|
Initialized template class object. |
Source code in src\templates\_core.py
hook_creature() -> None
¶
hook_large_mana() -> None
¶
load_artwork(art_file: Optional[str | Path] = None, art_layer: Optional[ArtLayer] = None, art_reference: Optional[ReferenceLayer] = None) -> None
¶
Loads the specified art file into the specified layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
art_file
|
str | Path | None
|
Optional path (as str or Path) to art file. Will use |
None
|
art_layer
|
ArtLayer | None
|
Optional |
None
|
art_reference
|
ReferenceLayer | None
|
Optional |
None
|
Source code in src\templates\_core.py
load_expansion_symbol() -> None
¶
Imports and positions the expansion symbol SVG image.
Source code in src\templates\_core.py
log(text: str, e: Optional[Exception] = None) -> None
¶
Writes a message to console if test mode isn't enabled, logs an exception if provided.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
text
|
str
|
Message to write to console. |
required |
e
|
Exception | None
|
Exception to log if provided. |
None
|
Source code in src\templates\_core.py
paste_scryfall_scan(rotate: bool = False, visible: bool = True) -> Optional[ArtLayer]
¶
Downloads the card's scryfall scan, pastes it into the document next to the active layer, and frames it to fill the given reference layer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
rotate
|
bool
|
Will rotate the card horizontally if True, useful for Planar cards. |
False
|
visible
|
bool
|
Whether to leave the layer visible or hide it. |
True
|
Returns:
| Type | Description |
|---|---|
ArtLayer | None
|
ArtLayer if Scryfall scan was imported, otherwise None. |
Source code in src\templates\_core.py
process_layout_data() -> None
¶
Performs any required pre-processing on the provided layout data.
Source code in src\templates\_core.py
raise_error(message: str, error: Optional[Exception] = None) -> None
¶
Raise an error on the console display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Message to be displayed |
required |
error
|
Exception | None
|
Exception object |
None
|
Source code in src\templates\_core.py
raise_warning(message: str, error: Exception = None) -> None
¶
Raise a warning on the console display.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
message
|
str
|
Message to be displayed. |
required |
error
|
Exception
|
Exception object. |
None
|
Source code in src\templates\_core.py
redirect_template(template_class: type[BaseTemplate], template_file: Union[str, Path], layout, **kwargs) -> BaseTemplate
¶
Reroutes template initialization to another template class and PSD file.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_class
|
type[BaseTemplate]
|
Template class to reroute to. |
required |
template_file
|
str | Path
|
Filename of the PSD to load with this template class. |
required |
layout
|
The card layout object. |
required |
Returns:
| Type | Description |
|---|---|
BaseTemplate
|
Initialized template class object. |
Source code in src\templates\_core.py
reset() -> None
¶
Reset the document, purge the cache, end await.
rules_text_and_pt_layers() -> None
¶
Add rules and power/toughness text.
Source code in src\templates\_core.py
run_tasks(funcs: list[Callable], message: str, warning: bool = False, args: Union[Iterable[Any], None] = None, kwargs: Optional[dict] = None) -> bool
¶
Run a list of functions, checking for thread cancellation and exceptions on each.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
funcs
|
list[Callable]
|
List of functions to perform. |
required |
message
|
str
|
Error message to raise if exception occurs. |
required |
warning
|
bool
|
Warn the user if True, otherwise raise error. |
False
|
args
|
Iterable[Any] | None
|
Optional arguments to pass to the func. Empty tuple if not provided. |
None
|
kwargs
|
dict | None
|
Optional keyword arguments to pass to the func. Empty dict if not provided. |
None
|
Returns:
| Type | Description |
|---|---|
bool
|
True if tasks completed, False if exception occurs or thread is cancelled. |
Source code in src\templates\_core.py
text_layers_mdfc() -> None
¶
Adds and modifies text layers required by modal double faced cards.
Source code in src\templates\mdfc.py
text_layers_mdfc_back() -> None
¶
text_layers_mdfc_front() -> None
¶
text_layers_transform() -> None
¶
Adds and modifies text layers for transform cards.
Source code in src\templates\transform.py
text_layers_transform_back() -> None
¶
Adds and modifies text layers for back face transform cards.
Source code in src\templates\transform.py
text_layers_transform_front() -> None
¶
Adds and modifies text layers for front face transform cards.