Skip to content

Commit f2ab86c

Browse files
authored
Merge branch 'master' into macOS_tests
Signed-off-by: Amilcar Lucas <[email protected]>
2 parents 84f5459 + e72707f commit f2ab86c

File tree

504 files changed

+39110
-11601
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

504 files changed

+39110
-11601
lines changed

.gitattributes

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AI translation prompt templates should be treated as YAML
22
#
3-
# SPDX-FileCopyrightText: 2024-2025 Amilcar do Carmo Lucas <[email protected]>
3+
# SPDX-FileCopyrightText: 2024-2026 Amilcar do Carmo Lucas <[email protected]>
44
#
55
# SPDX-License-Identifier: GPL-3.0-or-later
66
*.prompt.yml linguist-language=YAML

.github/copilot-instructions.md

Lines changed: 49 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -4,46 +4,69 @@ This is a Python GUI application for configuring ArduPilot flight controller par
44

55
## Code Style and Standards
66

7-
We follow PEP 8 Python style guidelines with strict linting using ruff, pylint, mypy, and pyright.
8-
All code must pass these checks before merging.
7+
- Follow PEP 8 Python style guidelines with strict linting (ruff, pylint, mypy, pyright)
8+
- Use type hints for all function parameters and return values (PEP 484)
9+
- Use ruff only for Python files (*.py); use `npx markdownlint-cli2` for markdown files (*.md)
10+
- All code must pass pre-commit checks before merging
911

10-
**Important**: Use ruff only for Python files (*.py).
11-
For markdown files (*.md), use `npx markdownlint-cli2` or similar markdown-specific linting tools.
12+
## Testing
1213

13-
When writing code, use type hints for all function parameters and return values following PEP 484 standards.
14+
- Use pytest with behavior-driven development (BDD) approach
15+
- Test structure: Given-When-Then pattern with descriptive names like `test_user_can_select_template_by_double_clicking`
16+
- Focus on user behavior and business value, not implementation details
1417

15-
## Testing Philosophy
18+
## Architecture
1619

17-
We use pytest for testing with a behavior-driven development (BDD) approach.
18-
Tests should focus on user behavior and business value, not implementation details.
20+
Clean architecture with separation of concerns:
1921

20-
Test structure follows Given-When-Then pattern with descriptive names like `test_user_can_select_template_by_double_clicking`.
22+
- **Frontend**: tkinter-based GUI (inherit from `BaseWindow`, use `ScrollFrame` for scrollable areas)
23+
- **Business logic**: Vehicle templates, configuration steps, parameter management
24+
- **Backend**: Filesystem operations (`backend_filesystem.py`), flight controller communication (`backend_flightcontroller.py`)
2125

22-
For detailed testing guidelines, see `.github/instructions/pytest_testing_instructions.md`.
26+
## Dependencies and Tools
2327

24-
## Architecture
28+
- **Dependency management**: Use `uv`, not `pip` directly. Update `pyproject.toml` and `credits/CREDITS.md` when adding dependencies
29+
- **Pre-commit hooks**: Run `pre-commit install` after cloning
2530

26-
The project uses a clean architecture with separation of concerns:
31+
## Key File Conventions
2732

28-
- Frontend: tkinter-based GUI
29-
- Business logic: vehicle templates, configuration steps and parameter management
30-
- Backend: Filesystem operations, Flightcontroller integration and communication
33+
- **Parameter files**: Use `.param` extension with numbered prefixes (e.g., `01_first_setup.param`)
34+
- **Vehicle templates**: Located in `ardupilot_methodic_configurator/vehicle_templates/` with subdirectories for each vehicle type (ArduCopter, ArduPlane, Rover, Heli)
35+
- **Internationalization**: Wrap all user-facing strings with `_()` for gettext translation
3136

