Skip to content

Commit 79ec7dc

Browse files
committed
displaying pin_io numbers
1 parent 8d5f282 commit 79ec7dc

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

component_sketch.py

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2475,7 +2475,6 @@ def draw_pin_io(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZ
24752475
coord = kwargs.get("coord", [])
24762476
element_type = kwargs.get("type", INPUT)
24772477
color = kwargs.get("color", "#479dff")
2478-
assigned_pin = kwargs.get("assigned_pin", None)
24792478
thickness = 1 * scale
24802479

24812480
if element_id and self.current_dict_circuit.get(element_id):
@@ -2490,7 +2489,6 @@ def draw_pin_io(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZ
24902489
self.canvas.move(element_id, dx, dy)
24912490
params["XY"] = (x_origin, y_origin)
24922491
params["color"] = color
2493-
params["assigned_pin"] = assigned_pin
24942492

24952493
else:
24962494
if "io" not in self.id_type:
@@ -2507,7 +2505,6 @@ def draw_pin_io(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZ
25072505
params["controller_pin"] = "IO"
25082506
params["type"] = element_type
25092507
params["color"] = color
2510-
params["assigned_pin"] = assigned_pin
25112508

25122509
# tags here
25132510
pin_tag = f"pin_io_{element_id}"
@@ -2561,6 +2558,25 @@ def draw_pin_io(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZ
25612558
# Bring the rhombus to the front
25622559
self.canvas.tag_raise(element_id)
25632560

2561+
# take the last number of the element_id as the pin number as an integer
2562+
pin_number = element_id.split("_")[-1]
2563+
2564+
label_x = x_distance + x_origin + 5 * scale,
2565+
label_y = y_distance + y_origin - 48 * scale,
2566+
2567+
label_tag = f"{element_id}_label"
2568+
text_id = self.canvas.create_text(
2569+
label_x,
2570+
label_y,
2571+
text=pin_number,
2572+
font=("FiraCode-Bold", int(10 * scale)),
2573+
fill="#000000",
2574+
anchor="center",
2575+
tags=(element_id, label_tag),
2576+
)
2577+
params["label_tag"] = label_tag
2578+
params["tags"].append(text_id)
2579+
25642580
if element_type == INPUT:
25652581
# Arrow pointing down
25662582
arrow_line_id = self.canvas.create_line(
@@ -2612,6 +2628,8 @@ def draw_pin_io(self, x_distance, y_distance, scale=1, width=-1, direction=HORIZ
26122628
)
26132629
params["tags"].append(arrow_head_id)
26142630

2631+
2632+
26152633
self.current_dict_circuit[element_id] = params
26162634

26172635
print("coord : " + str(coord[0][0]) + "," + str(coord[0][1]))

0 commit comments

Comments
 (0)