Skip to content

Commit 5d131a0

Browse files
authored
Merge 6249768 into 7bf0af5
2 parents 7bf0af5 + 6249768 commit 5d131a0

File tree

6 files changed

+112
-66
lines changed

6 files changed

+112
-66
lines changed

.github/workflows/release_pipeline.yml

Lines changed: 2 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,34 +9,6 @@ on:
99
- master
1010

1111
jobs:
12-
build-macos:
13-
runs-on: macos-latest
14-
steps:
15-
- name: Checkout code
16-
uses: actions/checkout@v4
17-
18-
- name: Set up Python
19-
uses: actions/setup-python@v5
20-
with:
21-
python-version: '3.x'
22-
23-
- name: Install PyInstaller
24-
run: pip install pyinstaller pyserial
25-
26-
- name: Build with PyInstaller
27-
run: pyinstaller arduino_logique.spec
28-
29-
- name: Compress the build
30-
run: |
31-
cd dist
32-
tar -czvf arduino_logique_macos.tar.gz arduino_logique
33-
34-
- name: Upload artifact
35-
uses: actions/upload-artifact@v3
36-
with:
37-
name: macos-build
38-
path: dist/arduino_logique_macos.tar.gz
39-
4012
build-ubuntu:
4113
runs-on: ubuntu-latest
4214
steps:
@@ -92,7 +64,7 @@ jobs:
9264
path: arduino_logique_windows.zip
9365

9466
release:
95-
needs: [build-macos, build-ubuntu, build-windows]
67+
needs: [build-ubuntu, build-windows]
9668
runs-on: ubuntu-latest
9769
permissions:
9870
contents: write
@@ -102,12 +74,6 @@ jobs:
10274
with:
10375
fetch-depth: 0
10476

105-
- name: Download macOS build
106-
uses: actions/download-artifact@v3
107-
with:
108-
name: macos-build
109-
path: ./dist/
110-
11177
- name: Download Ubuntu build
11278
uses: actions/download-artifact@v3
11379
with:
@@ -132,7 +98,7 @@ jobs:
13298
- name: Create release
13399
uses: ncipollo/release-action@v1
134100
with:
135-
artifacts: "./dist/arduino_logique_macos.tar.gz,./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip"
101+
artifacts: "./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip"
136102
token: ${{ secrets.GITHUB_TOKEN }}
137103
tag: ${{ steps.bump.outputs.new_tag }}
138104
makeLatest: ${{ !contains(steps.bump.outputs.new_tag, 'beta') }}

Assets/Icons/clock.png

1.5 KB
Loading

menus.py

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,20 @@
88
from dataclasses import dataclass
99
import os
1010
import tkinter as tk
11-
from tkinter import messagebox, filedialog, ttk
1211
import json
1312
import subprocess
1413
import platform
15-
from typing import Callable
1614
import serial.tools.list_ports # type: ignore
1715

1816
from breadboard import Breadboard
1917

20-
from dataCDLT import INPUT, OUTPUT, USED, CLOCK
18+
from dataCDLT import INPUT, OUTPUT, CLOCK
19+
20+
if os.name == "darwin":
21+
from tkinter import messagebox, filedialog, ttk
22+
from tkmacosx import Button # type: ignore
23+
else:
24+
from tkinter import Button, messagebox, filedialog, ttk
2125