32-
## Dependencies and Tools
37+
## Development Workflow
38+
39+
**Setup**: Run `SetupDeveloperPC.bat` (Windows) or `SetupDeveloperPC.sh` (Linux/macOS)
40+
41+
**Run app**: Activate `.venv` then `python -m ardupilot_methodic_configurator`
42+
43+
**Code quality**: `ruff format`, `ruff check --fix`, `mypy`, `pyright`, `pylint $(git ls-files '*.py')`
44+
45+
**Testing**: `pytest tests/ -v` or `pytest tests/ --cov=ardupilot_methodic_configurator`
46+
47+
## Common Patterns
48+
49+
- **Error Handling**: Use the project's logging system (5 verbosity levels); catch specific exceptions; provide user-friendly GUI messages
50+
- **Parameter Management**: Validate parameter values before applying to flight controller
51+
- **Backend Communication**: Use `backend_flightcontroller.py` facade; implement progress callbacks for long operations
3352

34-
We use uv for dependency management, not pip directly.
35-
Always update `pyproject.toml` when adding dependencies.
53+
## Security
3654

37-
Pre-commit hooks ensure code quality - run `pre-commit install` after cloning.
55+
- Never commit secrets or credentials
56+
- Use SSL verification for network requests
57+
- Validate all user inputs before processing
3858

39-
## File Structure
59+
## Contributing
4060

41-
Parameter files use `.param` extension and are numbered (e.g., `01_first_setup.param`).
61+
- All commits must be signed off (DCO requirements)
62+
- Use Conventional Commits format for commit messages
63+
- See CONTRIBUTING.md for full details
4264

43-
Vehicle templates are organized in `ardupilot_methodic_configurator/vehicle_templates/` with subdirectories
44-
for each vehicle type (ArduCopter, ArduPlane, Rover, Heli).
65+
## Additional Documentation
4566

46-
## Internationalization
67+
When needed for specific tasks, refer to:
4768

48-
The application supports multiple languages using gettext.
49-
All user-facing strings should be wrapped with `_()` for translation.
69+
- Architecture details: ARCHITECTURE*.md files in project root
70+
- Testing guidelines: .github/instructions/pytest_testing_instructions.md
71+
- Translation workflow: .github/instructions/gui_translation_instructions.md
72+
- Other specialized instructions: .github/instructions/ directory

.github/instructions/pytest_testing_instructions.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -214,11 +214,12 @@ Test files follow specific naming conventions to clearly indicate their purpose
214214

215215
```text
216216
tests/
217-
├── test_frontend_tkinter_component.py # UI component unit tests
218-
├── test_backend_logic.py # Business logic unit tests
219-
├── gui_*.py # GUI-focused tests (prefixed with gui_)
220-
├── integration_*.py # Integration tests (prefixed with integration_)
221-
├── test_integration_workflows.py # End-to-end scenarios
217+
├── test_frontend_tkinter_component.py # BDD UI component unit tests
218+
├── test_backend_logic.py # BDD Business logic unit tests
219+
├── gui_*.py # pyautogui GUI-focused tests (prefixed with gui_)
220+
├── integration_*.py # End-to-end integration tests (prefixed with integration_)
221+
├── acceptance_*.py # Acceptance tests (prefixed with acceptance_)
222+
├── unit_*.py # Low-level unit tests for coverage purposes (prefixed with unit_)
222223
└── conftest.py # Shared fixtures
223224
```
224225

@@ -296,10 +297,11 @@ class TestTemplateSelection:
296297

297298
1. **Run tests**: `pytest tests/ -v`
298299
2. **Check coverage**: `pytest --cov=ardupilot_methodic_configurator --cov-report=term-missing`
299-
3. **Lint with ruff**: `ruff check --fix`
300-
4. **Type check with mypy**: `mypy .`
301-
5. **Advanced type check with pyright**: `pyright`
302-
6. **Style check with pylint**: `pylint $(git ls-files '*.py')`
300+
3. **Format with ruff**: `ruff format`
301+
4. **Lint with ruff**: `ruff check --fix`
302+
5. **Type check with mypy**: `mypy`
303+
6. **Advanced type check with pyright**: `pyright`
304+
7. **Style check with pylint**: `pylint $(git ls-files '*.py')`
303305

304306
### Test Execution Commands
305307

@@ -335,17 +337,6 @@ pytest tests/ -m "slow" -v
335337

336338
## 🔍 Quality Assurance
337339

