-
Notifications
You must be signed in to change notification settings - Fork 43
Tempcal plugin #1022
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Tempcal plugin #1022
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a comprehensive plugin architecture for the ArduPilot Methodic Configurator, enabling modular extension of functionality through UI plugins and workflow plugins. The implementation follows clean architecture principles with strict separation of concerns between business logic (data models), UI coordination (views/workflows), and infrastructure (factories).
Key Changes
- Plugin factory pattern with dependency injection to avoid circular imports
- Separation of UI plugins (persistent views like motor test panel) from workflow plugins (one-time actions like IMU calibration)
- Migration of IMU temperature calibration from monolithic to plugin-based architecture
- JSON schema updates for plugin configuration in parameter files
Reviewed Changes
Copilot reviewed 25 out of 25 changed files in this pull request and generated 12 comments.
Show a summary per file
| File | Description |
|---|---|
plugin_factory_ui.py |
UI plugin factory for registering and creating persistent plugin views |
plugin_factory_workflow.py |
Workflow plugin factory for one-time triggered actions |
plugin_protocol.py |
Protocol definition for plugin view interface contract |
plugin_constants.py |
Centralized plugin name constants |
business_logic_tempcal_imu.py |
Business logic for IMU calibration extracted from ConfigurationManager |
frontend_tkinter_tempcal_imu.py |
UI workflow coordinator for IMU calibration |
frontend_tkinter_motor_test.py |
Motor test plugin with lifecycle hooks |
frontend_tkinter_parameter_editor.py |
Plugin integration in parameter editor with dynamic layout |
configuration_manager.py |
Plugin data model creation and refactored API |
backend_filesystem_configuration_steps.py |
Plugin configuration retrieval |
backend_filesystem.py |
Generalized file path helper |
__main__.py |
Plugin registration and validation at startup |
configuration_steps_*.json |
JSON schema and example configurations |
ARCHITECTURE_plugins.md |
Comprehensive plugin architecture documentation |
test_*.py |
Comprehensive test coverage for all plugin components |
|
|
||
| import tkinter as tk | ||
| from tkinter import ttk | ||
| from typing import Callable, Optional, Union |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use from __future__ import annotations and modern union syntax (|) instead of importing Optional and Union from typing. Replace Optional[object] with object | None and Union[tk.Frame, ttk.Frame] with tk.Frame | ttk.Frame to align with the project's modern Python type hinting style as seen in other new files.
| finally: | ||
| self.parameter_area_paned = None | ||
|
|
||
| def __update_plugin_layout(self, plugin: Optional[dict]) -> None: # noqa: UP045 |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The # noqa: UP045 comment suppresses the ruff rule for using modern union syntax. Since the project uses from __future__ import annotations (line 13), you should use dict | None instead of Optional[dict] and remove the noqa comment to maintain consistency with project standards.
| def __update_plugin_layout(self, plugin: Optional[dict]) -> None: # noqa: UP045 | |
| def __update_plugin_layout(self, plugin: dict | None) -> None: |
| self.file_upload_progress_window.destroy() | ||
|
|
||
| def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: bool = False) -> None: | ||
| def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: bool = False) -> None: # noqa: UP007 |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use modern union syntax tk.Event | None instead of Union[None, tk.Event] and remove the # noqa: UP007 comments. The file already has from __future__ import annotations so the modern syntax is available and should be used consistently.
| def on_param_file_combobox_change(self, _event: Union[None, tk.Event], forced: bool = False) -> None: # noqa: UP007 | |
| def on_param_file_combobox_change(self, _event: tk.Event | None, forced: bool = False) -> None: |
| self.skip_button.configure(state=skip_button_state) | ||
|
|
||
| def on_skip_click(self, _event: Union[None, tk.Event] = None) -> None: | ||
| def on_skip_click(self, _event: Union[None, tk.Event] = None) -> None: # noqa: UP007 |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use modern union syntax tk.Event | None instead of Union[None, tk.Event] and remove the # noqa: UP007 comments. The file already has from __future__ import annotations so the modern syntax is available and should be used consistently.
| def on_skip_click(self, _event: Union[None, tk.Event] = None) -> None: # noqa: UP007 | |
| def on_skip_click(self, _event: tk.Event | None = None) -> None: |
| def _create_motor_test_view( | ||
| parent: Union[tk.Frame, ttk.Frame], | ||
| model: object, | ||
| base_window: object, | ||
| ) -> MotorTestView: |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use modern union syntax tk.Frame | ttk.Frame instead of Union[tk.Frame, ttk.Frame]. Since this file doesn't currently have from __future__ import annotations, it should be added at the top of the file to enable modern type hinting syntax consistently.
|
|
||
| return sorted_phases | ||
|
|
||
| def get_plugin(self, selected_file: str) -> Optional[dict]: |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use modern union syntax dict | None instead of Optional[dict]. Add from __future__ import annotations at the top of the file to enable this syntax.
| _config_steps_descriptions = _("Short description for blog reference") | ||
| _config_steps_descriptions = _("Short description for wiki reference") | ||
| _config_steps_descriptions = _("Starting step number of this phase") | ||
| _config_steps_descriptions = _("Text indicating if step is mandatory or optional with percentages") |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to '_config_steps_descriptions' is unnecessary as it is redefined before this value is used.
| _config_steps_descriptions = _("Short description for wiki reference") | ||
| _config_steps_descriptions = _("Starting step number of this phase") | ||
| _config_steps_descriptions = _("Text indicating if step is mandatory or optional with percentages") | ||
| _config_steps_descriptions = _("The name of the plugin to load") |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to '_config_steps_descriptions' is unnecessary as it is redefined before this value is used.
| _config_steps_descriptions = _("The name of the plugin to load") | ||
| _config_steps_descriptions = _("URL to blog documentation") | ||
| _config_steps_descriptions = _("URL to external tool") | ||
| _config_steps_descriptions = _("URL to wiki documentation") |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to '_config_steps_descriptions' is unnecessary as it is redefined before this value is used.
| _config_steps_descriptions = _("URL to blog documentation") | ||
| _config_steps_descriptions = _("URL to external tool") | ||
| _config_steps_descriptions = _("URL to wiki documentation") | ||
| _config_steps_descriptions = _("Where to place the plugin: 'left' for left of scrollable frame, 'top' for above contents") |
Copilot
AI
Nov 5, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This assignment to '_config_steps_descriptions' is unnecessary as it is redefined before this value is used.
☂️ Python Coverage
Overall Coverage
New Files
Modified Files
|
Test Results 3 files ± 0 3 suites ±0 2m 54s ⏱️ -4s Results for commit 9be901b. ± Comparison against base commit 252d4ad. This pull request removes 6 and adds 48 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
The big advantage is that it allows for easier testing and development of the tempcal IMU (and other similar) feature in isolation from the rest of the codebase.
20d548c to
9be901b
Compare
No description provided.