diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index 56a38589..09333049 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -12,10 +12,12 @@ CableMultiplier = str # = Literal['wirecount', 'terminations', 'length', 'total_length'] ImageScale = str # = Literal['false', 'true', 'width', 'height', 'both'] -Designator = str # Case insensitive unique name of connector or cable -Pin = Union[int, str] # Pin identifier -Wire = Union[int, str] # Wire number or 's' for shield -MLstr = str # Multi-line string where any newline is properly handled +PlainText = str # Text not containing HTML tags nor newlines +Hypertext = str # Text possibly including HTML hyperlinks that are removed in all outputs except HTML output +MultilineHypertext = str # Hypertext possibly also including newlines to break lines in diagram output +Designator = PlainText # Case insensitive unique name of connector or cable +Pin = Union[int, PlainText] # Pin identifier +Wire = Union[int, PlainText] # Wire number or Literal['s'] for shield Color = str # Two-letter color name = Literal[wv_colors._color_hex.keys()] Colors = str # One or more two-letter color names (Color) concatenated into one string ColorScheme = str # Color scheme name = Literal[wv_colors.COLOR_CODES.keys()] @@ -34,7 +36,7 @@ class Image: height: Optional[int] = None fixedsize: Optional[bool] = None # Contents of the text cell just below the image cell: - caption: Optional[MLstr] = None + caption: Optional[MultilineHypertext] = None # See also HTML doc at https://graphviz.org/doc/info/shapes.html#html def __post_init__(self, gv_dir): @@ -60,11 +62,11 @@ def __post_init__(self, gv_dir): @dataclass class AdditionalComponent: - type: MLstr - subtype: Optional[MLstr] = None - manufacturer: Optional[MLstr] = None - mpn: Optional[MLstr] = None - pn: Optional[str] = None + type: MultilineHypertext + subtype: Optional[MultilineHypertext] = None + manufacturer: Optional[MultilineHypertext] = None + mpn: Optional[MultilineHypertext] = None + pn: Optional[Hypertext] = None qty: float = 1 unit: Optional[str] = None qty_multiplier: Union[ConnectorMultiplier, CableMultiplier, None] = None @@ -77,16 +79,16 @@ def description(self) -> str: @dataclass class Connector: name: Designator - manufacturer: Optional[MLstr] = None - mpn: Optional[MLstr] = None - pn: Optional[str] = None + manufacturer: Optional[MultilineHypertext] = None + mpn: Optional[MultilineHypertext] = None + pn: Optional[Hypertext] = None style: Optional[str] = None category: Optional[str] = None - type: Optional[MLstr] = None - subtype: Optional[MLstr] = None + type: Optional[MultilineHypertext] = None + subtype: Optional[MultilineHypertext] = None pincount: Optional[int] = None image: Optional[Image] = None - notes: Optional[MLstr] = None + notes: Optional[MultilineHypertext] = None pinlabels: List[Pin] = field(default_factory=list) pins: List[Pin] = field(default_factory=list) color: Optional[Color] = None @@ -167,11 +169,11 @@ def get_qty_multiplier(self, qty_multiplier: Optional[ConnectorMultiplier]) -> i @dataclass class Cable: name: Designator - manufacturer: Union[MLstr, List[MLstr], None] = None - mpn: Union[MLstr, List[MLstr], None] = None - pn: Union[str, List[str], None] = None + manufacturer: Union[MultilineHypertext, List[MultilineHypertext], None] = None + mpn: Union[MultilineHypertext, List[MultilineHypertext], None] = None + pn: Union[Hypertext, List[Hypertext], None] = None category: Optional[str] = None - type: Optional[MLstr] = None + type: Optional[MultilineHypertext] = None gauge: Optional[float] = None gauge_unit: Optional[str] = None show_equiv: bool = False @@ -180,7 +182,7 @@ class Cable: wirecount: Optional[int] = None shield: Union[bool, Color] = False image: Optional[Image] = None - notes: Optional[MLstr] = None + notes: Optional[MultilineHypertext] = None colors: List[Colors] = field(default_factory=list) color_code: Optional[ColorScheme] = None show_name: bool = True