ilo-arena 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. ilo_arena-1.0.0/PKG-INFO +131 -0
  2. ilo_arena-1.0.0/README.md +97 -0
  3. ilo_arena-1.0.0/pyproject.toml +54 -0
  4. ilo_arena-1.0.0/setup.cfg +4 -0
  5. ilo_arena-1.0.0/src/ilo_arena/__init__.py +10 -0
  6. ilo_arena-1.0.0/src/ilo_arena/assets/icons/box.svg +1 -0
  7. ilo_arena-1.0.0/src/ilo_arena/assets/icons/camera_video.svg +1 -0
  8. ilo_arena-1.0.0/src/ilo_arena/assets/icons/files.svg +1 -0
  9. ilo_arena-1.0.0/src/ilo_arena/assets/icons/play.svg +1 -0
  10. ilo_arena-1.0.0/src/ilo_arena/assets/icons/reset.svg +1 -0
  11. ilo_arena-1.0.0/src/ilo_arena/assets/icons/select_zone.svg +1 -0
  12. ilo_arena-1.0.0/src/ilo_arena/assets/icons/settings.svg +1 -0
  13. ilo_arena-1.0.0/src/ilo_arena/assets/icons/smart_toy.svg +1 -0
  14. ilo_arena-1.0.0/src/ilo_arena/assets/icons/stop.svg +1 -0
  15. ilo_arena-1.0.0/src/ilo_arena/assets/style.qss +156 -0
  16. ilo_arena-1.0.0/src/ilo_arena/facade/__init__.py +44 -0
  17. ilo_arena-1.0.0/src/ilo_arena/facade/arena.py +79 -0
  18. ilo_arena-1.0.0/src/ilo_arena/facade/element.py +115 -0
  19. ilo_arena-1.0.0/src/ilo_arena/libs/__init__.py +20 -0
  20. ilo_arena-1.0.0/src/ilo_arena/libs/ai_analysis/__init__.py +3 -0
  21. ilo_arena-1.0.0/src/ilo_arena/libs/ai_analysis/ai_analysis.py +89 -0
  22. ilo_arena-1.0.0/src/ilo_arena/libs/image/__init__.py +1 -0
  23. ilo_arena-1.0.0/src/ilo_arena/libs/image/image.py +141 -0
  24. ilo_arena-1.0.0/src/ilo_arena/libs/robot_connecter/__init__.py +5 -0
  25. ilo_arena-1.0.0/src/ilo_arena/libs/robot_connecter/graphical_bounding_box.py +173 -0
  26. ilo_arena-1.0.0/src/ilo_arena/libs/robot_connecter/robot.py +375 -0
  27. ilo_arena-1.0.0/src/ilo_arena/libs/robot_connecter/robot_connection.py +191 -0
  28. ilo_arena-1.0.0/src/ilo_arena/libs/video_fetcher/__init__.py +1 -0
  29. ilo_arena-1.0.0/src/ilo_arena/libs/video_fetcher/camera.py +87 -0
  30. ilo_arena-1.0.0/src/ilo_arena/libs/video_fetcher/video_fetcher.py +53 -0
  31. ilo_arena-1.0.0/src/ilo_arena/main_page/__init__.py +3 -0
  32. ilo_arena-1.0.0/src/ilo_arena/main_page/main_page.py +43 -0
  33. ilo_arena-1.0.0/src/ilo_arena/main_window.py +37 -0
  34. ilo_arena-1.0.0/src/ilo_arena/train_page/__init__.py +3 -0
  35. ilo_arena-1.0.0/src/ilo_arena/train_page/advanced_settings.py +154 -0
  36. ilo_arena-1.0.0/src/ilo_arena/train_page/train_page.py +270 -0
  37. ilo_arena-1.0.0/src/ilo_arena/train_page/training_logic.py +152 -0
  38. ilo_arena-1.0.0/src/ilo_arena/visualize_page/__init__.py +3 -0
  39. ilo_arena-1.0.0/src/ilo_arena/visualize_page/image_overlay.py +275 -0
  40. ilo_arena-1.0.0/src/ilo_arena/visualize_page/overlay/__init__.py +1 -0
  41. ilo_arena-1.0.0/src/ilo_arena/visualize_page/overlay/detections.py +122 -0
  42. ilo_arena-1.0.0/src/ilo_arena/visualize_page/overlay/scale_selection.py +108 -0
  43. ilo_arena-1.0.0/src/ilo_arena/visualize_page/overlay/zone_selection.py +144 -0
  44. ilo_arena-1.0.0/src/ilo_arena/visualize_page/visualize_page.py +372 -0
  45. ilo_arena-1.0.0/src/ilo_arena.egg-info/PKG-INFO +131 -0
  46. ilo_arena-1.0.0/src/ilo_arena.egg-info/SOURCES.txt +47 -0
  47. ilo_arena-1.0.0/src/ilo_arena.egg-info/dependency_links.txt +1 -0
  48. ilo_arena-1.0.0/src/ilo_arena.egg-info/requires.txt +7 -0
  49. ilo_arena-1.0.0/src/ilo_arena.egg-info/top_level.txt +1 -0
