Skip to content

Commit 81c1e0a

Browse files
committed
Merge branch 'master' of github.com:Team-Arduino-Logique/Arduino-Logique into paquet-installation
2 parents c67166b + d113ebf commit 81c1e0a

File tree

6 files changed

+154
-100
lines changed

6 files changed

+154
-100
lines changed
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
name: Build and Release
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
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: tar -czvf arduino_logique_macos.tar.gz dist/arduino_logique
31+
32+
- name: Upload artifact
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: macos-build
36+
path: arduino_logique_macos.tar.gz
37+
38+
build-ubuntu:
39+
runs-on: ubuntu-latest
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Python
45+
uses: actions/setup-python@v5
46+
with:
47+
python-version: '3.x'
48+
49+
- name: Install PyInstaller
50+
run: pip install pyinstaller pyserial
51+
52+
- name: Build with PyInstaller
53+
run: pyinstaller arduino_logique.spec
54+
55+
- name: Compress the build
56+
run: tar -czvf arduino_logique_ubuntu.tar.gz dist/arduino_logique
57+
58+
- name: Upload artifact
59+
uses: actions/upload-artifact@v3
60+
with:
61+
name: ubuntu-build
62+
path: arduino_logique_ubuntu.tar.gz
63+
64+
build-windows:
65+
runs-on: windows-latest
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Set up Python
71+
uses: actions/setup-python@v5
72+
with:
73+
python-version: '3.x'
74+
75+
- name: Install PyInstaller
76+
run: pip install pyinstaller pyserial
77+
78+
- name: Build with PyInstaller
79+
run: pyinstaller arduino_logique.spec
80+
81+
- name: Compress the build
82+
run: Compress-Archive -Path dist\arduino_logique -DestinationPath arduino_logique_windows.zip
83+
84+
- name: Upload artifact
85+
uses: actions/upload-artifact@v3
86+
with:
87+
name: windows-build
88+
path: arduino_logique_windows.zip
89+
90+
release:
91+
needs: [build-macos, build-ubuntu, build-windows]
92+
runs-on: ubuntu-latest
93+
permissions:
94+
contents: write
95+
steps:
96+
- name: Checkout code
97+
uses: actions/checkout@v4
98+
with:
99+
fetch-depth: 0
100+
101+
- name: Download macOS build
102+
uses: actions/download-artifact@v3
103+
with:
104+
name: macos-build
105+
path: ./dist/
106+
107+
- name: Download Ubuntu build
108+
uses: actions/download-artifact@v3
109+
with:
110+
name: ubuntu-build
111+
path: ./dist/
112+
113+
- name: Download Windows build
114+
uses: actions/download-artifact@v3
115+
with:
116+
name: windows-build
117+
path: ./dist/
118+
119+
- name: Bump version and push tag
120+
id: bump
121+
uses: anothrNick/github-tag-action@1.36.0
122+
env:
123+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
124+
WITH_V: true
125+
RELEASE_BRANCHES: master
126+
INITIAL_VERSION: v0.0.0
127+
128+
- name: Create release
129+
uses: ncipollo/release-action@v1
130+
with:
131+
artifacts: "./dist/arduino_logique_macos.tar.gz,./dist/arduino_logique_ubuntu.tar.gz,./dist/arduino_logique_windows.zip"
132+
token: ${{ secrets.GITHUB_TOKEN }}
133+
tag: ${{ steps.bump.outputs.new_tag }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
__pycache__/
2-
.mypy_cache/
2+
.mypy_cache/
3+
build/
4+
dist/

arduino_logique.py

Lines changed: 3 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
ArduinoLogique.py
33
Main module for the ArduinoLogique program. This module provides a graphical interface for
44
simulating logic circuits using Tkinter. It includes functionality to initialize a canvas,
5-
draw a breadboard, and zoom in and out on the circuit diagram.
5+
draw a breadboard, etc.
66
"""
77

88
import tkinter as tk
@@ -14,32 +14,6 @@
1414
from toolbar import Toolbar
1515

1616

17-
def zoom(canvas: tk.Canvas, scale: float, sketcher: ComponentSketcher) -> None:
18-
"""
19-
Adjusts the zoom level of the given canvas by scaling the board and updating the scale factor.
20-
21-
Parameters:
22-
- canvas (tk.Canvas): The canvas on which the board is drawn.
23-
- scale (float): The scale factor to apply to the board.
24-
- sketcher (ComponentSketcher): The ComponentSketcher instance used to draw the circuit.
25-
26-
Returns:
27-
- None
28-
"""
29-
# Calculate the scaling factor
30-
new_scale_factor = scale / 10.0
31-
scale_ratio = new_scale_factor / sketcher.scale_factor
32-
33-
# Update the scale factor in the existing ComponentSketcher instance
34-
sketcher.scale_factor = new_scale_factor
35-
36-
# Scale all items on the canvas
37-
canvas.scale("all", 0, 0, scale_ratio, scale_ratio)
38-
39-
# Optionally, you may need to adjust the canvas scroll region or other properties
40-
canvas.configure(scrollregion=canvas.bbox("all"))
41-
42-
4317
def main():
4418
"""
4519
Main function for the ArduinoLogique program. This function initializes the main window,
@@ -48,7 +22,8 @@ def main():
4822
# Creating main window
4923
win = tk.Tk()
5024
win.title("Laboratoire virtuel de circuit logique - GIF-1002")
51-
win.geometry("1600x900") # Initial window size
25+
win.geometry("1400x800") # Initial window size
26+
win.resizable(False, False) # Disabling window resizing
5227
win.configure(bg="#333333") # Setting consistent background color
5328

5429
# Configuring grid layout for the main window
@@ -105,34 +80,10 @@ def refresh_sidebar():
10580
canvas=canvas,
10681
board=board,
10782
current_dict_circuit=sketcher.current_dict_circuit,
108-
zoom_function=zoom,
10983
)
11084
# Placing the menu_bar in row=0, spanning both columns
11185
menus.menu_bar.grid(row=0, column=0, columnspan=2, sticky="nsew")
11286

