Skip to content

Commit 63d960a

Browse files
committed
refactor(component editor): Use the new data-model class
Also adds many pytests Updates the architecture documentation
1 parent 2decb54 commit 63d960a

8 files changed

+2419
-1300
lines changed

ARCHITECTURE.md

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -155,58 +155,90 @@ We decided to use python as programming language, and the following libraries an
155155
- [tkinter](https://docs.python.org/3/library/tkinter.html) for the graphical user interface
156156
- GNU gettext `po` files to translate the software to other languages
157157

158-
To satisfy the system design requirements described above the following five sub-applications were developed:
158+
The (main) application itself does the command line parsing and starts the sub-applications defined below in sequence
159+
160+
- [`__main__.py`](ardupilot_methodic_configurator/__main__.py)
161+
162+
To satisfy the system design requirements described above the following five user interface sub-applications were developed:
159163

160164
- **check for software updates**
161165
- checks if there is a newer software version available, downloads and updates it
166+
- [`frontend_tkinter_software_update.py`](ardupilot_methodic_configurator/frontend_tkinter_software_update.py)
162167
- **FC communication**
163168
- establishes connection to the flight controller, gets hardware information, downloads parameters and their default values
169+
- [`frontend_tkinter_connection_selection.py`](ardupilot_methodic_configurator/frontend_tkinter_connection_selection.py)
170+
- [`frontend_tkinter_flightcontroller_info.py`](ardupilot_methodic_configurator/frontend_tkinter_flightcontroller_info.py)
164171
- **choose project to open**
165172
- either creates a new project or opens an existing one, downloads parameter documentation metadata corresponding to the FC firmware version to the project directory
173+
- [`frontend_tkinter_directory_selection.py`](ardupilot_methodic_configurator/frontend_tkinter_directory_selection.py)
174+
- [`frontend_tkinter_template_overview.py`](ardupilot_methodic_configurator/frontend_tkinter_template_overview.py)
166175
- **define vehicle components and their connections**
167176
- define specifications of all vehicle components and their connections to the flight controller
177+
- [`frontend_tkinter_component_editor.py`](ardupilot_methodic_configurator/frontend_tkinter_component_editor.py)
178+
- [`frontend_tkinter_component_editor_base.py`](ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py)
179+
- [`frontend_tkinter_component_template_manager.py`](ardupilot_methodic_configurator/frontend_tkinter_component_template_manager.py)
168180
- **view documentation, edit parameters, upload them to FC**
169181
- sequentially for each configuration step:
170182
- view documentation relevant for the current configuration step,
171183
- edit parameters relevant for the current configuration step,
172184
- upload them to the flight controller,
173185
- save them to file
186+
- [`frontend_tkinter_parameter_editor.py`](ardupilot_methodic_configurator/frontend_tkinter_parameter_editor.py)
187+
- [`frontend_tkinter_parameter_editor_documentation_frame.py`](ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_documentation_frame.py)
188+
- [`frontend_tkinter_parameter_editor_table.py`](ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py)
189+
- [`frontend_tkinter_stage_progress.py`](ardupilot_methodic_configurator/frontend_tkinter_stage_progress.py)
174190

175191
Each sub-application can be run in isolation, so it is easier to test and develop them.
176192

193+
The data models. Each application separates the business logic from the user interface logic.
194+
This improves testability and maintainability of the code.
195+
196+
1. Check for software updates:
197+
1. [`middleware_software_updates.py`](ardupilot_methodic_configurator/middleware_software_updates.py)
198+
1. FC connection:
199+
1. [`middleware_fc_ids.py`](ardupilot_methodic_configurator/middleware_fc_ids.py) <- autogenerated by `update_flight_controller_ids.py`
200+
1. Component editor:
201+
1. [`battery_cell_voltages.py`](ardupilot_methodic_configurator/battery_cell_voltages.py)
202+
1. [`data_model_vehicle_components_base.py`](ardupilot_methodic_configurator/data_model_vehicle_components_base.py)
203+
1. [`data_model_vehicle_components_import.py`](ardupilot_methodic_configurator/data_model_vehicle_components_import.py)
204+
1. [`data_model_vehicle_components_templates.py`](ardupilot_methodic_configurator/data_model_vehicle_components_templates.py)
205+
1. [`data_model_vehicle_components_validation.py`](ardupilot_methodic_configurator/data_model_vehicle_components_validation.py)
206+
1. [`data_model_vehicle_components.py`](ardupilot_methodic_configurator/data_model_vehicle_components.py)
207+
177208
All applications use one or more of the following libraries:
178209

179210
1. internationalization
180211
1. [`__init__.py`](ardupilot_methodic_configurator/__init__.py)
181-
2. [`internationalization.py`](ardupilot_methodic_configurator/internationalization.py)
212+
1. [`internationalization.py`](ardupilot_methodic_configurator/internationalization.py)
213+
1. [`configuration_steps_strings.py`](ardupilot_methodic_configurator/configuration_steps_strings.py) <- autogenerated by `update_configuration_steps_translation.py`
214+
1. [`vehicle_components.py`](ardupilot_methodic_configurator/vehicle_components.py) <- autogenerated by `update_vehicle_components_translation.py`
182215
1. command line parsing
183216
1. [`common_arguments.py`](ardupilot_methodic_configurator/common_arguments.py)
217+
1. [`argparse_check_range.py`](ardupilot_methodic_configurator/argparse_check_range.py)
184218
1. the local filesystem backend does file I/O on the local file system. Operates mostly on parameter files and metadata/documentation files
185219
1. [`backend_filesystem.py`](ardupilot_methodic_configurator/backend_filesystem.py)
186220
2. [`backend_filesystem_vehicle_components.py`](ardupilot_methodic_configurator/backend_filesystem_vehicle_components.py)
187221
3. [`backend_filesystem_configuration_steps.py`](ardupilot_methodic_configurator/backend_filesystem_configuration_steps.py)
222+
4. [`backend_filesystem_program_settings.py`](ardupilot_methodic_configurator/backend_filesystem_program_settings.py)
188223
1. the internet backend communicates with the internet
189224
1. [`backend_internet.py`](ardupilot_methodic_configurator/backend_internet.py)
190225
1. the flight controller backend communicates with the flight controller
191226
1. [`backend_flightcontroller.py`](ardupilot_methodic_configurator/backend_flightcontroller.py)
192227
2. [`backend_mavftp.py`](ardupilot_methodic_configurator/backend_mavftp.py)
193-
3. [`battery_cell_voltages.py`](ardupilot_methodic_configurator/battery_cell_voltages.py)
194228
1. the tkinter frontend, which is the GUI the user interacts with
229+
1. [`frontend_tkinter_autoresize_combobox.py`](ardupilot_methodic_configurator/frontend_tkinter_autoresize_combobox.py)
195230
1. [`frontend_tkinter_base_window.py`](ardupilot_methodic_configurator/frontend_tkinter_base_window.py)
196-
2. [`frontend_tkinter_connection_selection.py`](ardupilot_methodic_configurator/frontend_tkinter_connection_selection.py)
197-
3. [`frontend_tkinter_directory_selection.py`](ardupilot_methodic_configurator/frontend_tkinter_directory_selection.py)
198-
4. [`frontend_tkinter_component_editor.py`](ardupilot_methodic_configurator/frontend_tkinter_component_editor.py)
199-
5. [`frontend_tkinter_component_editor_base.py`](ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py)
200-
6. [`frontend_tkinter_parameter_editor.py`](ardupilot_methodic_configurator/frontend_tkinter_parameter_editor.py)
201-
7. [`frontend_tkinter_parameter_editor_table.py`](ardupilot_methodic_configurator/frontend_tkinter_parameter_editor_table.py)
202-
203-
The (main) application itself does the command line parsing and starts the other sub-applications in sequence
204-
205-
- [`__main__.py`](ardupilot_methodic_configurator/__main__.py)
231+
1. [`frontend_tkinter_entry_dynamic.py`](ardupilot_methodic_configurator/frontend_tkinter_entry_dynamic.py)
232+
1. [`frontend_tkinter_pair_tuple_combobox.py`](ardupilot_methodic_configurator/frontend_tkinter_pair_tuple_combobox.py)
233+
1. [`frontend_tkinter_progress_window.py`](ardupilot_methodic_configurator/frontend_tkinter_progress_window.py)
234+
1. [`frontend_tkinter_rich_text.py`](ardupilot_methodic_configurator/frontend_tkinter_rich_text.py)
235+
1. [`frontend_tkinter_scroll_frame.py`](ardupilot_methodic_configurator/frontend_tkinter_scroll_frame.py)
236+
1. [`frontend_tkinter_show.py`](ardupilot_methodic_configurator/frontend_tkinter_show.py)
237+
1. [`frontend_tkinter_usage_popup_window.py`](ardupilot_methodic_configurator/frontend_tkinter_usage_popup_window.py)
206238

207239
When all is combined it looks like this:
208240

209-
![Software Architecture diagram](images/Architecture.drawio.png)
241+
![Software Architecture diagram](images/Architecture2.drawio.png)
210242

211243
The parts can be individually tested, and do have unit tests.
212244
They can also be exchanged, for instance, [tkinter-frontend](https://docs.python.org/3/library/tkinter.html) can be replaced with

0 commit comments

Comments
 (0)