From 6bb9fe66ee13b0d2c1c0b97d39746b6538dfc82b Mon Sep 17 00:00:00 2001 From: Charles-Olivier Trudel Date: Tue, 26 Nov 2024 20:40:24 -0500 Subject: [PATCH 1/6] Change references to buttons + fixed pipeline --- .github/workflows/release_pipeline.yml | 2 +- menus.py | 24 ++++++++++++++---------- sidebar.py | 11 ++++++++--- toolbar.py | 18 +++++++++++------- 4 files changed, 34 insertions(+), 21 deletions(-) diff --git a/.github/workflows/release_pipeline.yml b/.github/workflows/release_pipeline.yml index 0e1c171..96c16bb 100644 --- a/.github/workflows/release_pipeline.yml +++ b/.github/workflows/release_pipeline.yml @@ -21,7 +21,7 @@ jobs: python-version: '3.x' - name: Install PyInstaller - run: pip install pyinstaller pyserial + run: pip install pyinstaller pyserial tkmacosx - name: Build with PyInstaller run: pyinstaller arduino_logique.spec diff --git a/menus.py b/menus.py index 2bcf6ac..e475f2e 100644 --- a/menus.py +++ b/menus.py @@ -8,16 +8,20 @@ from dataclasses import dataclass import os import tkinter as tk -from tkinter import messagebox, filedialog, ttk import json import subprocess import platform -from typing import Callable import serial.tools.list_ports # type: ignore from breadboard import Breadboard -from dataCDLT import INPUT, OUTPUT, USED +from dataCDLT import INPUT, OUTPUT + +if os.name == "darwin": + from tkinter import messagebox, filedialog, ttk + from tkmacosx import Button # type: ignore +else: + from tkinter import Button, messagebox, filedialog, ttk MICROCONTROLLER_PINS = { "Arduino Mega": { @@ -173,7 +177,7 @@ def confirm_selection(): print(f"{selected_option} selected.") dialog.destroy() - confirm_button = tk.Button(dialog, text="Confirm", command=confirm_selection) + confirm_button = Button(dialog, text="Confirm", command=confirm_selection) confirm_button.pack(pady=10) def show_correspondence_table(self): @@ -260,7 +264,7 @@ def create_menu(self, menu_name, options, menu_commands): - options (list): List of options under the menu. """ # Create the menu button - btn = tk.Button( + btn = Button( self.menu_bar, text=menu_name, bg="#333333", @@ -293,7 +297,7 @@ def select_menu_item(option): # Populate the dropdown with menu options for option in options: - option_btn = tk.Button( + option_btn = Button( dropdown, text=option, bg="#333333", @@ -324,7 +328,7 @@ def toggle_dropdown(self, menu_name): - menu_name (str): The name of the menu to toggle. """ for child in self.menu_bar.winfo_children(): - if isinstance(child, tk.Button) and hasattr(child, "dropdown"): + if isinstance(child, Button) and hasattr(child, "dropdown"): if child["text"] == menu_name: if child.dropdown.winfo_ismapped(): child.dropdown.place_forget() @@ -368,11 +372,11 @@ def close_dropdown(self, event): and not any( self.is_descendant(event.widget, child.dropdown) for child in self.menu_bar.winfo_children() - if isinstance(child, tk.Button) and hasattr(child, "dropdown") + if isinstance(child, Button) and hasattr(child, "dropdown") ) ): for child in self.menu_bar.winfo_children(): - if isinstance(child, tk.Button) and hasattr(child, "dropdown"): + if isinstance(child, Button) and hasattr(child, "dropdown"): child.dropdown.place_forget() # Menu Handler Functions @@ -549,7 +553,7 @@ def confirm_selection(): self.serial_port.com_port = selected_option dialog.destroy() - confirm_button = tk.Button(dialog, text="Confirm", command=confirm_selection) + confirm_button = Button(dialog, text="Confirm", command=confirm_selection) confirm_button.pack(pady=10) def open_documentation(self): diff --git a/sidebar.py b/sidebar.py index 03b3286..dbe6fb1 100644 --- a/sidebar.py +++ b/sidebar.py @@ -7,7 +7,6 @@ from dataclasses import dataclass from pathlib import Path import tkinter as tk -from tkinter import messagebox, font import os from typing import Callable, Tuple import subprocess @@ -18,6 +17,12 @@ from dataCDLT import FREE, USED from object_model.circuit_object_model import Chip, get_all_available_chips, get_chip_modification_times +if os.name == "darwin": + from tkinter import messagebox, font + from tkmacosx import Button # type: ignore +else: + from tkinter import Button, messagebox, font + @dataclass class SidebarGrid: @@ -217,7 +222,7 @@ def display_chips(self, chips: list[Tuple[Chip, tk.PhotoImage]]): for index, (chip, chip_image) in enumerate(display_chips): row = index // self.sidebar_grid.columns col = index % self.sidebar_grid.columns - btn = tk.Button( + btn = Button( self.chips_inner_frame, image=chip_image, text=chip.chip_type, @@ -257,7 +262,7 @@ def create_manage_button(self, sidebar_frame): """ Creates the 'Manage Components' button at the bottom of the sidebar without an icon. """ - manage_button = tk.Button( + manage_button = Button( sidebar_frame, text="Manage Components", bg="#333333", # Matching the sidebar's background to simulate transparency diff --git a/toolbar.py b/toolbar.py index 9729d4b..40ff0c8 100644 --- a/toolbar.py +++ b/toolbar.py @@ -5,16 +5,20 @@ for selecting connection colors. The Toolbar class manages the state and behavior of these buttons and handles user interactions for placing wires and pin_ios on a canvas. """ - +import os from dataclasses import dataclass from pathlib import Path import tkinter as tk -from tkinter import messagebox, colorchooser -import os + from component_sketch import ComponentSketcher from dataCDLT import INPUT, OUTPUT, FREE from utils import resource_path +if os.name == "darwin": + from tkinter import messagebox, colorchooser + from tkmacosx import Button # type: ignore +else: + from tkinter import Button, messagebox, colorchooser @dataclass class WirePlacementInfo: @@ -45,7 +49,7 @@ def __init__(self, parent: tk.Tk, canvas: tk.Canvas, sketcher: ComponentSketcher self.sketcher = sketcher self.current_dict_circuit = current_dict_circuit self.selected_color = "#479dff" - self.buttons: dict[str, tk.Button] = {} + self.buttons: dict[str, Button] = {} self.tool_mode = None self.wire_info: WirePlacementInfo = WirePlacementInfo(0, None, None) self.cursor_indicator_id = None @@ -78,7 +82,7 @@ def create_topbar(self, parent: tk.Tk): self.create_button("Output", left_frame, images) # Create the color chooser and Delete button in the right frame - self.color_button = tk.Button( + self.color_button = Button( right_frame, bg=self.selected_color, width=2, @@ -128,7 +132,7 @@ def create_button(self, action: str, parent_frame: tk.Frame, images: dict[str, t """ image = images.get(action.lower()) if image: - btn = tk.Button( + btn = Button( parent_frame, image=image, bg="#505050", # Inactive background @@ -144,7 +148,7 @@ def create_button(self, action: str, parent_frame: tk.Frame, images: dict[str, t btn.image = image # type: ignore else: # Fallback button with text if image is not available - btn = tk.Button( + btn = Button( parent_frame, text=action, bg="#505050", # Inactive background From 938e1eee3b09242a89339b635cde40ac14159a5a Mon Sep 17 00:00:00 2001 From: Charles-Olivier Trudel Date: Thu, 28 Nov 2024 19:31:32 -0500 Subject: [PATCH 2/6] Readded clock --- Assets/Icons/clock.png | Bin 0 -> 1532 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Assets/Icons/clock.png diff --git a/Assets/Icons/clock.png b/Assets/Icons/clock.png new file mode 100644 index 0000000000000000000000000000000000000000..3c01ef4ce28317c2c921a3b8fce1f786c6ca9299 GIT binary patch literal 1532 zcmX|Bdr(w$7`?2>Z$FTa%NHufLlzf8QN)R{MSSdCu6Qqxb&&;SKo&PbeBpvCzGcUV zWwmrgM5iK%Oc|YgrITYrf{+rKiIR^-6G=tM2boQc`RH0rXXeZ~-}!yNf6gDD%VeD4 z>;0-X$8o;0B+lYE54A#24^k3~T`p3@W7(`325$e^;JeD;IbTQhNmv5Y*yS8qQv3kXd@^UFP4V~@X z_iWM`^c(5tx^m;!(ar4^XJ6kvdJ%j$<>`u!aU~Dj*}dmA2ilJ&X1Q{lAJQTm5pgl( zk-Rv*VB6)gj)+5jZrOTWvqk(yvq`+7afbX711AJO*x_yYm1guMR)b{ znT^*pyTvVuqHC&iB{gH0_DP6Uepe?}2QI4`HKCuMZoR6htf)xzgb{2#jAmsJ&x%22 zg^WaW`_i}7*bdP z=#LTdUrGg(5VI-Rj<5?U`V`E_^(}INs!%`LiE-mU#PI0*i+tSPzCm0YZX<) zd(X5QRKt2tw(3Y0uREIaT$3r&ALv$6@fu(Bgggbna z^|Gd_!jY&3e-hjHL${MjZ0Q zBS&HQfMW41>2W`qa5Lp&G1<^a4vZl;A~oP`I*6yJ1$WaqtfU?+qybDKPmH7h^dc?x zQyg}Zhs*nk{y$&0>@AddebiKr6YKf+Od(kaRc2%D?LU7c?64EgHA1ZmIT(S ze~yjv@0cfr*R(mrSZA@zhIQl-a$IYeWS2ab7uBkNITz)B`C~c!NaEX~&AHGufZGXz z_iAV9%#yYwDtT8)l%y@ayj{9=aMac_^D@Hg+A2kZGt*Ur(IkfyYtK*0m9=HZ+|qqp z Date: Thu, 28 Nov 2024 20:17:57 -0500 Subject: [PATCH 3/6] Added -h to tar on macos to preserve symlinks --- .github/workflows/release_pipeline.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release_pipeline.yml b/.github/workflows/release_pipeline.yml index 96c16bb..c3aeb94 100644 --- a/.github/workflows/release_pipeline.yml +++ b/.github/workflows/release_pipeline.yml @@ -29,7 +29,7 @@ jobs: - name: Compress the build run: | cd dist - tar -czvf arduino_logique_macos.tar.gz arduino_logique + tar -chzvf arduino_logique_macos.tar.gz arduino_logique - name: Upload artifact uses: actions/upload-artifact@v3 From 91dc1849e544a90ef7349c0c29ea1dbfc4c30327 Mon Sep 17 00:00:00 2001 From: Charles-Olivier Trudel Date: Thu, 28 Nov 2024 20:37:49 -0500 Subject: [PATCH 4/6] Fix microcontroller text --- menus.py | 1 + 1 file changed, 1 insertion(+) diff --git a/menus.py b/menus.py index c9e660a..fdded35 100644 --- a/menus.py +++ b/menus.py @@ -173,6 +173,7 @@ def select_microcontroller(self): available_microcontrollers = list(MICROCONTROLLER_PINS.keys()) # Create a combobox with the options combobox = ttk.Combobox(dialog, values=available_microcontrollers) + combobox.set(self.selected_microcontroller if self.selected_microcontroller else "Choisir un microcontrôleur") combobox.pack(pady=10) # Create a button to confirm the selection From 1977fae534f6070afdeb73ce280d01ebdfd0314e Mon Sep 17 00:00:00 2001 From: Charles-Olivier Trudel Date: Sat, 30 Nov 2024 18:26:11 -0500 Subject: [PATCH 5/6] Remove building on Mac and added installation instructions --- .github/workflows/release_pipeline.yml | 38 +------------- readme.md | 72 ++++++++++++++++++++++++-- 2 files changed, 70 insertions(+), 40 deletions(-) diff --git a/.github/workflows/release_pipeline.yml b/.github/workflows/release_pipeline.yml index c3aeb94..9ec7c95 100644 --- a/.github/workflows/release_pipeline.yml +++ b/.github/workflows/release_pipeline.yml @@ -9,34 +9,6 @@ on: - master jobs: - build-macos: - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: '3.x' - - - name: Install PyInstaller - run: pip install pyinstaller pyserial tkmacosx - - - name: Build with PyInstaller - run: pyinstaller arduino_logique.spec - - - name: Compress the build - run: | - cd dist - tar -chzvf arduino_logique_macos.tar.gz arduino_logique - - - name: Upload artifact - uses: actions/upload-artifact@v3 - with: - name: macos-build - path: dist/arduino_logique_macos.tar.gz - build-ubuntu: runs-on: ubuntu-latest steps: @@ -92,7 +64,7 @@ jobs: path: arduino_logique_windows.zip release: - needs: [build-macos, build-ubuntu, build-windows] + needs: [build-ubuntu, build-windows] runs-on: ubuntu-latest permissions: contents: write @@ -102,12 +74,6 @@ jobs: with: fetch-depth: 0 - - name: Download macOS build - uses: actions/download-artifact@v3 - with: - name: macos-build - path: ./dist/ - - name: Download Ubuntu build uses: actions/download-artifact@v3 with: @@ -132,7 +98,7 @@ jobs: - name: Create release uses: ncipollo/release-action@v1 with: - artifacts: "./dist/arduino_logique_macos.tar.gz,./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip" + artifacts: "./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip" token: ${{ secrets.GITHUB_TOKEN }} tag: ${{ steps.bump.outputs.new_tag }} makeLatest: ${{ !contains(steps.bump.outputs.new_tag, 'beta') }} diff --git a/readme.md b/readme.md index e1a322c..b13124c 100644 --- a/readme.md +++ b/readme.md @@ -13,16 +13,49 @@ ## Contents - [Installation Instructions (English)](#installation-instructions) + - [MacOS installation](#macos-installation) - [Windows installation](#windows-installation) - [Microcontroller](#microcontroller) - [Instructions d'installation (Français)](#instructions-dinstallation) - - [Microcontrôleur](#microcontrôleur) + - [Installation sur MacOS](#installation-sur-macos) - [Installation sur Windows](#installation-sur-windows) + - [Microcontrôleur](#microcontrôleur) ## Installation Instructions Please go to the [release page](https://github.com/Team-Arduino-Logique/Arduino-Logique/releases) and download the latest release for your operating system. +### MacOS installation + +#### Prerequisites for macOS + +1. Install Python 3. +2. Install the required Python packages: + - pyserial + - tkmacosx + +You can install the packages using pip: + +```sh +pip install pyserial tkmacosx +``` + +To download the source code, you can clone the repository using git. Open a terminal and run the following command: + +```sh +git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git +``` + +This will create a local copy of the repository on your machine. + +#### Running `arduino_logique.py` on MacOS + +After installing the prerequisites, you can run the `arduino_logique.py` script by navigating to the directory where the script is located and executing the following command in the terminal: + +```sh +python arduino_logique.py +``` + ### Windows installation Windows Defender will warn you about an unverified program. You can still execute it by clicking "More information", then "Continue". @@ -35,12 +68,43 @@ Windows Defender will warn you about an unverified program. You can still execut 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. -### Microcontrôleur +### Installation sur MacOS -#### TODO instructions pour microcontrôleur +#### Prérequis pour macOS + +1. Installez Python 3. +2. Installez les packages Python requis : + - pyserial + - tkmacosx + +Vous pouvez installer les packages en utilisant pip : + +```sh +pip install pyserial tkmacosx +``` + +Pour télécharger le code source, vous pouvez cloner le dépôt en utilisant git. Ouvrez un terminal et exécutez la commande suivante : + +```sh +git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git +``` + +Cela créera une copie locale du dépôt sur votre machine. + +#### Exécution de `arduino_logique.py` sur MacOS + +Après avoir installé les prérequis, vous pouvez exécuter le script `arduino_logique.py` en naviguant vers le répertoire où le script est situé et en exécutant la commande suivante dans le terminal : + +```sh +python arduino_logique.py +``` ### Installation sur Windows 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". -![Avertissement de sécurité Windows](docs/images/defender-warning-french.png) \ No newline at end of file +![Avertissement de sécurité Windows](docs/images/defender-warning-french.png) + +### Microcontrôleur + +#### TODO instructions pour microcontrôleur From 6249768a5024b708ef014817ea40996f9a89c2eb Mon Sep 17 00:00:00 2001 From: Charles-Olivier Trudel Date: Sat, 30 Nov 2024 18:31:11 -0500 Subject: [PATCH 6/6] Fix readme --- readme.md | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/readme.md b/readme.md index b13124c..e795a7d 100644 --- a/readme.md +++ b/readme.md @@ -40,7 +40,9 @@ You can install the packages using pip: pip install pyserial tkmacosx ``` -To download the source code, you can clone the repository using git. Open a terminal and run the following command: +To download the source code, click on the green `<> Code` button at the top of this page and select "Download Zip". + +You can also clone the repository using git. Open a terminal and run the following command: ```sh git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git @@ -50,11 +52,7 @@ This will create a local copy of the repository on your machine. #### Running `arduino_logique.py` on MacOS -After installing the prerequisites, you can run the `arduino_logique.py` script by navigating to the directory where the script is located and executing the following command in the terminal: - -```sh -python arduino_logique.py -``` +After installing the prerequisites, you can run the `arduino_logique.py` script. ### Windows installation @@ -83,7 +81,9 @@ Vous pouvez installer les packages en utilisant pip : pip install pyserial tkmacosx ``` -Pour télécharger le code source, vous pouvez cloner le dépôt en utilisant git. Ouvrez un terminal et exécutez la commande suivante : +Pour télécharger le code source, cliquez sur le bouton vert `<> Code` en haut de cette page et choisir "Download Zip". + +Vous pouvez aussi cloner le dépôt en utilisant git. Ouvrez un terminal et exécutez la commande suivante : ```sh git clone https://github.com/Team-Arduino-Logique/Arduino-Logique.git @@ -93,11 +93,7 @@ Cela créera une copie locale du dépôt sur votre machine. #### Exécution de `arduino_logique.py` sur MacOS -Après avoir installé les prérequis, vous pouvez exécuter le script `arduino_logique.py` en naviguant vers le répertoire où le script est situé et en exécutant la commande suivante dans le terminal : - -```sh -python arduino_logique.py -``` +Après avoir installé les prérequis, vous pouvez exécuter le script `arduino_logique.py`. ### Installation sur Windows