@@ -0,0 +1,131 @@
1
+ Metadata-Version: 2.4
2
+ Name: ilo_arena
3
+ Version: 1.0.0
4
+ Summary: A computer vision and hardware streaming interface for education
5
+ Author-email: "intuition RT (SLB)" <contact@ilorobot.com>
6
+ Maintainer-email: "intuition RT (SLB)" <contact@ilorobot.com>
7
+ Project-URL: Homepage, https://ilorobot.com
8
+ Project-URL: Documentation, https://ilorobot.com
9
+ Keywords: python,education,robot,ilo,ai
10
+ Classifier: Development Status :: 4 - Beta
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Intended Audience :: Education
13
+ Classifier: Natural Language :: English
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Programming Language :: Python :: 3.8
16
+ Classifier: Programming Language :: Python :: 3.9
17
+ Classifier: Programming Language :: Python :: 3.10
18
+ Classifier: Programming Language :: Python :: 3.11
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Operating System :: MacOS :: MacOS X
22
+ Classifier: Operating System :: Microsoft :: Windows
23
+ Classifier: Operating System :: OS Independent
24
+ Classifier: Topic :: Education
25
+ Requires-Python: >=3.8
26
+ Description-Content-Type: text/markdown
27
+ Requires-Dist: ilo
28
+ Requires-Dist: pyserial
29
+ Requires-Dist: opencv-python
30
+ Requires-Dist: PySide6
31
+ Requires-Dist: numpy
32
+ Requires-Dist: torch
33
+ Requires-Dist: ultralytics
34
+
35
+ <p align="center">
36
+ <img alt="Ilo robot" src="https://api.ilorobot.com/media/userfiles/ilo.png" height="200">
37
+ </p>
38
+
39
+ <p align="center">
40
+ <img src="https://static.pepy.tech/personalized-badge/ilo?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
41
+ <img src="https://img.shields.io/pypi/dm/ilo" alt="PyPI Downloads / Month">
42
+ </p>
43
+
44
+ **ilo_arena** is a powerful Python package to control **ilo** the new **educational robot** directly from your computer.
45
+ It allows you to move the robot, read sensors, interact with LEDs, and create autonomous behaviors — all in just a few lines of Python.
46
+
47
+ ## Features
48
+
49
+ - Move the robot in multiple directions with Python commands
50
+ - Create complex **movement loops**
51
+ - Draw and animate using the robot's **LED matrix**
52
+ - Play with the robot **in real time** using your keyboard
53
+ - Use **colored cards** to trigger autonomous modes
54
+ - Control and read sensors over **Wi-Fi** or **Bluetooth**
55
+
56
+ ---
57
+
58
+ ## Installation
59
+
60
+ ```bash
61
+ pip install ilo
62
+ ```
63
+
64
+ To update:
65
+ ```bash
66
+ pip install ilo --upgrade
67
+ ```
68
+
69
+ ---
70
+
71
+ ## Quick Example
72
+
73
+ Here is a simple example to get started:
74
+
75
+ ```python
76
+ import ilo
77
+ import time
78
+
79
+ ilo.check_robot_on_bluetooth()
80
+ # ilo.check_robot_on_wifi() # Make sure you are connected to the robot's Wi-Fi AP
81
+
82
+ my_ilo = ilo.robot("my-robot")
83
+
84
+ # Go forward until an obstacle is close
85
+ while my_ilo.get_distance_front() > 30:
86
+ my_ilo.move("front", 10, 50)
87
+ time.sleep(0.1)
88
+
89
+ my_ilo.stop() # Stop the robot
90
+ my_ilo.step("rot_clock") # Rotate clockwise
91
+ my_ilo.set_led_color(25, 200, 25)
92
+ my_ilo.step("front", 0.5)
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Dependencies
98
+
99
+ All dependencies are **automatically installed** with `ilo`.
100
+ Here’s what each one does:
101
+ - [`keyboard-crossplatform`](https://pypi.org/project/keyboard-crossplatform/) – cross-platform keyboard event listener (works on macOS, Windows, and Linux)
102
+ - [`prettytable`](https://pypi.org/project/prettytable/) – generate clean and easy-to-read tables in the terminal
103
+ - [`websocket-client`](https://pypi.org/project/websocket-client/) – communicate with the robot via WebSocket
104
+ - [`bleak`](https://pypi.org/project/bleak/) – Bluetooth Low Energy (BLE) client library for Python
105
+ - [`pyserial`](https://pypi.org/project/pyserial/) – serial communication support (UART)
106
+ - [`pyperclip`](https://pypi.org/project/pyperclip/) – cross-platform clipboard support
107
+ - [`requests`](https://pypi.org/project/requests/) – simple and powerful HTTP client
108
+ - [`numpy`](https://pypi.org/project/numpy/) – fundamental package for scientific computing
109
+ - [`matplotlib`](https://pypi.org/project/matplotlib/) – powerful plotting and visualization library
110
+
111
+ ---
112
+
113
+ ## Documentation
114
+
115
+ Full documentation and examples are available on `GitHub`. *(Comming soon)*
116
+
117
+ ---
118
+
119
+ ## Contributing
120
+
121
+ Bug reports, patches, and suggestions are welcome!
122
+
123
+ Questions? Contact us via [`our website`](https://ilorobot.com).
124
+
125
+ ---
126
+
127
+ <p align="center">
128
+ <a href="https://ilorobot.com">
129
+ <img src="https://img.shields.io/badge/Powered_by-Intuition_RT-%234A75A0?style=for-the-badge&logo=python&logoColor=white" alt="Powered by Intuition RT">
130
+ </a>
131
+ </p>
@@ -0,0 +1,97 @@
1
+ <p align="center">
2
+ <img alt="Ilo robot" src="https://api.ilorobot.com/media/userfiles/ilo.png" height="200">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <img src="https://static.pepy.tech/personalized-badge/ilo?period=total&units=INTERNATIONAL_SYSTEM&left_color=GRAY&right_color=GREEN&left_text=downloads" alt="PyPI Downloads">
7
+ <img src="https://img.shields.io/pypi/dm/ilo" alt="PyPI Downloads / Month">
8
+ </p>
9
+
10
+ **ilo_arena** is a powerful Python package to control **ilo** the new **educational robot** directly from your computer.
11
+ It allows you to move the robot, read sensors, interact with LEDs, and create autonomous behaviors — all in just a few lines of Python.
12
+
13
+ ## Features
14
+
15
+ - Move the robot in multiple directions with Python commands
16
+ - Create complex **movement loops**
17
+ - Draw and animate using the robot's **LED matrix**
18
+ - Play with the robot **in real time** using your keyboard
19
+ - Use **colored cards** to trigger autonomous modes
20
+ - Control and read sensors over **Wi-Fi** or **Bluetooth**
21
+
22
+ ---
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ pip install ilo
28
+ ```
29
+
30
+ To update:
31
+ ```bash
32
+ pip install ilo --upgrade
33
+ ```
34
+
35
+ ---
36
+
37
+ ## Quick Example
38
+
39
+ Here is a simple example to get started:
40
+
41
+ ```python
42
+ import ilo
43
+ import time
44
+
45
+ ilo.check_robot_on_bluetooth()
46
+ # ilo.check_robot_on_wifi() # Make sure you are connected to the robot's Wi-Fi AP
47
+
48
+ my_ilo = ilo.robot("my-robot")
49
+
50
+ # Go forward until an obstacle is close
51
+ while my_ilo.get_distance_front() > 30:
52
+ my_ilo.move("front", 10, 50)
53
+ time.sleep(0.1)
54
+
55
+ my_ilo.stop() # Stop the robot
56
+ my_ilo.step("rot_clock") # Rotate clockwise
57
+ my_ilo.set_led_color(25, 200, 25)
58
+ my_ilo.step("front", 0.5)
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Dependencies
64
+
65
+ All dependencies are **automatically installed** with `ilo`.
66
+ Here’s what each one does:
67
+ - [`keyboard-crossplatform`](https://pypi.org/project/keyboard-crossplatform/) – cross-platform keyboard event listener (works on macOS, Windows, and Linux)
68
+ - [`prettytable`](https://pypi.org/project/prettytable/) – generate clean and easy-to-read tables in the terminal
69
+ - [`websocket-client`](https://pypi.org/project/websocket-client/) – communicate with the robot via WebSocket
70
+ - [`bleak`](https://pypi.org/project/bleak/) – Bluetooth Low Energy (BLE) client library for Python
71
+ - [`pyserial`](https://pypi.org/project/pyserial/) – serial communication support (UART)
72
+ - [`pyperclip`](https://pypi.org/project/pyperclip/) – cross-platform clipboard support
73
+ - [`requests`](https://pypi.org/project/requests/) – simple and powerful HTTP client
74
+ - [`numpy`](https://pypi.org/project/numpy/) – fundamental package for scientific computing
75
+ - [`matplotlib`](https://pypi.org/project/matplotlib/) – powerful plotting and visualization library
76
+
77
+ ---
78
+
79
+ ## Documentation
80
+
81
+ Full documentation and examples are available on `GitHub`. *(Comming soon)*
82
+
83
+ ---
84
+
85
+ ## Contributing
86
+
87
+ Bug reports, patches, and suggestions are welcome!
88
+
89
+ Questions? Contact us via [`our website`](https://ilorobot.com).
90
+
91
+ ---
92
+
93
+ <p align="center">
94
+ <a href="https://ilorobot.com">
95
+ <img src="https://img.shields.io/badge/Powered_by-Intuition_RT-%234A75A0?style=for-the-badge&logo=python&logoColor=white" alt="Powered by Intuition RT">
96
+ </a>
97
+ </p>
@@ -0,0 +1,54 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "wheel>=0.43"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "ilo_arena"
7
+ version = "1.0.0"
8
+ description = "A computer vision and hardware streaming interface for education"
9
+ readme = "README.md"
10
+ requires-python = ">=3.8"
11
+ keywords = ["python", "education", "robot", "ilo", "ai"]
12
+ authors = [
13
+ {name = "intuition RT (SLB)", email = "contact@ilorobot.com"}
14
+ ]
15
+ maintainers = [
16
+ {name = "intuition RT (SLB)", email = "contact@ilorobot.com"}
17
+ ]
18
+ classifiers = [
19
+ "Development Status :: 4 - Beta",
20
+ "Intended Audience :: Developers",
21
+ "Intended Audience :: Education",
22
+ "Natural Language :: English",
23
+ "Programming Language :: Python :: 3",
24
+ "Programming Language :: Python :: 3.8",
25
+ "Programming Language :: Python :: 3.9",
26
+ "Programming Language :: Python :: 3.10",
27
+ "Programming Language :: Python :: 3.11",
28
+ "Programming Language :: Python :: 3.12",
29
+ "Programming Language :: Python :: 3.13",
30
+ "Operating System :: MacOS :: MacOS X",
31
+ "Operating System :: Microsoft :: Windows",
32
+ "Operating System :: OS Independent",
33
+ "Topic :: Education",
34
+ ]
35
+
36
+ dependencies = [
37
+ "ilo",
38
+ "pyserial",
39
+ "opencv-python",
40
+ "PySide6",
41
+ "numpy",
42
+ "torch",
43
+ "ultralytics"
44
+ ]
45
+
46
+ [project.urls]
47
+ Homepage = "https://ilorobot.com"
48
+ Documentation = "https://ilorobot.com"
49
+
50
+ [tool.setuptools.packages.find]
51
+ where = ["src"]
52
+
53
+ [tool.setuptools.package-data]
54
+ "*" = ["assets/**", "*.qss"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,10 @@
1
+ from .facade import Arena, start_arena, Element, list_function
2
+ from ilo.robot import Robot
3
+
4
+ __all__ = [
5
+ "Arena",
6
+ "list_function",
7
+ "start_arena",
8
+ "Element",
9
+ "Robot",
10
+ ]
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M200-640v440h560v-440H640v320l-160-80-160 80v-320H200Zm0 520q-33 0-56.5-23.5T120-200v-499q0-14 4.5-27t13.5-24l50-61q11-14 27.5-21.5T250-840h460q18 0 34.5 7.5T772-811l50 61q9 11 13.5 24t4.5 27v499q0 33-23.5 56.5T760-120H200Zm16-600h528l-34-40H250l-34 40Zm184 80v190l80-40 80 40v-190H400Zm-200 0h560-560Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M371-200h218l-20-80H391l-20 80Zm-11-160h240q83 0 141.5-58.5T800-560q0-83-58.5-141.5T600-760H360q-83 0-141.5 58.5T160-560q0 83 58.5 141.5T360-360Zm63.5-143.5Q400-527 400-560t23.5-56.5Q447-640 480-640t56.5 23.5Q560-593 560-560t-23.5 56.5Q513-480 480-480t-56.5-23.5ZM260-600q17 0 28.5-11.5T300-640q0-17-11.5-28.5T260-680q-17 0-28.5 11.5T220-640q0 17 11.5 28.5T260-600ZM160-120v-80h129l21-84q-99-17-164.5-94.5T80-560q0-117 81.5-198.5T360-840h240q117 0 198.5 81.5T880-560q0 104-65.5 181.5T650-284l21 84h129v80H160Zm433-327q47-47 47-113t-47-113q-47-47-113-47t-113 47q-47 47-47 113t47 113q47 47 113 47t113-47ZM480-560ZM371-200h218-218Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M160-160q-33 0-56.5-23.5T80-240v-400q0-33 23.5-56.5T160-720h240l80-80h320q33 0 56.5 23.5T880-720v480q0 33-23.5 56.5T800-160H160Zm73-280h207v-207L233-440Zm-73-40 160-160H160v160Zm0 120v120h640v-480H520v280q0 33-23.5 56.5T440-360H160Zm280-160Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M320-200v-560l440 280-440 280Zm80-280Zm0 134 210-134-210-134v268Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M480-320v-100q0-25 17.5-42.5T540-480h100v60H540v100h-60Zm60 240q-25 0-42.5-17.5T480-140v-100h60v100h100v60H540Zm280-240v-100H720v-60h100q25 0 42.5 17.5T880-420v100h-60ZM720-80v-60h100v-100h60v100q0 25-17.5 42.5T820-80H720Zm111-480h-83q-26-88-99-144t-169-56q-117 0-198.5 81.5T200-480q0 72 32.5 132t87.5 98v-110h80v240H160v-80h94q-62-50-98-122.5T120-480q0-75 28.5-140.5t77-114q48.5-48.5 114-77T480-840q129 0 226.5 79.5T831-560Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M200-120q-33 0-56.5-23.5T120-200v-160h80v160h160v80H200Zm400 0v-80h160v-160h80v160q0 33-23.5 56.5T760-120H600ZM120-600v-160q0-33 23.5-56.5T200-840h160v80H200v160h-80Zm640 0v-160H600v-80h160q33 0 56.5 23.5T840-760v160h-80Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="m370-80-16-128q-13-5-24.5-12T307-235l-119 50L78-375l103-78q-1-7-1-13.5v-27q0-6.5 1-13.5L78-585l110-190 119 50q11-8 23-15t24-12l16-128h220l16 128q13 5 24.5 12t22.5 15l119-50 110 190-103 78q1 7 1 13.5v27q0 6.5-2 13.5l103 78-110 190-118-50q-11 8-23 15t-24 12L590-80H370Zm70-80h79l14-106q31-8 57.5-23.5T639-327l99 41 39-68-86-65q5-14 7-29.5t2-31.5q0-16-2-31.5t-7-29.5l86-65-39-68-99 42q-22-23-48.5-38.5T533-694l-13-106h-79l-14 106q-31 8-57.5 23.5T321-633l-99-41-39 68 86 64q-5 15-7 30t-2 32q0 16 2 31t7 30l-86 65 39 68 99-42q22 23 48.5 38.5T427-266l13 106Zm42-180q58 0 99-41t41-99q0-58-41-99t-99-41q-59 0-99.5 41T342-480q0 58 40.5 99t99.5 41Zm-2-140Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M160-360q-50 0-85-35t-35-85q0-50 35-85t85-35v-80q0-33 23.5-56.5T240-760h120q0-50 35-85t85-35q50 0 85 35t35 85h120q33 0 56.5 23.5T800-680v80q50 0 85 35t35 85q0 50-35 85t-85 35v160q0 33-23.5 56.5T720-120H240q-33 0-56.5-23.5T160-200v-160Zm242.5-97.5Q420-475 420-500t-17.5-42.5Q385-560 360-560t-42.5 17.5Q300-525 300-500t17.5 42.5Q335-440 360-440t42.5-17.5Zm240 0Q660-475 660-500t-17.5-42.5Q625-560 600-560t-42.5 17.5Q540-525 540-500t17.5 42.5Q575-440 600-440t42.5-17.5ZM320-280h320v-80H320v80Zm-80 80h480v-480H240v480Zm240-240Z"/></svg>
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#ffffff"><path d="M320-640v320-320Zm-80 400v-480h480v480H240Zm80-80h320v-320H320v320Z"/></svg>
@@ -0,0 +1,156 @@
1
+ /* =======================================================
2
+ Global Fonts and Background
3
+ ======================================================= */
4
+ QWidget {
5
+ font-family: "Montserrat", "Noto Sans", sans-serif;
6
+ font-size: 14px;
7
+ color: palette(window-text); /* Auto-adapts to Light/Dark mode */
8
+ }
9
+
10
+ QMainWindow, QStackedWidget {
11
+ background-color: palette(window);
12
+ }
13
+
14
+ QFrame#AdvancedOverlay {
15
+ background-color: palette(base); /* White in light mode, dark gray in dark */
16
+ border-radius: 10px;
17
+ }
18
+
19
+ /* =======================================================
20
+ Progress bars
21
+ ======================================================= */
22
+ QProgressBar {
23
+ border: 2px solid palette(mid); /* Subtle border matching the OS theme */
24
+ border-radius: 10px;
25
+ text-align: center;
26
+ height: 25px;
27
+ }
28
+
29
+ QProgressBar::chunk {
30
+ background-color: #2ecc71; /* Your success green */
31
+ border-radius: 8px;
32
+ }
33
+
34
+ /* =======================================================
35
+ Labels & Headings
36
+ ======================================================= */
37
+ QLabel {
38
+ color: palette(window-text);
39
+ }
40
+
41
+ QLabel#titleLabel {
42
+ font-size: 28px;
43
+ font-weight: bold;
44
+ color: palette(window-text);
45
+ }
46
+
47
+ QLabel#subtitleLabel {
48
+ font-size: 16px;
49
+ font-weight: 600;
50
+ color: palette(placeholder-text); /* Perfect dynamic gray for subtitles */
51
+ }
52
+
53
+ /* =======================================================
54
+ Dropdowns / ComboBox
55
+ ======================================================= */
56
+ QComboBox {
57
+ background-color: palette(button);
58
+ color: palette(button-text);
59
+ border: 2px solid palette(mid);
60
+ border-radius: 8px;
61
+ padding: 5px 15px;
62
+ font-size: 14px;
63
+ font-weight: bold;
64
+ }
65
+
66
+ QComboBox:hover {
67
+ border: 2px solid palette(highlight); /* OS accent color on hover */
68
+ }
69
+
70
+ /* The popup list itself */
71
+ QComboBox QAbstractItemView {
72
+ background-color: palette(base);
73
+ color: palette(text);
74
+ border: 1px solid palette(mid);
75
+ border-radius: 4px;
76
+ selection-background-color: #24b4b1; /* Matches your teal buttons */
77
+ selection-color: white;
78
+ outline: 0px;
79
+ }
80
+
81
+ /* =======================================================
82
+ Advanced Settings Controls & Buttons
83
+ ======================================================= */
84
+ QPushButton#closeCircle {
85
+ background-color: transparent;
86
+ color: palette(window-text);
87
+ border: none;
88
+ padding: 0px;
89
+ font-size: 22px;
90
+ font-weight: bold;
91
+ }
92
+
93
+ QPushButton#closeCircle:hover {
94
+ background-color: palette(midlight);
95
+ border-radius: 14px;
96
+ }
97
+
98
+ QPushButton#infoCircle {
99
+ border: none;
100
+ padding: 0px;
101
+ font-size: 13px;
102
+ font-weight: bold;
103
+ border-radius: 13px;
104
+ }
105
+
106
+ QPushButton {
107
+ background-color: #24b4b1; /* React Teal */
108
+ color: white;
109
+ border-radius: 8px;
110
+ padding: 10px 16px;
111
+ font-weight: bold;
112
+ font-size: 14px;
113
+ border: none;
114
+ }
115
+
116
+ QPushButton::icon {
117
+ margin-right: 8px;
118
+ }
119
+
120
+ QPushButton:hover {
121
+ background-color: #1e9996;
122
+ }
123
+
124
+ QPushButton:pressed {
125
+ background-color: #187c7a;
126
+ }
127
+
128
+ /* =======================================================
129
+ Secondary / Back Buttons
130
+ ======================================================= */
131
+ QPushButton#backBtn {
132
+ background-color: palette(mid);
133
+ color: palette(button-text);
134
+ }
135
+
136
+ QPushButton#backBtn:hover {
137
+ background-color: palette(dark);
138
+ }
139
+
140
+ /* =======================================================
141
+ Cards / Containers
142
+ ======================================================= */
143
+ QTextEdit#LogZone {
144
+ background-color: palette(base);
145
+ color: palette(text);
146
+ border: 2px solid palette(mid);
147
+ border-radius: 10px;
148
+ padding: 10px;
149
+ font-family: 'Consolas', monospace;
150
+ }
151
+
152
+ QFrame#Card {
153
+ background-color: palette(base);
154
+ border: 1px solid palette(mid);
155
+ border-radius: 12px;
156
+ }
@@ -0,0 +1,44 @@
1
+ from ilo.robot import Robot
2
+ from prettytable import PrettyTable
3
+
4
+ from .arena import Arena, start_arena
5
+ from .element import Element
6
+
7
+ def list_function():
8
+ """
9
+ Print the list of all the functions available in the library
10
+ """
11
+ main_table = PrettyTable(["Methods", "Description"])
12
+ main_table.align["Methods"] = main_table.align["Description"] = "l"
13
+ main_table.add_row(
14
+ ["ilo_arena.list_function", "Print the list of all the functions available in the library"],
15
+ divider=True
16
+ )
17
+ print(f"{main_table}\n")
18
+
19
+ class_configs = [
20
+ (Arena, "Arena methods (example: my_arena.game())"),
21
+ (Element, "Element methods (example: my_element.get_robot())"),
22
+ (Robot, "Robot methods (example: my_ilo.game())"),
23
+ ]
24
+
25
+ for cls, header in class_configs:
26
+ t = PrettyTable([header, "Description"])
27
+ t.align[header] = t.align["Description"] = "l"
28
+
29
+ for name in dir(cls):
30
+ entry = getattr(cls, name)
31
+ if callable(entry) and not name.startswith("_") and entry.__doc__:
32
+ desc = entry.__doc__.strip().splitlines()[0]
33
+ t.add_row([name, desc])
34
+
35
+ print(f"{t}\n")
36
+
37
+ print("If the table does not display correctly, expand your terminal.")
38
+
39
+ __all__ = [
40
+ "Arena",
41
+ "start_arena",
42
+ "list_function",
43
+ "Element",
44
+ ]
@@ -0,0 +1,79 @@
1
+ from __future__ import annotations
2
+ import threading
3
+ import time
4
+ import sys
5
+ from pathlib import Path
6
+ from typing import List, Callable, Optional, TYPE_CHECKING
7
+ from PySide6.QtWidgets import QApplication
8
+ from ..libs import get_asset_path
9
+ from ..main_window import MainWindow
10
+
11
+ if TYPE_CHECKING:
12
+ from libs.robot_connecter import Robot
13
+ from .element import Element
14
+
15
+
16
+ class Arena:
17
+ """
18
+ The main coordinator for the environment.
19
+ Gives the student access to fetch active elements, interact with the
20
+ global space, and yield execution time safely.
21
+ """
22
+
23
+ def __init__(self, main_window: MainWindow):
24
+ """
25
+ Initializes the Arena controller.
26
+
27
+ Args:
28
+ main_window (MainWindow): The running application interface.
29
+ """
30
+ self._main_window = main_window
31
+
32
+ def get_all_elements(self) -> List[Element]:
33
+ """Returns an array of all elements identified by the AI model."""
34
+ self.sleep(0.1)
35
+
36
+ # Fetch tracked items from the overlay
37
+ detected_items = self._main_window.page_2.overlay.robots
38
+
39
+ return [
40
+ Element(element_id, self._get_real_element)
41
+ for element_id in detected_items.keys()
42
+ ]
43
+
44
+ def _get_real_element(self, element_id: int) -> Optional[Robot]:
45
+ """Internal callback to fetch the latest state of an element."""
46
+ items = self._main_window.page_2.overlay.robots
47
+ return items.get(element_id)
48
+
49
+ def sleep(self, seconds: float):
50
+ """Thread-safe sleep function."""
51
+ time.sleep(seconds)
52
+
53
+ def start_arena(student_function: Callable[[Arena], None]):
54
+ """
55
+ Bootstraps the UI, initializes the AI vision, and runs the student's logic
56
+ in a safe background thread.
57
+ """
58
+ app = QApplication(sys.argv)
59
+
60
+ qss_file = Path(get_asset_path("style.qss"))
61
+ if qss_file.exists():
62
+ with open(qss_file, "r") as f:
63
+ app.setStyleSheet(f.read())
64
+ else:
65
+ print(f"Warning: {qss_file} not found!")
66
+
67
+ # Initialize Backend
68
+ main_window = MainWindow()
69
+ arena = Arena(main_window)
70
+
71
+ # Spawn the student script in a background thread so the UI doesn't block
72
+ student_thread = threading.Thread(
73
+ target=student_function, args=(arena,), daemon=True
74
+ )
75
+ student_thread.start()
76
+
77
+ # Launch PySide6 Event Loop
78
+ main_window.show()
79
+ sys.exit(app.exec())