Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
sudo apt-get update
sudo apt-get install -y python3-tk
python -m pip install --upgrade pip
pip install pylint
pip install pylint pillow
python -m pip install mypy

- name: Analysing the code with pylint
Expand Down
Binary file added Assets/Icons/battery.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion arduino_logique.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def main():
# Creating main window
win = tk.Tk()
win.title("Laboratoire virtuel de circuit logique - GIF-1002")
win.geometry("1400x800") # Initial window size
win.geometry("1700x800") # Initial window size
win.resizable(False, False) # Disabling window resizing
win.configure(bg="#333333") # Setting consistent background color

Expand Down
24 changes: 23 additions & 1 deletion breadboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
HORIZONTAL,
PERSO,
VERTICAL,
USED,
)


Expand Down Expand Up @@ -156,7 +157,7 @@ def draw_matrix_points(self, scale=1): # used to debug the matrix
radius = 2 * scale # Adjust size as needed
self.canvas.create_oval(x - radius, y - radius, x + radius, y + radius, fill=color, outline="")

def draw_blank_board_model(self, x_origin: int = 50, y_origin: int = 10):
def draw_blank_board_model(self, x_origin: int = 50, y_origin: int = 10, battery_pos_wire_end=None, battery_neg_wire_end=None):
"""
Draws a blank breadboard model on the canvas.
"""
Expand Down Expand Up @@ -223,3 +224,24 @@ def draw_blank_board_model(self, x_origin: int = 50, y_origin: int = 10):
(self.sketcher.go_xy, 1, {"line": 0, "column": 0, "id_origin": "circTest"}),
]
self.sketcher.circuit(x_origin, y_origin, scale=self.sketcher.scale_factor, model=blank_board_model)

battery_x = x_origin + 1200 # Adjust as needed for proper positioning
battery_y = y_origin + 300 # Adjust as needed for proper positioning

# Reset all matrix elements' states to FREE
for key in self.sketcher.matrix:
self.sketcher.matrix[key]['state'] = FREE

self.sketcher.draw_battery(
battery_x,
battery_y,
pos_wire_end=battery_pos_wire_end,
neg_wire_end=battery_neg_wire_end,
)
if battery_pos_wire_end:
allowed_positions = self.sketcher.get_power_line_last_pins()
nearest_point, nearest_point_coord = self.sketcher.find_nearest_allowed_grid_point(battery_pos_wire_end[0], battery_pos_wire_end[1], allowed_positions)
col, line = nearest_point_coord
self.sketcher.matrix[f'{col},{line}']['state'] = USED


Loading
Loading