Make cable name hidden by default
This commit is contained in:
parent
075d9ed9db
commit
006fdba677
@ -6,7 +6,7 @@ COLORS_WEIRD = ("infrared","ultraviolet","transparent","invisible")
|
|||||||
# example 1
|
# example 1
|
||||||
X1 = wireviz.Node("X1", pinout=PINOUT_SERIAL, ports_right=True)
|
X1 = wireviz.Node("X1", pinout=PINOUT_SERIAL, ports_right=True)
|
||||||
X2 = wireviz.Node("X2", num_pins=6, ports_left=True)
|
X2 = wireviz.Node("X2", num_pins=6, ports_left=True)
|
||||||
W1 = wireviz.Cable("W1", num_wires=3, color_code="DIN", shield=True)
|
W1 = wireviz.Cable("W1", show_name=True, num_wires=3, color_code="DIN", shield=True)
|
||||||
W1.connect(X1,(2,3,5),(1,2,3),X2,(1,3,2))
|
W1.connect(X1,(2,3,5),(1,2,3),X2,(1,3,2))
|
||||||
X2.loop(5,6)
|
X2.loop(5,6)
|
||||||
objects = [X1, X2, W1]
|
objects = [X1, X2, W1]
|
||||||
|
|||||||
@ -90,8 +90,9 @@ class Node:
|
|||||||
|
|
||||||
class Cable:
|
class Cable:
|
||||||
|
|
||||||
def __init__(self, name, num_wires=None, colors=None, color_code=None, shield=False):
|
def __init__(self, name, show_name=False, num_wires=None, colors=None, color_code=None, shield=False):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
self.show_name = show_name
|
||||||
self.connections = []
|
self.connections = []
|
||||||
if color_code is None and colors is None:
|
if color_code is None and colors is None:
|
||||||
self.colors = ("",) * num_wires
|
self.colors = ("",) * num_wires
|
||||||
@ -139,7 +140,12 @@ class Cable:
|
|||||||
def graphviz(self):
|
def graphviz(self):
|
||||||
s = ''
|
s = ''
|
||||||
# print header
|
# print header
|
||||||
s = s + '{name}[label="{name} | {{'.format(name=self.name)
|
s = s + '{name}[label="'.format(name=self.name)
|
||||||
|
|
||||||
|
if self.show_name == True:
|
||||||
|
s = s + '{name} | '.format(name=self.name)
|
||||||
|
|
||||||
|
s = s + '{'
|
||||||
# print pinout
|
# print pinout
|
||||||
s = s + '{'
|
s = s + '{'
|
||||||
l = []
|
l = []
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user