113-
# Assigning the references to menus
114-
menus.zoom_function = zoom
115-
116-
# Creating a slider and placing it in row=3, spanning both columns
117-
h_slider = tk.Scale(
118-
win,
119-
from_=10,
120-
to=30,
121-
orient="horizontal",
122-
command=lambda scale: zoom(canvas, float(scale), sketcher),
123-
bg="#333333",
124-
fg="white",
125-
activebackground="#444444",
126-
troughcolor="#555555",
127-
highlightbackground="#333333",
128-
sliderrelief="flat",
129-
bd=0,
130-
highlightthickness=0,
131-
)
132-
h_slider.set(10) # Setting initial slider value
133-
134-
h_slider.grid(row=3, column=0, columnspan=2, sticky="ew", padx=0, pady=0)
135-
13687
# Setting default font for all widgets
13788
default_font = font.Font(family="Arial", size=10)
13889
win.option_add("*Font", default_font)

arduino_logique.spec

Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -2,28 +2,11 @@
22

33

44
a = Analysis(
5-
['arduino_logique.py',
6-
'breadboard.py',
7-
'component_params.py',
8-
'component_sketch.py',
9-
'dataCDLT.py',
10-
'menus.py',
11-
'sidebar.py',
12-
'toolbar.py'],
5+
['arduino_logique.py'],
136
pathex=[],
147
binaries=[],
15-
datas=[
16-
('Assets', 'Assets'),
17-
('Components', 'Components'),
18-
('Components', 'Components'),
19-
('object_model', 'object_model'),
20-
('Images', 'Images'),
21-
('__pycache__', '__pycache__'),
22-
('pyserial-3.5.dist-info', 'pyserial')
23-
],
24-
hiddenimports=[
25-
'serial',
26-
],
8+
datas=[('Assets', 'Assets'), ('Components', 'Components')],
9+
hiddenimports=[],
2710
hookspath=[],
2811
hooksconfig={},
2912
runtime_hooks=[],
@@ -36,36 +19,27 @@ pyz = PYZ(a.pure)
3619
exe = EXE(
3720
pyz,
3821
a.scripts,
39-
a.binaries,
40-
a.datas,
4122
[],
23+
exclude_binaries=True,
4224
name='arduino_logique',
4325
debug=False,
4426
bootloader_ignore_signals=False,
4527
strip=False,
4628
upx=True,
47-
upx_exclude=[],
48-
runtime_tmpdir=None,
49-
console=True,
29+
console=False,
5030
disable_windowed_traceback=False,
5131
argv_emulation=False,
5232
target_arch=None,
5333
codesign_identity=None,
5434
entitlements_file=None,
35+
contents_directory='.',
5536
)
56-
5737
coll = COLLECT(
58-
exe,
59-
a.binaries,
60-
a.zipfiles,
61-
a.datas,
62-
strip=False,
63-
upx=True,
64-
upx_exclude=[],
65-
name='arduino_logique',
66-
debug=True,
67-
target_arch=None,
68-
codesign_identity=None,
69-
entitlements_file=None,
70-
xarc={'format': 'zip', 'file': 'arduino_logique.zip'}
71-
)
38+
exe,
39+
a.binaries,
40+
a.datas,
41+
strip=False,
42+
upx=True,
43+
upx_exclude=[],
44+
name='arduino_logique',
45+
)

menus.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class Menus:
6363
board (Breadboard): The Breadboard instance.
6464
model (list): The model data for the circuit.
6565
current_dict_circuit (dict): The current circuit data.
66-
zoom (Callable): The zoom function to adjust the canvas.
6766
com_port (str | None): The selected COM port.
6867
"""
6968

@@ -73,7 +72,6 @@ def __init__(
7372
canvas: tk.Canvas,
7473
board: Breadboard,
7574
current_dict_circuit: dict,
76-
zoom_function: Callable,
7775
):
7876
"""
7977
Initializes the custom menu bar.
@@ -82,8 +80,6 @@ def __init__(
8280
- parent (tk.Tk or tk.Frame): The main window or parent frame.
8381
- canvas (tk.Canvas): The canvas widget for drawing circuits.
8482
- board (Breadboard): The Breadboard instance.
85-
- current_dict_circuit (dict): The current circuit data.
86-
- zoom_function (callable): The zoom function to adjust the canvas.
8783
"""
8884
self.parent: tk.Tk | tk.Frame = parent
8985
"""The main window or parent frame."""
@@ -93,8 +89,6 @@ def __init__(
9389
"""The Breadboard instance."""
9490
self.current_dict_circuit: dict = current_dict_circuit
9591
"""The current circuit data."""
96-
self.zoom: Callable = zoom_function
97-
"""The zoom function to adjust the canvas."""
9892
self.com_port: str | None = None
9993
"""The selected COM port."""
10094
self.selected_microcontroller = None
@@ -359,7 +353,6 @@ def open_file(self):
359353
# Update current_dict_circuit and redraw the circuit
360354
self.board.sketcher.clear_board()
361355

362-
# self.zoom(self.canvas, 10.0, self.board, 50, 10, [])
363356
x_o, y_o = self.board.sketcher.id_origins["xyOrigin"]
364357
self.board.sketcher.circuit(x_o, y_o, model=[])
365358

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pyserial==3.5

0 commit comments

Comments
 (0)