Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions ardupilot_methodic_configurator/battery_cell_voltages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"))
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
4 changes: 2 additions & 2 deletions tests/test_battery_cell_voltages.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
14 changes: 13 additions & 1 deletion tests/test_frontend_tkinter_usage_popup_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down