Skip to content
Open
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
31 changes: 13 additions & 18 deletions python/PiFinder/ui/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from typing import Type, Union

from PIL import Image, ImageDraw
from PiFinder import utils
from PiFinder.image_util import make_red
from PiFinder.displays import DisplayBase
from PiFinder.config import Config
Expand Down Expand Up @@ -121,23 +120,19 @@ def help(self) -> Union[None, list[Image.Image]]:
if self.__help_name__ == "":
return None

help_image_list = []
help_image_path = utils.pifinder_dir / "help" / self.__help_name__
for i in range(1, 10):
try:
help_image = Image.open(help_image_path / f"{i}.png")
except FileNotFoundError:
break

# help_image_list.append(
# convert_image_to_mode(help_image, self.colors.mode)
# )

help_image_list.append(make_red(help_image, self.colors))

if help_image_list == []:
return None
return help_image_list
# Use new text-based help system
from .help.loader import HelpLoader
loader = HelpLoader(self.display_class)
help_images = loader.get_help_images(self.__help_name__)

if help_images:
# Apply red-light filter to maintain night vision compatibility
help_image_list = []
for image in help_images:
help_image_list.append(make_red(image, self.colors))
return help_image_list

return None

def update(self, force=False) -> None:
"""
Expand Down
2 changes: 1 addition & 1 deletion python/PiFinder/ui/equipment.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class UIEquipment(UIModule):
"""

__title__ = "Equipment"
# TODO __help__ for Equipment!
__help_name__ = "equipment"

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
Expand Down
1 change: 1 addition & 0 deletions python/PiFinder/ui/gpsstatus.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class UIGPSStatus(UIModule):
"""

__title__ = "GPS"
__help_name__ = "gpsstatus"
_lock_type_dict = {
0: _(
"Limited"
Expand Down
2 changes: 2 additions & 0 deletions python/PiFinder/ui/help/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# UI Help System
# Text-based help content with Babel translation support
315 changes: 315 additions & 0 deletions python/PiFinder/ui/help/content.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,315 @@
"""
Help content definitions with Babel translation support.

This module provides help content for all UI screens in the PiFinder application.
Content is organized by module name matching __help_name__ attributes from the UI classes.

Structure:
- Each help module contains one or more pages
- Pages have titles, content (icon/action pairs or text), and optional navigation
- All text strings use _() for internationalization via Babel
- Icons use descriptive names that get resolved to actual glyphs by the renderer