338-
### Final Validation Steps
339-
340-
Before submitting any test changes:
341-
342-
1. **Verify all tests pass**: `pytest tests/ -v`
343-
2. **Confirm coverage maintained**: Check coverage report
344-
3. **Lint compliance**: `ruff check` (must pass)
345-
4. **Type safety**: `mypy .` (must pass)
346-
5. **Pyright validation**: `pyright` (should pass)
347-
6. **Style compliance**: `pylint $(git ls-files '*.py')` (address major issues)
348-
349340
### Success Criteria
350341

351342
- ✅ All tests pass consistently
@@ -358,4 +349,4 @@ Before submitting any test changes:
358349

359350
---
360351

361-
**Remember**: Great tests are an investment in the future. Write tests that make the codebase more maintainable, not just achieve coverage metrics.
352+
**Remember**: Write tests that make the codebase more maintainable, not just achieve coverage metrics.

.github/prompts/ai-translation-system.prompt.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@ messages:
33
content: |
44
You are a professional translator specializing in technical software localization for ArduPilot flight controller configuration software.
55
6-
CRITICAL INSTRUCTIONS:
7-
1. You will receive a list of English strings to translate in the format "line_number:English text"
8-
2. You MUST preserve the exact line number and colon format: "line_number:Translated text"
9-
3. Translate ONLY the text after the colon, keeping the line number and colon unchanged
10-
4. Preserve all placeholders like {variable_name}, {0}, etc. exactly as they appear
11-
5. Consider the technical aviation/drone context when translating
12-
6. Use formal register appropriate for technical documentation
13-
7. Maintain consistent terminology throughout
6+
OUTPUT FORMAT - CRITICAL:
7+
- Output ONLY the translated lines, one per line
8+
- Each line MUST be in format: "line_number:Translated text"
9+
- Do NOT include any markdown formatting, code blocks, explanations, or extra text
10+
- Do NOT wrap output in ```
11+
- Start your response directly with the first translated line
1412
15-
CONTEXT AWARENESS:
16-
- This may be part of a larger translation batch split into chunks for processing
17-
- Maintain consistency with common ArduPilot/flight controller terminology
18-
- Common terms: "parameter", "vehicle", "flight controller", "autopilot", "mission", "waypoint", "telemetry"
19-
- Use the same translation for recurring technical terms within this batch
13+
TRANSLATION RULES:
14+
1. Preserve the exact line number and colon format: "line_number:Translated text"
15+
2. Translate ONLY the text after the colon, keeping the line number unchanged
16+
3. Preserve all placeholders like {variable_name}, {0}, etc. exactly as they appear
17+
4. Consider the technical aviation/drone context when translating
18+
5. Use formal register appropriate for technical documentation
19+
6. Maintain consistent terminology throughout
2020
2121
LANGUAGE-SPECIFIC GUIDELINES:
2222
- Portuguese (pt): Use European Portuguese (Portugal) conventions, "ficheiro" not "arquivo" for "file", "transferir" not "baixar" for "download", "parâmetro" for "parameter", "veículo" for "vehicle"
@@ -25,8 +25,10 @@ messages:
2525
- Japanese (ja): Use polite form (です/ます), katakana for foreign technical terms, パラメータ for "parameter", 機体 for "vehicle", フライトコントローラー for "flight controller"
2626
- Chinese (zh_CN): Use simplified characters, technical aviation terminology in Chinese, "参数" for "parameter", "飞行器" for "vehicle", "飞控" for "flight controller"
2727
28-
EXAMPLE:
29-
Input: "123:Copy vehicle image from template"
30-
Output: "123:Copiar imagem do veículo do modelo" (for Portuguese)
28+
EXAMPLE INPUT:
29+
123:Copy vehicle image from template
30+
456:Select flight controller
3131
32-
Translate all strings while preserving the exact format and maintaining terminological consistency.
32+
EXAMPLE OUTPUT (Portuguese):
33+
123:Copiar imagem do veículo do modelo
34+
456:Selecionar controlador de voo

.github/prompts/ai-translation-user.prompt.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ messages:
88
Please read the translation file "{{translation_file}}" and translate all the strings from English to {{language}}.
99
1010
The file contains strings in the format "line_number:English text" - please translate only the text after the colon while preserving the exact line number and colon format.
11+
12+
Translation strings to process:
13+
{{translation_content}}

0 commit comments

Comments
 (0)