From 67a25e390b4807bdf7d62d9b0ffd66ba6c729f43 Mon Sep 17 00:00:00 2001 From: William Sutton Date: Fri, 28 Aug 2020 18:02:14 -0400 Subject: [PATCH] Add support for units to wire lengths. Part 2 Will also be editing harness.py to add the support as well as defaulting units to meters if unpopulated. --- src/wireviz/DataClasses.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/wireviz/DataClasses.py b/src/wireviz/DataClasses.py index 6b3b1e3..4fba6e5 100644 --- a/src/wireviz/DataClasses.py +++ b/src/wireviz/DataClasses.py @@ -88,6 +88,7 @@ class Cable: gauge_unit: Optional[str] = None show_equiv: bool = False length: float = 0 + lengthunit: Optional[str] = None color: Optional[str] = None wirecount: Optional[int] = None shield: bool = False @@ -119,6 +120,9 @@ class Cable: self.connections = [] + if self.lengthunit is None: #Default wire length units to meters if left undeclared + self.lengthunit = 'm' + if self.wirecount: # number of wires explicitly defined if self.colors: # use custom color palette (partly or looped if needed) pass