Function bodies 373 total
_find_fetch_new_range function · python · L27-L48 (22 LOC)garmin_extract/screens/data_pull.py
def _find_fetch_new_range() -> tuple[str, int] | None:
"""
Scan data/garmin/ for the most recent date file.
Returns (start_iso, days) covering next-unsynced → yesterday.
Returns None if already up to date.
Raises FileNotFoundError if no date files exist yet.
"""
import re
data_dir = Path(__file__).parent.parent.parent / "data" / "garmin"
if not data_dir.exists():
raise FileNotFoundError("no data directory")
date_re = re.compile(r"^\d{4}-\d{2}-\d{2}\.json$")
dates = sorted(f.stem for f in data_dir.glob("*.json") if date_re.match(f.name))
if not dates:
raise FileNotFoundError("no date files")
latest = date.fromisoformat(dates[-1])
yesterday = date.today() - timedelta(days=1)
start = latest + timedelta(days=1)
if start > yesterday:
return None # already up to date
return start.isoformat(), (yesterday - start).days + 1DataPullScreen class · python · L51-L247 (197 LOC)garmin_extract/screens/data_pull.py
class DataPullScreen(Screen[None]):
"""Submenu for pulling data and rebuilding reports."""
_ITEM_COUNT = 8
BINDINGS = [
Binding("0", "fetch_new", show=False),
Binding("1", "pull_yesterday", show=False),
Binding("2", "pull_7", show=False),
Binding("3", "pull_30", show=False),
Binding("4", "pull_custom", show=False),
Binding("5", "pull_history", show=False),
Binding("6", "import_zip", show=False),
Binding("7", "rebuild_csvs", show=False),
Binding("up", "cursor_up", show=False),
Binding("k", "cursor_up", show=False),
Binding("down", "cursor_down", show=False),
Binding("j", "cursor_down", show=False),
Binding("enter", "cursor_select", show=False),
Binding("b", "back", "Back", show=True),
Binding("q", "quit", "Quit", show=True),
]
CSS = """
DataPullScreen {
align: center middle;
}
#pull-menu {
width: 57;
height: a_item method · python · L105-L111 (7 LOC)garmin_extract/screens/data_pull.py
def _item(self, pos: int, key: str, label: str, hint: str = "") -> str:
"""Render one menu item with cursor indicator if selected."""
sel = pos == getattr(self, "_cursor", 0)
pre = "❯ " if sel else " "
lbl = f"[bold]{label}[/]" if sel else label
h = f" [dim]{hint}[/]" if hint else ""
return f"{pre}[bold cyan][{key}][/] {lbl}{h}"_build_menu method · python · L113-L137 (25 LOC)garmin_extract/screens/data_pull.py
def _build_menu(self) -> str:
yest = _yesterday()
r7 = _date_range_label(7)
r30 = _date_range_label(30)
_ = self._item
return (
f"\n"
f" [bold dim]SYNC[/]\n {'─' * 51}\n"
f"{_(0, '0', 'Fetch new', 'pull all dates not yet in local data')}\n"
f"\n"
f" [bold dim]RECENT[/]\n {'─' * 51}\n"
f"{_(1, '1', 'Yesterday', yest)}\n"
f"{_(2, '2', 'Last 7 days', r7)}\n"
f"{_(3, '3', 'Last 30 days', r30)}\n"
f"\n"
f" [bold dim]CUSTOM[/]\n {'─' * 51}\n"
f"{_(4, '4', 'Specific date or range')}\n"
f"{_(5, '5', 'Full history', '(from a date you choose)')}\n"
f"\n"
f" [bold dim]IMPORT[/]\n {'─' * 51}\n"
f"{_(6, '6', 'Import from Garmin bulk export', '.zip')}\n"
f"\n"
f" [bold dim]REPORTS[/]\n {'─' * 51}\n"
f"{_(7, '7', 'Rebuild CSV reports',compose method · python · L139-L146 (8 LOC)garmin_extract/screens/data_pull.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
yield Static(self._build_menu(), id="pull-menu")
yield Static(
"↑↓ j/k navigate · enter select · 0–7 direct · b back",
id="pull-hint",
)
yield Footer()action_cursor_up method · python · L154-L157 (4 LOC)garmin_extract/screens/data_pull.py
def action_cursor_up(self) -> None:
if self._cursor > 0:
self._cursor -= 1
self._refresh_menu()action_cursor_down method · python · L159-L162 (4 LOC)garmin_extract/screens/data_pull.py
def action_cursor_down(self) -> None:
if self._cursor < self._ITEM_COUNT - 1:
self._cursor += 1
self._refresh_menu()Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
action_cursor_select method · python · L164-L175 (12 LOC)garmin_extract/screens/data_pull.py
def action_cursor_select(self) -> None:
_actions = [
self.action_fetch_new,
self.action_pull_yesterday,
self.action_pull_7,
self.action_pull_30,
self.action_pull_custom,
self.action_pull_history,
self.action_import_zip,
self.action_rebuild_csvs,
]
_actions[self._cursor]()_push_progress method · python · L177-L195 (19 LOC)garmin_extract/screens/data_pull.py
def _push_progress(
self,
start_date: str,
days: int,
label: str,
no_skip: bool = False,
rebuild_only: bool = False,
) -> None:
from garmin_extract.screens.pull_progress import PullProgressScreen
self.app.push_screen(
PullProgressScreen(
start_date=start_date,
days=days,
label=label,
no_skip=no_skip,
rebuild_only=rebuild_only,
)
)action_fetch_new method · python · L197-L210 (14 LOC)garmin_extract/screens/data_pull.py
def action_fetch_new(self) -> None:
self._cursor = 0
try:
result = _find_fetch_new_range()
except FileNotFoundError:
# No local data at all — let the user pick a start date
self.app.push_screen(FullHistoryScreen())
return
if result is None:
self.notify("Already up to date — no new dates to pull.", title="Fetch New")
return
start, days = result
end = (date.fromisoformat(start) + timedelta(days=days - 1)).isoformat()
self._push_progress(start, days, f"Fetch new ({start} → {end})")action_pull_yesterday method · python · L212-L215 (4 LOC)garmin_extract/screens/data_pull.py
def action_pull_yesterday(self) -> None:
self._cursor = 1
yest = _yesterday()
self._push_progress(yest, 1, f"Yesterday ({yest})")action_pull_7 method · python · L217-L220 (4 LOC)garmin_extract/screens/data_pull.py
def action_pull_7(self) -> None:
self._cursor = 2
start = (date.today() - timedelta(days=7)).isoformat()
self._push_progress(start, 7, f"Last 7 days ({_date_range_label(7)})")action_pull_30 method · python · L222-L225 (4 LOC)garmin_extract/screens/data_pull.py
def action_pull_30(self) -> None:
self._cursor = 3
start = (date.today() - timedelta(days=30)).isoformat()
self._push_progress(start, 30, f"Last 30 days ({_date_range_label(30)})")action_pull_custom method · python · L227-L229 (3 LOC)garmin_extract/screens/data_pull.py
def action_pull_custom(self) -> None:
self._cursor = 4
self.app.push_screen(CustomDateScreen())action_pull_history method · python · L231-L233 (3 LOC)garmin_extract/screens/data_pull.py
def action_pull_history(self) -> None:
self._cursor = 5
self.app.push_screen(FullHistoryScreen())Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
action_import_zip method · python · L235-L237 (3 LOC)garmin_extract/screens/data_pull.py
def action_import_zip(self) -> None:
self._cursor = 6
self.app.push_screen(ImportZipScreen())action_rebuild_csvs method · python · L239-L241 (3 LOC)garmin_extract/screens/data_pull.py
def action_rebuild_csvs(self) -> None:
self._cursor = 7
self._push_progress("", 0, "Rebuilding CSV reports", rebuild_only=True)_parse_date function · python · L255-L261 (7 LOC)garmin_extract/screens/data_pull.py
def _parse_date(s: str) -> str | None:
for fmt in ("%Y-%m-%d", "%m/%d/%Y", "%m/%d/%y", "%m-%d-%Y", "%m-%d-%y"):
try:
return datetime.strptime(s.strip(), fmt).strftime("%Y-%m-%d")
except ValueError:
continue
return None_InputScreen class · python · L264-L304 (41 LOC)garmin_extract/screens/data_pull.py
class _InputScreen(Screen[None]):
"""Base class for single-step input screens."""
BINDINGS = [
Binding("escape", "back", "Back", show=True),
Binding("q", "quit", "Quit", show=True),
]
CSS = """
_InputScreen {
align: center middle;
}
#input-box {
width: 58;
height: auto;
border: round $primary;
padding: 1 2;
}
#input-title {
text-style: bold;
margin-bottom: 1;
}
#input-hint {
color: $text-muted;
margin-bottom: 1;
}
#input-error {
color: $error;
height: 1;
}
"""
def action_back(self) -> None:
self.app.pop_screen()
def action_quit(self) -> None:
self.app.exit()CustomDateScreen class · python · L307-L348 (42 LOC)garmin_extract/screens/data_pull.py
class CustomDateScreen(_InputScreen):
"""Prompt for a start date and optional day count."""
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Custom Date Pull", id="input-title")
yield Static(
"Formats: YYYY-MM-DD · MM/DD/YYYY · MM/DD/YY",
id="input-hint",
)
yield Input(placeholder="Start date", id="start-date")
yield Input(placeholder="Number of days (default: 1)", id="num-days")
yield Static("", id="input-error")
yield Footer()
def on_input_submitted(self, event: Input.Submitted) -> None:
if event.input.id == "start-date":
self.query_one("#num-days", Input).focus()
return
start_raw = self.query_one("#start-date", Input).value.strip()
days_raw = self.query_one("#num-days", Input).value.strip()
error = self.query_one("#input-ercompose method · python · L310-L321 (12 LOC)garmin_extract/screens/data_pull.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Custom Date Pull", id="input-title")
yield Static(
"Formats: YYYY-MM-DD · MM/DD/YYYY · MM/DD/YY",
id="input-hint",
)
yield Input(placeholder="Start date", id="start-date")
yield Input(placeholder="Number of days (default: 1)", id="num-days")
yield Static("", id="input-error")
yield Footer()on_input_submitted method · python · L323-L340 (18 LOC)garmin_extract/screens/data_pull.py
def on_input_submitted(self, event: Input.Submitted) -> None:
if event.input.id == "start-date":
self.query_one("#num-days", Input).focus()
return
start_raw = self.query_one("#start-date", Input).value.strip()
days_raw = self.query_one("#num-days", Input).value.strip()
error = self.query_one("#input-error", Static)
start = _parse_date(start_raw)
if not start:
error.update(f"Cannot parse '{start_raw}' — try 2025-04-07")
self.query_one("#start-date", Input).focus()
return
days = int(days_raw) if days_raw.isdigit() and int(days_raw) > 0 else 1
self._push_pull(start, days)_push_pull method · python · L342-L348 (7 LOC)garmin_extract/screens/data_pull.py
def _push_pull(self, start: str, days: int) -> None:
from garmin_extract.screens.pull_progress import PullProgressScreen
self.app.pop_screen()
self.app.push_screen(
PullProgressScreen(start_date=start, days=days, label=f"Custom ({start}, {days}d)")
)Repobility analyzer · published findings · https://repobility.com
FullHistoryScreen class · python · L351-L393 (43 LOC)garmin_extract/screens/data_pull.py
class FullHistoryScreen(_InputScreen):
"""Prompt for a start date for a full history pull."""
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Full History Pull", id="input-title")
yield Static(
"Pulls every day from your chosen start date through yesterday.\n"
"Formats: YYYY-MM-DD · MM/DD/YYYY · MM/DD/YY",
id="input-hint",
)
yield Input(placeholder="Pull data starting from", id="start-date")
yield Static("", id="input-error")
yield Footer()
def on_input_submitted(self, event: Input.Submitted) -> None:
raw = self.query_one("#start-date", Input).value.strip()
error = self.query_one("#input-error", Static)
start = _parse_date(raw)
if not start:
error.update(f"Cannot parse '{raw}' — try 2023-01-01")
return
start_dt = compose method · python · L354-L365 (12 LOC)garmin_extract/screens/data_pull.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Full History Pull", id="input-title")
yield Static(
"Pulls every day from your chosen start date through yesterday.\n"
"Formats: YYYY-MM-DD · MM/DD/YYYY · MM/DD/YY",
id="input-hint",
)
yield Input(placeholder="Pull data starting from", id="start-date")
yield Static("", id="input-error")
yield Footer()on_input_submitted method · python · L367-L393 (27 LOC)garmin_extract/screens/data_pull.py
def on_input_submitted(self, event: Input.Submitted) -> None:
raw = self.query_one("#start-date", Input).value.strip()
error = self.query_one("#input-error", Static)
start = _parse_date(raw)
if not start:
error.update(f"Cannot parse '{raw}' — try 2023-01-01")
return
start_dt = datetime.strptime(start, "%Y-%m-%d").date()
yesterday = date.today() - timedelta(days=1)
days = (yesterday - start_dt).days + 1
if days <= 0:
error.update("Start date must be before today.")
return
from garmin_extract.screens.pull_progress import PullProgressScreen
self.app.pop_screen()
self.app.push_screen(
PullProgressScreen(
start_date=start,
days=days,
label=f"Full history ({start} → {yesterday.isoformat()})",
)
)ImportZipScreen class · python · L396-L434 (39 LOC)garmin_extract/screens/data_pull.py
class ImportZipScreen(_InputScreen):
"""Prompt for the path to a Garmin bulk export .zip."""
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Import from Garmin Bulk Export", id="input-title")
yield Static(
"Request your export at:\n"
"Garmin Connect → Profile → Account → Your Garmin Data\n"
"The .zip file arrives within 24–48 hours.",
id="input-hint",
)
yield Input(placeholder="Path to export .zip", id="zip-path")
yield Static("", id="input-error")
yield Footer()
def on_input_submitted(self, event: Input.Submitted) -> None:
raw = self.query_one("#zip-path", Input).value.strip().strip("'\"")
error = self.query_one("#input-error", Static)
if not raw:
return
if not Path(raw).exists():
error.update(f"File not founcompose method · python · L399-L411 (13 LOC)garmin_extract/screens/data_pull.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
with Static(id="input-box"):
yield Static("Import from Garmin Bulk Export", id="input-title")
yield Static(
"Request your export at:\n"
"Garmin Connect → Profile → Account → Your Garmin Data\n"
"The .zip file arrives within 24–48 hours.",
id="input-hint",
)
yield Input(placeholder="Path to export .zip", id="zip-path")
yield Static("", id="input-error")
yield Footer()on_input_submitted method · python · L413-L434 (22 LOC)garmin_extract/screens/data_pull.py
def on_input_submitted(self, event: Input.Submitted) -> None:
raw = self.query_one("#zip-path", Input).value.strip().strip("'\"")
error = self.query_one("#input-error", Static)
if not raw:
return
if not Path(raw).exists():
error.update(f"File not found: {raw}")
return
from garmin_extract.screens.pull_progress import PullProgressScreen
self.app.pop_screen()
self.app.push_screen(
PullProgressScreen(
start_date="",
days=0,
label="Garmin bulk export import",
zip_path=raw,
)
)_build_menu function · python · L19-L34 (16 LOC)garmin_extract/screens/drive_sheets.py
def _build_menu(cursor: int = 0) -> str:
top = " ┌" + "─" * _W + "┐"
bottom = " └" + "─" * _W + "┘"
rows = ["\n" + top, _EMPTY_ROW]
for i, (key, label, hint) in enumerate(_ITEMS):
sel = i == cursor
cur = "❯" if sel else " "
lbl = f"[bold]{label}[/]" if sel else label
h = f"[bold]{hint}[/]" if sel else hint
lbl_pad = " " * (_W - 8 - len(label))
hint_pad = " " * (_W - 8 - len(hint))
rows.append(f" │ {cur} [bold cyan][{key}][/] {lbl}{lbl_pad}│")
rows.append(f" │ [dim]{h}[/]{hint_pad}│")
rows.append(_EMPTY_ROW)
rows.append(bottom)
return "\n".join(rows)DriveSheetsScreen class · python · L37-L241 (205 LOC)garmin_extract/screens/drive_sheets.py
class DriveSheetsScreen(Screen[None]):
"""Google Drive / Sheets export landing screen."""
_ITEM_COUNT = 3
BINDINGS = [
Binding("1", "do_drive", show=False),
Binding("2", "do_sheets", show=False),
Binding("3", "do_both", show=False),
Binding("up", "cursor_up", show=False),
Binding("k", "cursor_up", show=False),
Binding("down", "cursor_down", show=False),
Binding("j", "cursor_down", show=False),
Binding("enter", "cursor_select", show=False),
Binding("b", "back", "Back", show=True),
Binding("q", "quit", "Quit", show=True),
]
CSS = """
DriveSheetsScreen {
layout: vertical;
padding: 2 4;
}
#ds-header {
text-style: bold;
color: $accent;
margin-bottom: 1;
}
#ds-auth {
height: auto;
margin-bottom: 1;
}
#ds-last {
color: $text-muted;
height: auto;
margin-bottom: 1;
}
#ds-menuSame scanner, your repo: https://repobility.com — Repobility
compose method · python · L96-L107 (12 LOC)garmin_extract/screens/drive_sheets.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
yield Static("Google Drive / Sheets", id="ds-header")
yield Static("Checking authorization…", id="ds-auth")
yield Static("", id="ds-last")
yield Static(_build_menu(0), id="ds-menu")
yield Static(
"↑↓ j/k navigate · enter select · 1–3 direct · b back",
id="ds-hint",
)
yield Static("", id="ds-status")
yield Footer()on_mount method · python · L109-L111 (3 LOC)garmin_extract/screens/drive_sheets.py
def on_mount(self) -> None:
self._cursor = 0
self.run_worker(self._check_auth, thread=True, name="ds-auth-check")action_cursor_up method · python · L119-L122 (4 LOC)garmin_extract/screens/drive_sheets.py
def action_cursor_up(self) -> None:
if self._cursor > 0:
self._cursor -= 1
self._refresh_menu()action_cursor_down method · python · L124-L127 (4 LOC)garmin_extract/screens/drive_sheets.py
def action_cursor_down(self) -> None:
if self._cursor < self._ITEM_COUNT - 1:
self._cursor += 1
self._refresh_menu()_check_auth method · python · L134-L158 (25 LOC)garmin_extract/screens/drive_sheets.py
def _check_auth(self) -> None:
from garmin_extract._google_drive import check_auth, load_config
status, detail = check_auth()
cfg = load_config()
last = cfg.get("last_export")
if status == "ok":
auth_text = "[green]✓[/] Drive and Sheets authorized"
elif status == "missing_scopes":
auth_text = f"[yellow]⚠[/] {detail}"
else:
auth_text = f"[red]✗[/] {detail}"
last_text = ""
if last:
try:
from datetime import datetime
dt = datetime.fromisoformat(last).astimezone(None) # local timezone
last_text = f"Last export: {dt.strftime('%Y-%m-%d %H:%M')}"
except Exception:
last_text = f"Last export: {last[:19]}"
self.app.call_from_thread(self._apply_auth, auth_text, last_text)_apply_auth method · python · L160-L162 (3 LOC)garmin_extract/screens/drive_sheets.py
def _apply_auth(self, auth_text: str, last_text: str) -> None:
self.query_one("#ds-auth", Static).update(auth_text)
self.query_one("#ds-last", Static).update(last_text)action_do_drive method · python · L169-L173 (5 LOC)garmin_extract/screens/drive_sheets.py
def action_do_drive(self) -> None:
self._cursor = 0
self._refresh_menu()
self._set_status("[dim]Uploading CSVs to Drive…[/]")
self.run_worker(self._run_drive, thread=True, exclusive=True, name="ds-drive")action_do_sheets method · python · L175-L179 (5 LOC)garmin_extract/screens/drive_sheets.py
def action_do_sheets(self) -> None:
self._cursor = 1
self._refresh_menu()
self._set_status("[dim]Syncing to Google Sheets…[/]")
self.run_worker(self._run_sheets, thread=True, exclusive=True, name="ds-sheets")Provenance: Repobility (https://repobility.com) — every score reproducible from /scan/
action_do_both method · python · L181-L185 (5 LOC)garmin_extract/screens/drive_sheets.py
def action_do_both(self) -> None:
self._cursor = 2
self._refresh_menu()
self._set_status("[dim]Uploading CSVs and syncing Sheets…[/]")
self.run_worker(self._run_both, thread=True, exclusive=True, name="ds-both")_run_drive method · python · L189-L198 (10 LOC)garmin_extract/screens/drive_sheets.py
def _run_drive(self) -> None:
from garmin_extract._google_drive import upload_csvs_to_drive
result = upload_csvs_to_drive()
if result["ok"]:
names = " · ".join(f["name"] for f in result["files"])
text = f"[green]✓[/] Uploaded: {names}\n[dim]{result['folder_link']}[/]"
else:
text = f"[red]✗[/] {result['error']}"
self.app.call_from_thread(self._apply_result, text)_run_sheets method · python · L200-L208 (9 LOC)garmin_extract/screens/drive_sheets.py
def _run_sheets(self) -> None:
from garmin_extract._google_drive import sync_to_sheets
result = sync_to_sheets()
if result["ok"]:
text = f"[green]✓[/] Google Sheet updated\n[dim]{result['sheet_url']}[/]"
else:
text = f"[red]✗[/] {result['error']}"
self.app.call_from_thread(self._apply_result, text)_run_both method · python · L210-L228 (19 LOC)garmin_extract/screens/drive_sheets.py
def _run_both(self) -> None:
from garmin_extract._google_drive import sync_to_sheets, upload_csvs_to_drive
lines = []
drive_result = upload_csvs_to_drive()
if drive_result["ok"]:
names = " · ".join(f["name"] for f in drive_result["files"])
lines.append(f"[green]✓[/] Drive: {names}")
else:
lines.append(f"[red]✗[/] Drive: {drive_result['error']}")
sheets_result = sync_to_sheets()
if sheets_result["ok"]:
lines.append(f"[green]✓[/] Sheets updated\n[dim]{sheets_result['sheet_url']}[/]")
else:
lines.append(f"[red]✗[/] Sheets: {sheets_result['error']}")
self.app.call_from_thread(self._apply_result, "\n".join(lines))_apply_result method · python · L230-L233 (4 LOC)garmin_extract/screens/drive_sheets.py
def _apply_result(self, text: str) -> None:
self._set_status(text)
# Refresh last-export timestamp
self.run_worker(self._check_auth, thread=True, name="ds-auth-refresh")_build_menu function · python · L26-L41 (16 LOC)garmin_extract/screens/main_menu.py
def _build_menu(cursor: int) -> str:
top = " ┌" + "─" * _W + "┐"
bottom = " └" + "─" * _W + "┘"
rows = ["\n" + top, _EMPTY_ROW]
for i, (key, label, hint) in enumerate(_ITEMS):
sel = i == cursor
cur = "❯" if sel else " "
lbl = f"[bold]{label}[/]" if sel else label
h = f"[bold]{hint}[/]" if sel else hint
lbl_pad = " " * (_W - 8 - len(label))
hint_pad = " " * (_W - 8 - len(hint))
rows.append(f" │ {cur} [bold cyan][{key}][/] {lbl}{lbl_pad}│")
rows.append(f" │ [dim]{h}[/]{hint_pad}│")
rows.append(_EMPTY_ROW)
rows.append(bottom)
return "\n".join(rows)MainMenuScreen class · python · L44-L133 (90 LOC)garmin_extract/screens/main_menu.py
class MainMenuScreen(Screen[None]):
"""Landing screen — routes to the three main sections."""
BINDINGS = [
Binding("1", "go_setup", show=False),
Binding("2", "go_pull", show=False),
Binding("3", "go_automation", show=False),
Binding("up", "cursor_up", show=False),
Binding("k", "cursor_up", show=False),
Binding("down", "cursor_down", show=False),
Binding("j", "cursor_down", show=False),
Binding("enter", "cursor_select", show=False),
Binding("q", "quit", "Quit", show=True),
]
CSS = """
MainMenuScreen {
align: center middle;
}
#menu-header {
width: 57;
text-align: center;
color: $accent;
text-style: bold;
margin-bottom: 1;
}
#menu-options {
width: 57;
color: $text;
}
#menu-hint {
width: 57;
text-align: center;
color: $text-muted;
margin-top: 1;
}
"""
def compose(compose method · python · L85-L93 (9 LOC)garmin_extract/screens/main_menu.py
def compose(self) -> ComposeResult:
yield Header(show_clock=True)
yield Static(_TITLE, id="menu-header")
yield Static(_build_menu(0), id="menu-options")
yield Static(
"↑↓ j/k navigate · enter select · 1–3 direct · q quit",
id="menu-hint",
)
yield Footer()Methodology: Repobility · https://repobility.com/research/state-of-ai-code-2026/
action_cursor_up method · python · L101-L104 (4 LOC)garmin_extract/screens/main_menu.py
def action_cursor_up(self) -> None:
if self._cursor > 0:
self._cursor -= 1
self._refresh_menu()action_cursor_down method · python · L106-L109 (4 LOC)garmin_extract/screens/main_menu.py
def action_cursor_down(self) -> None:
if self._cursor < 2:
self._cursor += 1
self._refresh_menu()action_go_setup method · python · L114-L118 (5 LOC)garmin_extract/screens/main_menu.py
def action_go_setup(self) -> None:
self._cursor = 0
from garmin_extract.screens.setup import SetupScreen
self.app.push_screen(SetupScreen())