1) Uses textuals CSS_PATH and an external tcss file to bundle all DEFAULT_CSS into one file

2) Added keyboard shortcut bindings for switching the language (Ctrl-T) and showing the help (Ctrl-A) The help should use a markdown viewer
3) Include a test folder containing all the tests
This commit is contained in:
2026-09-19 14:28:40 +02:00
parent 701ff3a6d3
commit fccd2def59
20 changed files with 1118 additions and 107 deletions
+38
View File
@@ -0,0 +1,38 @@
"""Modal dialog showing the current language's help text as Markdown."""
from __future__ import annotations
from textual.app import ComposeResult
from textual.containers import Container, Horizontal
from textual.screen import ModalScreen
from textual.widgets import Button, Label, MarkdownViewer
from i18n import I18n
class HelpScreen(ModalScreen[None]):
"""Renders ``I18n.get_help()`` in a scrollable Markdown viewer."""
# Styling for this screen lives in the app's shared external stylesheet
# (app/styles.tcss), loaded via DownloadManagerApp.CSS_PATH.
BINDINGS = [("escape", "close", "Close")]
def compose(self) -> ComposeResult:
i18n = I18n()
try:
help_text = i18n.get_help()
except FileNotFoundError:
help_text = i18n.t("dialog.help_missing", default="No help is available.")
with Container():
yield Label(i18n.t("dialog.help_title", default="Help"), id="help-title")
yield MarkdownViewer(help_text, show_table_of_contents=False)
with Horizontal():
yield Button(i18n.t("button.close", default="Close"), id="help-close")
def on_button_pressed(self, event: Button.Pressed) -> None:
self.dismiss(None)
def action_close(self) -> None:
self.dismiss(None)