Skip to content

Commit 8cd3e2d

Browse files
stevegtkvid
authored andcommitted
Add length_unit
- partial fix for wireviz#7 - based on and closes wireviz#161 and wireviz#162
1 parent b4a77e8 commit 8cd3e2d

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

src/wireviz/DataClasses.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class Cable:
176176
gauge_unit: Optional[str] = None
177177
show_equiv: bool = False
178178
length: float = 0
179-
lengthunit: Optional[str] = None
179+
length_unit: Optional[str] = None
180180
color: Optional[Color] = None
181181
wirecount: Optional[int] = None
182182
shield: Union[bool, Color] = False
@@ -216,8 +216,8 @@ def __post_init__(self) -> None:
216216

217217
self.connections = []
218218

219-
if self.lengthunit is None: #Default wire length units to meters if left undeclared
220-
self.lengthunit = 'm'
219+
if self.length_unit is None: #Default wire length units to meters if left undeclared
220+
self.length_unit = 'm'
221221

222222
if self.wirecount: # number of wires explicitly defined
223223
if self.colors: # use custom color palette (partly or looped if needed)

src/wireviz/Harness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def create_graph(self) -> Graph:
203203
f'{cable.wirecount}x' if cable.show_wirecount else None,
204204
f'{cable.gauge} {cable.gauge_unit}{awg_fmt}' if cable.gauge else None,
205205
'+ S' if cable.shield else None,
206-
f'{cable.length} {cable.lengthunit}' if cable.length > 0 else None,
206+
f'{cable.length} {cable.length_unit}' if cable.length > 0 else None,
207207
cable.color, html_colorbar(cable.color)],
208208
'<!-- wire table -->',
209209
[html_image(cable.image)],

src/wireviz/wv_bom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def generate_bom(harness):
6767
+ (f' x {cable.gauge} {cable.gauge_unit}' if cable.gauge else ' wires')
6868
+ (' shielded' if cable.shield else ''))
6969
bom_entries.append({
70-
'item': description, 'qty': cable.length, 'unit': cable.lengthunit, 'designators': cable.name if cable.show_name else None,
70+
'item': description, 'qty': cable.length, 'unit': cable.length_unit, 'designators': cable.name if cable.show_name else None,
7171
'manufacturer': cable.manufacturer, 'mpn': cable.mpn, 'pn': cable.pn
7272
})
7373
else:

0 commit comments

Comments
 (0)