# protorayn/klipperscreen-happy-hare-edition architecture

> Architecture diagram of the GitHub repository protorayn/klipperscreen-happy-hare-edition, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/protorayn/klipperscreen-happy-hare-edition
- Repository: https://github.com/protorayn/klipperscreen-happy-hare-edition

## Overview

KlipperScreen Happy Hare Edition is a touchscreen interface for Klipper printers, extended to operate and monitor Happy Hare multi-material units (MMUs). The main user workflow is to open a printer panel, view live printer or MMU state, and issue controls through Moonraker; the screen also handles incoming notifications and updates. Major product areas include ordinary printer controls, MMU gate and filament management, spool tracking, and network settings. The graph reflects README capabilities and the supplied source index; several panel-specific connections are left unverified because their implementations were not excerpted.

Main entry points: [`screen.py`](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/screen.py) (Screen controller), [`panels/mmu_mixin.py`](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_mixin.py) (MMU shared logic), [`panels/mmu_main.py`](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_main.py) (MMU operations), [`ks_includes/MoonrakerApi.py`](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/MoonrakerApi.py) (Moonraker API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Screen runtime"]
  node_screen["Screen controller<br/>[screen.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_gtk["GTK toolkit<br/>[KlippyGtk.py]"]
  node_notifications["Notification router"]
  node_keyboard["On-screen keyboard<br/>[keyboard.py]"]
end

subgraph group_integration["Printer integration"]
  node_printer["Printer state<br/>[printer.py]"]
  node_moonraker_api["Moonraker API<br/>[MoonrakerApi.py]"]
  node_websocket["WebSocket transport<br/>[KlippyWebsocket.py]"]
  node_rest["REST client<br/>[KlippyRest.py]"]
  node_moonraker(("Moonraker service"))
  node_network_backend["NetworkManager access<br/>[sdbus_nm.py]"]
  node_spoolman_api["Spoolman API<br/>[spoolman_api.py]"]
end

subgraph group_printer_ui["Printer controls"]
  node_base_panel["Shared panel base<br/>[base_panel.py]"]
  node_temp_panel["Temperature controls<br/>[temperature.py]"]
  node_heater_graph["Heater graph<br/>[heatergraph.py]"]
  node_job_panel["Print job status<br/>[job_status.py]"]
  node_gcodes_panel["G-code browser<br/>[gcodes.py]"]
  node_network_panel["Network settings<br/>[network.py]"]
end

subgraph group_mmu_ui["Happy Hare MMU"]
  node_mmu_main["MMU operations<br/>[mmu_main.py]"]
  node_mmu_gauges["MMU gauges<br/>[mmu_gauges.py]"]
  node_mmu_mixin["MMU shared logic<br/>[mmu_mixin.py]"]
  node_mmu_filaments["Gate filaments<br/>[mmu_filaments.py]"]
  node_mmu_manage["MMU management<br/>[mmu_manage.py]"]
  node_mmu_toolmap["Tool mapping<br/>[mmu_toolmap.py]"]
  node_spoolman_panel["Spool tracking<br/>[spoolman.py]"]
end

node_user(("Touchscreen user"))

node_user -->|"operates"| node_screen
node_screen -->|"loads settings"| node_config
node_screen -->|"builds interface"| node_gtk
node_screen -->|"maintains state"| node_printer
node_screen -->|"routes events"| node_notifications
node_screen -->|"shows input"| node_keyboard
node_screen -->|"attaches panels"| node_base_panel
node_moonraker_api -->|"sends methods"| node_websocket
node_moonraker -.->|"exchanges messages"| node_websocket
node_screen -.->|"uses API"| node_moonraker_api
node_screen -->|"uses REST"| node_rest
node_temp_panel -->|"renders graph"| node_heater_graph
node_network_panel -->|"manages connections"| node_network_backend
node_mmu_main -->|"uses shared logic"| node_mmu_mixin
node_mmu_main -->|"updates gauges"| node_mmu_gauges
node_mmu_filaments -->|"uses shared logic"| node_mmu_mixin
node_mmu_manage -->|"uses shared logic"| node_mmu_mixin
node_mmu_toolmap -->|"uses shared logic"| node_mmu_mixin
node_mmu_mixin -->|"uses spool data"| node_spoolman_panel
node_spoolman_panel -.->|"queries service"| node_spoolman_api
node_screen -.->|"opens MMU panel"| node_mmu_main
node_screen -.->|"opens printer panels"| node_temp_panel
node_screen -.->|"opens printer panels"| node_job_panel
node_screen -.->|"opens printer panels"| node_gcodes_panel

click node_screen "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/screen.py"
click node_config "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/config.py"
click node_gtk "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyGtk.py"
click node_notifications "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/notification_handler.py"
click node_printer "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/printer.py"
click node_moonraker_api "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/MoonrakerApi.py"
click node_websocket "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyWebsocket.py"
click node_rest "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyRest.py"
click node_base_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/base_panel.py"
click node_temp_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/temperature.py"
click node_heater_graph "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/widgets/heatergraph.py"
click node_job_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/job_status.py"
click node_gcodes_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/gcodes.py"
click node_network_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/network.py"
click node_network_backend "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/sdbus_nm.py"
click node_mmu_main "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_main.py"
click node_mmu_gauges "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_gauges.py"
click node_mmu_mixin "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_mixin.py"
click node_mmu_filaments "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_filaments.py"
click node_mmu_manage "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_manage.py"
click node_mmu_toolmap "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_toolmap.py"
click node_spoolman_panel "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/spoolman.py"
click node_spoolman_api "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/spoolman_api.py"
click node_keyboard "https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/widgets/keyboard.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_screen,node_config,node_gtk,node_notifications,node_keyboard,node_user toneBlue
class node_printer,node_moonraker_api,node_websocket,node_rest,node_moonraker,node_network_backend,node_spoolman_api toneAmber
class node_base_panel,node_temp_panel,node_heater_graph,node_job_panel,node_gcodes_panel,node_network_panel toneMint
class node_mmu_main,node_mmu_gauges,node_mmu_mixin,node_mmu_filaments,node_mmu_manage,node_mmu_toolmap,node_spoolman_panel toneRose
```

## Components

### Screen runtime

- [Screen controller](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/screen.py): `screen.py`
- [Configuration](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/config.py): `ks_includes/config.py`
- [GTK toolkit](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyGtk.py): `ks_includes/KlippyGtk.py`
- [Notification router](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/notification_handler.py): `ks_includes/notification_handler.py`
- [On-screen keyboard](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/widgets/keyboard.py): `ks_includes/widgets/keyboard.py`

### Printer integration

- [Printer state](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/printer.py): `ks_includes/printer.py`
- [Moonraker API](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/MoonrakerApi.py): `ks_includes/MoonrakerApi.py`
- [WebSocket transport](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyWebsocket.py): `ks_includes/KlippyWebsocket.py`
- [REST client](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/KlippyRest.py): `ks_includes/KlippyRest.py`
- **Moonraker service**
- [NetworkManager access](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/sdbus_nm.py): `ks_includes/sdbus_nm.py`
- [Spoolman API](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/spoolman_api.py): `ks_includes/spoolman_api.py`

### Printer controls

- [Shared panel base](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/base_panel.py): `panels/base_panel.py`
- [Temperature controls](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/temperature.py): `panels/temperature.py`
- [Heater graph](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/ks_includes/widgets/heatergraph.py): `ks_includes/widgets/heatergraph.py`
- [Print job status](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/job_status.py): `panels/job_status.py`
- [G-code browser](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/gcodes.py): `panels/gcodes.py`
- [Network settings](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/network.py): `panels/network.py`

### Happy Hare MMU

- [MMU operations](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_main.py): `panels/mmu_main.py`
- [MMU gauges](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_gauges.py): `panels/mmu_gauges.py`
- [MMU shared logic](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_mixin.py): `panels/mmu_mixin.py`
- [Gate filaments](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_filaments.py): `panels/mmu_filaments.py`
- [MMU management](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_manage.py): `panels/mmu_manage.py`
- [Tool mapping](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/mmu_toolmap.py): `panels/mmu_toolmap.py`
- [Spool tracking](https://github.com/protorayn/klipperscreen-happy-hare-edition/blob/master/panels/spoolman.py): `panels/spoolman.py`

### Other components

- **Touchscreen user**

## Connections

- Touchscreen user → Screen controller: operates (evidence: `README.md`)
- Screen controller → Configuration: loads settings (evidence: `screen.py`)
- Screen controller → GTK toolkit: builds interface (evidence: `screen.py`)
- Screen controller → Printer state: maintains state (evidence: `screen.py`)
- Screen controller → Notification router: routes events (evidence: `screen.py`)
- Screen controller → On-screen keyboard: shows input (evidence: `screen.py`)
- Screen controller → Shared panel base: attaches panels (evidence: `screen.py`)
- Moonraker API → WebSocket transport: sends methods (evidence: `ks_includes/MoonrakerApi.py`)
- Moonraker service → WebSocket transport: exchanges messages
- Screen controller → Moonraker API: uses API
- Screen controller → REST client: uses REST (evidence: `screen.py`)
- Temperature controls → Heater graph: renders graph (evidence: `panels/temperature.py`)
- Network settings → NetworkManager access: manages connections (evidence: `panels/network.py`)
- MMU operations → MMU shared logic: uses shared logic (evidence: `panels/mmu_main.py`)
- MMU operations → MMU gauges: updates gauges (evidence: `panels/mmu_main.py`)
- Gate filaments → MMU shared logic: uses shared logic (evidence: `panels/mmu_filaments.py`)
- MMU management → MMU shared logic: uses shared logic (evidence: `panels/mmu_manage.py`)
- Tool mapping → MMU shared logic: uses shared logic (evidence: `panels/mmu_toolmap.py`)
- MMU shared logic → Spool tracking: uses spool data (evidence: `panels/mmu_mixin.py`)
- Spool tracking → Spoolman API: queries service
- Screen controller → MMU operations: opens MMU panel
- Screen controller → Temperature controls: opens printer panels
- Screen controller → Print job status: opens printer panels
- Screen controller → G-code browser: opens printer panels
