Skip to content

Commit

Permalink
Add simple style to Cable dataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
martinrieder committed Jul 13, 2024
1 parent f0b242d commit a91961e
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ class Cable:
spn: Union[MultilineHypertext, List[MultilineHypertext], None] = None
pn: Union[Hypertext, List[Hypertext], None] = None
category: Optional[str] = None
style: Optional[str] = None
type: Optional[MultilineHypertext] = None
gauge: Optional[float] = None
gauge_unit: Optional[str] = None
Expand Down Expand Up @@ -368,9 +369,14 @@ def __post_init__(self) -> None:
else:
raise Exception("lists of part data are only supported for bundles")


if self.show_name is None:
# hide designators for auto-generated cables by default
self.show_name = self.name[0:2] != "__"
# hide designators for simple and for auto-generated cables by default
self.show_name = self.style != "simple" and self.name[0:2] != "__"

if self.show_wirecount is None:
# hide wirecount for simple (1 pin) connectors by default
self.show_wirecount = self.style != "simple"

if self.show_wirenumbers is None:
# by default, show wire numbers for cables, hide for bundles
Expand Down

0 comments on commit a91961e

Please sign in to comment.