diff --git a/ardupilot_methodic_configurator/battery_cell_voltages.py b/ardupilot_methodic_configurator/battery_cell_voltages.py index 741e0f159..99117d123 100644 --- a/ardupilot_methodic_configurator/battery_cell_voltages.py +++ b/ardupilot_methodic_configurator/battery_cell_voltages.py @@ -53,6 +53,20 @@ "recommended_low": 3.5, "recommended_crit": 3.2, }, + "NiCd": { + "absolute_max": 1.45, + "absolute_min": 1.0, + "recommended_max": 1.4, + "recommended_low": 1.2, + "recommended_crit": 1.1, + }, + "NiMH": { + "absolute_max": 1.45, + "absolute_min": 1.0, + "recommended_max": 1.4, + "recommended_low": 1.2, + "recommended_crit": 1.1, + }, # Add more chemistries as needed } diff --git a/ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py b/ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py index 6e3484f35..8b3bc9b66 100755 --- a/ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py +++ b/ardupilot_methodic_configurator/frontend_tkinter_component_editor_base.py @@ -308,7 +308,7 @@ def _display_component_editor_usage_instructions(self, parent: tk.Tk) -> None: height=6, bd=0, background=style.lookup("TLabel", "background"), - font=create_scaled_font(get_safe_font_config(), 1.2), + font=create_scaled_font(get_safe_font_config(), 1.5), ) # pylint: enable=duplicate-code instructions_text.insert(tk.END, _("1. Describe the properties of the vehicle components in the window below.\n")) @@ -552,9 +552,9 @@ def _confirm_component_properties(self) -> bool: validation_popup_window = BaseWindow(cast("tk.Tk", self.root)) style = ttk.Style() - # Create a 20% larger font + # Create a 50% larger font font_config = get_safe_font_config() - larger_font = create_scaled_font(font_config, 1.2) + larger_font = create_scaled_font(font_config, 1.5) confirmation_text = RichText( validation_popup_window.main_frame, diff --git a/ardupilot_methodic_configurator/frontend_tkinter_rich_text.py b/ardupilot_methodic_configurator/frontend_tkinter_rich_text.py index 5585863e5..b9680ac85 100644 --- a/ardupilot_methodic_configurator/frontend_tkinter_rich_text.py +++ b/ardupilot_methodic_configurator/frontend_tkinter_rich_text.py @@ -47,7 +47,7 @@ class RichText(tk.Text): # pylint: disable=too-many-ancestors def __init__(self, *args, **kwargs) -> None: super().__init__(*args, **kwargs) - default_font = safe_font_nametofont() + default_font = kwargs.get("font") or safe_font_nametofont() if default_font: # Use the actual font configuration if available bold_font = tkFont.Font(**default_font.configure()) # type: ignore[arg-type] diff --git a/ardupilot_methodic_configurator/frontend_tkinter_usage_popup_window.py b/ardupilot_methodic_configurator/frontend_tkinter_usage_popup_window.py index 9af300162..d126e909c 100644 --- a/ardupilot_methodic_configurator/frontend_tkinter_usage_popup_window.py +++ b/ardupilot_methodic_configurator/frontend_tkinter_usage_popup_window.py @@ -192,7 +192,7 @@ def display_workflow_explanation(parent: Optional[tk.Tk] = None) -> BaseWindow: height=1, bd=0, background=ttk.Style(popup_window.root).lookup("TLabel", "background"), - font=create_scaled_font(get_safe_font_config(), 1.2), + font=create_scaled_font(get_safe_font_config(), 1.5), ) instructions.insert(tk.END, _("This is not a ground control station and it has a different workflow:")) UsagePopupWindow.setup_window( @@ -219,7 +219,7 @@ def display_workflow_explanation(parent: Optional[tk.Tk] = None) -> BaseWindow: height=1, bd=0, background=ttk.Style(popup_window.root).lookup("TLabel", "background"), - font=create_scaled_font(get_safe_font_config(), 1.2), + font=create_scaled_font(get_safe_font_config(), 1.5), ) rich_text.insert(tk.END, _("see ")) rich_text.insert_clickable_link( diff --git a/tests/test_battery_cell_voltages.py b/tests/test_battery_cell_voltages.py index 967c72277..709f3f674 100755 --- a/tests/test_battery_cell_voltages.py +++ b/tests/test_battery_cell_voltages.py @@ -18,7 +18,7 @@ class TestBatteryCell(unittest.TestCase): # pylint: disable=missing-class-docstring def test_chemistries(self) -> None: - expected_chemistries = ("LiIon", "LiIonSS", "LiIonSSHV", "Lipo", "LipoHV", "LipoHVSS") + expected_chemistries = ("LiIon", "LiIonSS", "LiIonSSHV", "Lipo", "LipoHV", "LipoHVSS", "NiCd", "NiMH") chemistries = BatteryCell.chemistries() assert chemistries == expected_chemistries @@ -30,7 +30,7 @@ def test_limit_max_voltage(self) -> None: def test_limit_min_voltage(self) -> None: assert BatteryCell.limit_min_voltage("LiIon") == 2.5 assert BatteryCell.limit_min_voltage("LipoHV") == 3.0 - assert BatteryCell.limit_min_voltage("NonExistentChemistry") == 2.4 + assert BatteryCell.limit_min_voltage("NonExistentChemistry") == 1.0 def test_recommended_max_voltage(self) -> None: assert BatteryCell.recommended_max_voltage("LiIon") == 4.1 diff --git a/tests/test_frontend_tkinter_usage_popup_window.py b/tests/test_frontend_tkinter_usage_popup_window.py index 4944ccf61..365f6b34c 100755 --- a/tests/test_frontend_tkinter_usage_popup_window.py +++ b/tests/test_frontend_tkinter_usage_popup_window.py @@ -10,6 +10,8 @@ SPDX-License-Identifier: GPL-3.0-or-later """ +import os +import sys import tkinter as tk from tkinter import ttk from unittest.mock import MagicMock, patch @@ -199,7 +201,17 @@ def test_popup_shows_correct_title_and_content(self, tk_root, popup_window, rich # Assert: Window configured correctly for user assert popup_window.root.title() == "Test Title" - assert popup_window.root.geometry().startswith("574x41") + # On Windows (including CI runners on windows) Tk reports a different + # geometry so we expect the larger size there. On GitHub Actions + # (ubuntu-latest) use the GitHub-specific env var. Otherwise keep the + # local expected geometry. + if sys.platform.startswith("win"): + expected_geometry = "814x594" + elif os.getenv("CI", "").lower() in ("true", "1"): + expected_geometry = "654x490" + else: + expected_geometry = "574x41" + assert popup_window.root.geometry().startswith(expected_geometry) # Assert: UI elements created for user interaction children = popup_window.main_frame.winfo_children()