# arthur-dnts/clocktemp architecture

> Architecture diagram of the GitHub repository arthur-dnts/clocktemp, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arthur-dnts/clocktemp
- Repository: https://github.com/arthur-dnts/clocktemp

## Overview

ClockTemp is a terminal UI for viewing a large-format clock, date and weather, with interactive calendar, stopwatch, timer and help modes. The workflow begins with command-line options, then enters a keyboard-driven render loop that dispatches the selected mode and updates shared state. Rendering helpers format clock digits and calendar rows; temperature is fetched from Open-Meteo when coordinates are supplied. The main-loop excerpt is incomplete, so some dispatch links rely on documented modes and visible module responsibilities rather than inspected call sites.

Main entry points: [`script/modes.py`](https://github.com/arthur-dnts/clocktemp/blob/main/script/modes.py) (Mode rendering), [`script/clocktemp.py`](https://github.com/arthur-dnts/clocktemp/blob/main/script/clocktemp.py) (TUI loop and state), [`script/temperature.py`](https://github.com/arthur-dnts/clocktemp/blob/main/script/temperature.py) (Weather lookup), [`script/tools.py`](https://github.com/arthur-dnts/clocktemp/blob/main/script/tools.py) (Key definitions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime control"]
  node_cli["CLI options<br/>[clocktemp.py]"]
  node_loop["TUI loop and state<br/>[clocktemp.py]"]
  node_key_codes["Key definitions<br/>[tools.py]"]
end

subgraph group_views["Display modes"]
  node_mode_views["Mode rendering<br/>[modes.py]"]
  node_clock_render["Clock formatting<br/>[clock.py]"]
  node_calendar_render["Calendar generation<br/>[cal.py]"]
end

subgraph group_weather["Weather data"]
  node_weather_fetch["Weather lookup<br/>[temperature.py]"]
end

node_user(("Terminal user"))
node_open_meteo["Open-Meteo"]
node_terminal["Terminal UI"]

node_user -->|"sets options"| node_cli
node_cli -->|"starts UI"| node_loop
node_user -->|"presses keys"| node_loop
node_loop -->|"checks codes"| node_key_codes
node_loop -->|"dispatches modes"| node_mode_views
node_mode_views -->|"formats digits"| node_clock_render
node_mode_views -->|"builds calendar"| node_calendar_render
node_mode_views -->|"requests temperature"| node_weather_fetch
node_weather_fetch -->|"requests weather"| node_open_meteo
node_loop -->|"renders UI"| node_terminal
node_mode_views -->|"draws views"| node_terminal

click node_cli "https://github.com/arthur-dnts/clocktemp/blob/main/script/clocktemp.py"
click node_loop "https://github.com/arthur-dnts/clocktemp/blob/main/script/clocktemp.py"
click node_mode_views "https://github.com/arthur-dnts/clocktemp/blob/main/script/modes.py"
click node_clock_render "https://github.com/arthur-dnts/clocktemp/blob/main/script/clock.py"
click node_calendar_render "https://github.com/arthur-dnts/clocktemp/blob/main/script/cal.py"
click node_key_codes "https://github.com/arthur-dnts/clocktemp/blob/main/script/tools.py"
click node_weather_fetch "https://github.com/arthur-dnts/clocktemp/blob/main/script/temperature.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_loop,node_key_codes,node_user,node_terminal toneBlue
class node_mode_views,node_clock_render,node_calendar_render toneAmber
class node_weather_fetch toneMint
class node_open_meteo toneIndigo
```

## Components

### Runtime control

- [CLI options](https://github.com/arthur-dnts/clocktemp/blob/main/script/clocktemp.py): `script/clocktemp.py`
- [TUI loop and state](https://github.com/arthur-dnts/clocktemp/blob/main/script/clocktemp.py): `script/clocktemp.py`
- [Key definitions](https://github.com/arthur-dnts/clocktemp/blob/main/script/tools.py): `script/tools.py`

### Display modes

- [Mode rendering](https://github.com/arthur-dnts/clocktemp/blob/main/script/modes.py): `script/modes.py`
- [Clock formatting](https://github.com/arthur-dnts/clocktemp/blob/main/script/clock.py): `script/clock.py`
- [Calendar generation](https://github.com/arthur-dnts/clocktemp/blob/main/script/cal.py): `script/cal.py`

### Weather data

- [Weather lookup](https://github.com/arthur-dnts/clocktemp/blob/main/script/temperature.py): `script/temperature.py`

### Other components

- **Terminal user**
- **Open-Meteo**
- **Terminal UI**

## Connections

- Terminal user → CLI options: sets options
- CLI options → TUI loop and state: starts UI
- Terminal user → TUI loop and state: presses keys
- TUI loop and state → Key definitions: checks codes
- TUI loop and state → Mode rendering: dispatches modes
- Mode rendering → Clock formatting: formats digits
- Mode rendering → Calendar generation: builds calendar
- Mode rendering → Weather lookup: requests temperature
- Weather lookup → Open-Meteo: requests weather
- TUI loop and state → Terminal UI: renders UI
- Mode rendering → Terminal UI: draws views
