blueprint module¶
Supplemental script which handles data manipulation.
Read an XML file and produce a layout list, which is then used
by the main script cardassembler
.
-
class
blueprint.
Blueprint
(file_path)[source]¶ Blueprint information handling class.
Can read XML file, produce layout list and palette.
-
SPECIAL_TAGS
= ['next', 'text']¶ Those tags are always stored in a
list
& have extra treatment in_step_in()
.
-
_ElementTree_to_dict
(parent)[source]¶ Translation from
xml.etree.ElementTree
todict
tree from the given node down.Tags in
SPECIAL_TAGS
are stored in alist
.- Parameters
parent (
ElementTree.Element
) – A node of ElementTree- Returns
Dictionary representation of the given tree
- Return type
-
_parse
(text, target_type)[source]¶ ElementTree.element.text to various python types.
Input parsed as tuple can have any length. Its elements will be parsed as
int
-
generate_layout
(start_by)[source]¶ Generate card layout given starting position.
Starting position children are sorted alphabetically (name them accordingly).
- Parameters
start_by (str) – Space separated path through data tree leading to the starting node
- Returns
Layout of the chosen card
- Return type
list
-
_step_in
(layout, this_step)[source]¶ Browse data guided by the
next
tag.Do not overwrite (first in stays). Further
next
tags are served successively in the order according to the XML file. If there are multipletext
tags, join them by\n
-
_goto
(next_steps)[source]¶ Find target dict tree node and return its sub tree.
Analogous to successive application of
dict.get()
.
-