2226
MICROCONTROLLER_PINS = {
2327
"Arduino Mega": {
@@ -169,6 +173,7 @@ def select_microcontroller(self):
169173
available_microcontrollers = list(MICROCONTROLLER_PINS.keys())
170174
# Create a combobox with the options
171175
combobox = ttk.Combobox(dialog, values=available_microcontrollers)
176+
combobox.set(self.selected_microcontroller if self.selected_microcontroller else "Choisir un microcontrôleur")
172177
combobox.pack(pady=10)
173178

174179
# Create a button to confirm the selection
@@ -181,13 +186,15 @@ def confirm_selection():
181186
self.microcontroller_label.config(text=self.selected_microcontroller)
182187
dialog.destroy()
183188

184-
confirm_button = tk.Button(dialog, text="Confirmer", command=confirm_selection)
189+
confirm_button = Button(dialog, text="Confirmer", command=confirm_selection)
185190
confirm_button.pack(pady=10)
186191

187192
def show_correspondence_table(self):
188193
"""Displays the correspondence table between pin_io objects and microcontroller pins in a table format."""
189194
if self.selected_microcontroller is None:
190-
messagebox.showwarning("Aucun microcontrôleur sélectionné", "Veuillez d'abord sélectionner un microcontrôleur.")
195+
messagebox.showwarning(
196+
"Aucun microcontrôleur sélectionné", "Veuillez d'abord sélectionner un microcontrôleur."
197+
)
191198
return
192199

193200
pin_mappings = MICROCONTROLLER_PINS.get(self.selected_microcontroller)
@@ -279,7 +286,7 @@ def create_menu(self, menu_name, options, menu_commands):
279286
- options (list): List of options under the menu.
280287
"""
281288
# Create the menu button
282-
btn = tk.Button(
289+
btn = Button(
283290
self.menu_bar,
284291
text=menu_name,
285292
bg="#333333",
@@ -312,7 +319,7 @@ def select_menu_item(option):
312319

313320
# Populate the dropdown with menu options
314321
for option in options:
315-
option_btn = tk.Button(
322+
option_btn = Button(
316323
dropdown,
317324
text=option,
318325
bg="#333333",
@@ -343,7 +350,7 @@ def toggle_dropdown(self, menu_name):
343350
- menu_name (str): The name of the menu to toggle.
344351
"""
345352
for child in self.menu_bar.winfo_children():
346-
if isinstance(child, tk.Button) and hasattr(child, "dropdown"):
353+
if isinstance(child, Button) and hasattr(child, "dropdown"):
347354
if child["text"] == menu_name:
348355
if child.dropdown.winfo_ismapped():
349356
child.dropdown.place_forget()
@@ -387,11 +394,11 @@ def close_dropdown(self, event):
387394
and not any(
388395
self.is_descendant(event.widget, child.dropdown)
389396
for child in self.menu_bar.winfo_children()
390-
if isinstance(child, tk.Button) and hasattr(child, "dropdown")
397+
if isinstance(child, Button) and hasattr(child, "dropdown")
391398
)
392399
):
393400
for child in self.menu_bar.winfo_children():
394-
if isinstance(child, tk.Button) and hasattr(child, "dropdown"):
401+
if isinstance(child, Button) and hasattr(child, "dropdown"):
395402
child.dropdown.place_forget()
396403

397404
# Menu Handler Functions
@@ -424,9 +431,9 @@ def open_file(self):
424431

425432
for key, val in circuit_data.items():
426433
if key == "_battery_pos_wire":
427-
battery_pos_wire_end = val['end']
434+
battery_pos_wire_end = val["end"]
428435
elif key == "_battery_neg_wire":
429-
battery_neg_wire_end = val['end']
436+
battery_neg_wire_end = val["end"]
430437

431438
self.board.draw_blank_board_model(
432439
x_o,
@@ -451,7 +458,9 @@ def open_file(self):
451458
messagebox.showinfo("Ouvrir un fichier", f"Circuit chargé depuis {file_path}")
452459
except Exception as e:
453460
print(f"Error loading file: {e}")
454-
messagebox.showerror("Erreur d'ouverture", f"Une erreur s'est produite lors de l'ouverture du fichier:\n{e}")
461+
messagebox.showerror(
462+
"Erreur d'ouverture", f"Une erreur s'est produite lors de l'ouverture du fichier:\n{e}"
463+
)
455464
raise e
456465
else:
457466
print("Open file cancelled.")
@@ -529,7 +538,7 @@ def save_file(self):
529538
if "label" in comp_data:
530539
comp_data["label"] = comp_data["type"]
531540
if "wire" in key:
532-
comp_data.pop("XY", None) # Remove XY, will be recalculated anyway
541+
comp_data.pop("XY", None) # Remove XY, will be recalculated anyway
533542
if key == "_battery":
534543
comp_data.pop("battery_rect", None)
535544
# Save the data to a JSON file
@@ -539,7 +548,9 @@ def save_file(self):
539548
messagebox.showinfo("Sauvegarde réussie", f"Circuit sauvegardé dans {file_path}")
540549
except (TypeError, KeyError) as e:
541550
print(f"Error saving file: {e}")
542-
messagebox.showerror("Erreur de sauvegarde", f"Une erreur s'est produite lors de la sauvegarde du fichier:\n{e}")
551+
messagebox.showerror(
552+
"Erreur de sauvegarde", f"Une erreur s'est produite lors de la sauvegarde du fichier:\n{e}"
553+
)
543554
else:
544555
print("Save file cancelled.")
545556

@@ -568,7 +579,7 @@ def confirm_selection():
568579
self.serial_port.com_port = selected_option
569580
dialog.destroy()
570581

571-
confirm_button = tk.Button(dialog, text="Confirm", command=confirm_selection)
582+
confirm_button = Button(dialog, text="Confirm", command=confirm_selection)
572583
confirm_button.pack(pady=10)
573584

574585
def open_documentation(self):

readme.md

Lines changed: 64 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,47 @@
1313
## Contents
1414

1515
- [Installation Instructions (English)](#installation-instructions)
16+
- [MacOS installation](#macos-installation)
1617
- [Windows installation](#windows-installation)
1718
- [Microcontroller](#microcontroller)
1819
- [Instructions d'installation (Français)](#instructions-dinstallation)
19-
- [Microcontrôleur](#microcontrôleur)
20+
- [Installation sur MacOS](#installation-sur-macos)
2021
- [Installation sur Windows](#installation-sur-windows)
22+
- [Microcontrôleur](#microcontrôleur)
2123

2224
## Installation Instructions
2325

2426
Please go to the [release page](https://github.com/Team-Arduino-Logique/Arduino-Logique/releases) and download the latest release for your operating system.
2527

28+
### MacOS installation
29+
30+
#### Prerequisites for macOS
31+
32+
1. Install Python 3.
33+
2. Install the required Python packages:
34+
- pyserial
35+
- tkmacosx
36+
37+
You can install the packages using pip:
38+
39+
```sh
40+
pip install pyserial tkmacosx
41+
```
42+
43+
To download the source code, click on the green `<> Code` button at the top of this page and select "Download Zip".
44+
45+
You can also clone the repository using git. Open a terminal and run the following command:
46+
47+
```sh
48+
git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git
49+
```
50+
51+
This will create a local copy of the repository on your machine.
52+
53+
#### Running `arduino_logique.py` on MacOS
54+
55+
After installing the prerequisites, you can run the `arduino_logique.py` script.
56+
2657
### Windows installation
2758

2859
Windows Defender will warn you about an unverified program. You can still execute it by clicking "More information", then "Continue".
@@ -35,12 +66,41 @@ Windows Defender will warn you about an unverified program. You can still execut
3566

3667
Veuillez vous rendre sur la [page des versions](https://github.com/Team-Arduino-Logique/Arduino-Logique/releases) et télécharger la dernière version pour votre système d'exploitation.
3768

38-
### Microcontrôleur
69+
### Installation sur MacOS
3970

40-
#### TODO instructions pour microcontrôleur
71+
#### Prérequis pour macOS
72+
73+
1. Installez Python 3.
74+
2. Installez les packages Python requis :
75+
- pyserial
76+
- tkmacosx
77+
78+
Vous pouvez installer les packages en utilisant pip :
79+
80+
```sh
81+
pip install pyserial tkmacosx
82+
```
83+
84+
Pour télécharger le code source, cliquez sur le bouton vert `<> Code` en haut de cette page et choisir "Download Zip".
85+
86+
Vous pouvez aussi cloner le dépôt en utilisant git. Ouvrez un terminal et exécutez la commande suivante :
87+
88+
```sh
89+
git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git
90+
```
91+
92+
Cela créera une copie locale du dépôt sur votre machine.
93+
94+
#### Exécution de `arduino_logique.py` sur MacOS
95+
96+
Après avoir installé les prérequis, vous pouvez exécuter le script `arduino_logique.py`.
4197

4298
### Installation sur Windows
4399

44100
Lors de l'installation sur Windows, un avertissement de sécurité peut apparaître. Pour continuer, cliquez sur "Informations complémentaires", puis sélectionnez "Exécuter quand même".
45101

46-
![Avertissement de sécurité Windows](docs/images/defender-warning-french.png)
102+
![Avertissement de sécurité Windows](docs/images/defender-warning-french.png)
103+
104+
### Microcontrôleur
105+
106+
#### TODO instructions pour microcontrôleur

sidebar.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
from dataclasses import dataclass
88
from pathlib import Path
99
import tkinter as tk
10-
from tkinter import messagebox, font
1110
import os
1211
from typing import Callable, Tuple
1312
import subprocess
@@ -18,6 +17,12 @@
1817
from dataCDLT import FREE, USED
1918
from object_model.circuit_object_model import Chip, get_all_available_chips, get_chip_modification_times
2019

20+
if os.name == "darwin":
21+
from tkinter import messagebox, font
22+
from tkmacosx import Button # type: ignore
23+
else:
24+
from tkinter import Button, messagebox, font
25+
2126

2227
@dataclass
2328
class SidebarGrid:
@@ -217,7 +222,7 @@ def display_chips(self, chips: list[Tuple[Chip, tk.PhotoImage]]):
217222
for index, (chip, chip_image) in enumerate(display_chips):
218223
row = index // self.sidebar_grid.columns
219224
col = index % self.sidebar_grid.columns
220-
btn = tk.Button(
225+
btn = Button(
221226
self.chips_inner_frame,
222227
image=chip_image,
223228
text=chip.chip_type,
@@ -257,7 +262,7 @@ def create_manage_button(self, sidebar_frame):
257262
"""
258263
Creates the 'Manage Components' button at the bottom of the sidebar without an icon.
259264
"""
260-
manage_button = tk.Button(
265+
manage_button = Button(
261266
sidebar_frame,
262267
text="Gérer les composants",
263268
bg="#333333", # Matching the sidebar's background to simulate transparency

0 commit comments

Comments
 (0)