UI Module Mapping:
- align.py → "align"
- preview.py → "camera"
- chart.py → "chart"
- equipment.py → "equipment"
- gpsstatus.py → "gpsstatus"
- log.py → "log"
- object_details.py → "object_details"
- object_list.py → "object_list"
- status.py → "status"
- text_menu.py → "menu"
"""

import PiFinder.i18n # noqa: F401 # Enables _() function for translations


def get_help_content():
"""
Returns help content structure for all UI modules.
Content is organized by module name matching __help_name__ attributes.
Icons use descriptive names that get resolved to actual glyphs by the renderer.
"""
return {
# ========================================================================
# CORE FUNCTIONALITY MODULES
# ========================================================================

"align": {
# Telescope alignment and plate solving functionality
"pages": [
{
"title": _("ALIGN HELP"),
"content": [
{
"icon": "PLUS_MINUS",
"action": _("Zoom")
},
{
"icon": "SQUARE",
"action": _("Align")
},
{
"icon": "NUMBER_0",
"action": _("Abort")
},
{
"icon": "NUMBER_1",
"action": _("Reset")
},
{
"text": _("The Align screen is for telling the PiFinder where in the sky your telescope is pointing so that it can make sure DSOs end up in your eyepiece. Point your scope at a star that is recognizable to start and press Square to start alignment and use the arrow keys to select the star your telescope is pointing to. When finished press Square again to set the alignment.")
}
]
}
]
},

"camera": {
# Live camera preview and image capture controls
"pages": [
{
"title": _("CAMERA HELP"),
"content": [
{
"icon": "SQUARE",
"action": _("Align")
},
{
"icon": "PLUS_MINUS",
"action": _("Zoom")
},
{
"text": _("CAMERA shows a live preview with zoom and align features")
}
]
}
]
},

"chart": {
# Star chart display with constellation lines and DSO plotting
"pages": [
{
"title": _("CHART HELP"),
"content": [
{
"icon": "PLUS_MINUS",
"action": _("Zoom")
},
{
"text": _("A star chart with constellation lines and DSOs plotted")
},
{
"text": _("You can set the brightness of display elements in the settings menu")
}
]
}
]
},

# ========================================================================
# OBJECT MANAGEMENT MODULES
# ========================================================================

"object_details": {
# Individual astronomical object information and actions
"pages": [
{
"title": _("OBJECT DETAILS"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Scroll")
},
{
"icon": "RIGHT",
"action": _("Log")
},
{
"icon": "SQUARE",
"action": _("Switch Info")
},
{
"text": _("The OBJECT DETAILS page shows info on the currently selected object")
},
{
"text": _("Use Square to cycle through catalog details, image and push-to instructions")
}
]
}
]
},

"object_list": {
# Astronomical object catalog browsing and filtering
"pages": [
{
"title": _("OBJECT LIST"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Scroll")
},
{
"icon": "RIGHT",
"action": _("Select")
},
{
"icon": "LEFT",
"action": _("Back")
},
{
"icon": "NUMBERS_0_9",
"action": _("Jump To")
},
{
"text": _("The OBJECT LIST is sortable via the Radial Menu and you can")
},
{
"text": _("cycle thru object info using the Square key")
},
{
"text": _("Type a number to jump to a specific object or use Square to exit")
}
]
}
]
},

# ========================================================================
# OBSERVING SESSION MODULES
# ========================================================================

"log": {
# Observation logging and session management
"pages": [
{
"title": _("LOGGING HELP"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Choose")
},
{
"icon": "RIGHT",
"action": _("Select")
},
{
"icon": "NUMBERS_0_5",
"action": _("Stars")
},
{
"text": _("Writes an entry to the log of your observing session. Set ratings and choose SAVE")
}
]
}
]
},

# ========================================================================
# SYSTEM AND CONFIGURATION MODULES
# ========================================================================

"gpsstatus": {
# GPS status, location management and satellite information
"pages": [
{
"title": _("GPS STATUS"),
"content": [
{
"icon": "LEFT",
"action": _("Save")
},
{
"icon": "RIGHT",
"action": _("Lock")
},
{
"icon": "SQUARE",
"action": _("Toggle Details")
},
{
"text": _("Shows GPS satellite lock status and location accuracy. Use Save to store the current location or Lock to use manual coordinates.")
}
]
}
]
},

"equipment": {
# Telescope and eyepiece selection and configuration
"pages": [
{
"title": _("EQUIPMENT"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Choose")
},
{
"icon": "RIGHT",
"action": _("Select")
},
{
"icon": "LEFT",
"action": _("Back")
},
{
"text": _("Select your telescope and eyepiece to calculate magnification and field of view. This affects object visibility and targeting accuracy.")
}
]
}
]
},

"status": {
# System status and hardware information display
"pages": [
{
"title": _("STATUS"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Scroll")
},
{
"text": _("Displays system information including GPS status, sensor readings, and hardware configuration.")
}
]
}
]
},

# ========================================================================
# NAVIGATION AND INTERFACE MODULES
# ========================================================================

"menu": {
# General menu navigation and interface help
"pages": [
{
"title": _("MENU HELP"),
"content": [
{
"icon": "UP_DOWN",
"action": _("Scroll")
},
{
"icon": "RIGHT",
"action": _("Select")
},
{
"icon": "LEFT",
"action": _("Back")
},
{
"text": _("Thank you for using a PiFinder")
}
]
}
]
}
}
Loading