# swinir/msfs-winwing-mcdu-scraper architecture

> Architecture diagram of the GitHub repository swinir/msfs-winwing-mcdu-scraper, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/swinir/msfs-winwing-mcdu-scraper
- Repository: https://github.com/swinir/msfs-winwing-mcdu-scraper

## Overview

MSFS WinWing CDU Scraper turns pixels from an MSFS pop-out display into a stable character grid and forwards changed grids to WinWing hardware through MobiFlight. The main workflow is GUI setup, window capture, grid recognition, temporal stabilisation, and WebSocket delivery; optional co-pilot operation runs a separate pipeline. Recognition combines geometry, learned glyph templates, and EasyOCR, with aircraft profiles selecting grid and font settings. The graph includes documented capabilities whose wiring is not fully visible in the excerpts; those relationships are indicated as unverified where appropriate.

Main entry points: [`src/gui.py`](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/gui.py) (Scraper GUI), [`src/mcdu_parser.py`](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_parser.py) (Grid parser), [`src/pipeline.py`](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/pipeline.py) (Capture pipeline), [`src/region_selector.py`](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/region_selector.py) (Region selector)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Setup and capture"]
  node_gui["Scraper GUI<br/>[gui.py]"]
  node_config["Configuration<br/>[config.py]"]
  node_profiles["Aircraft profiles"]
  node_region_ui["Region selector<br/>[region_selector.py]"]
  node_geometry["Region geometry<br/>[region_geometry.py]"]
  node_detector["Display detector<br/>[mcdu_detector.py]"]
  node_capture["Window capture<br/>[window_capture.py]"]
end

subgraph group_recognition["Grid recognition"]
  node_parser["Grid parser<br/>[mcdu_parser.py]"]
  node_glyphs["Glyph geometry<br/>[mcdu_glyphs.py]"]
  node_templates[("Learned templates<br/>[mcdu_templates.py]")]
  node_labels["Page labels<br/>[mcdu_labels.py]"]
  node_charset["Character set<br/>[mcdu_charset.py]"]
end

subgraph group_processing["Pipeline and delivery"]
  node_pipeline["Capture pipeline<br/>[pipeline.py]"]
  node_mobiflight["WebSocket client"]
end

subgraph group_integrations["External systems"]
  node_simulator["MSFS display"]
  node_ocr["EasyOCR"]
  node_connector["MobiFlight connector"]
  node_hardware["WinWing CDU"]
end

node_pilot(("User"))

node_pilot -->|"configures"| node_gui
node_gui -->|"loads settings"| node_config
node_gui -->|"selects profile"| node_profiles
node_gui -->|"opens selector"| node_region_ui
node_region_ui -->|"uses coordinates"| node_geometry
node_region_ui -->|"auto-detects"| node_detector
node_gui -->|"creates capture"| node_capture
node_simulator -->|"provides pixels"| node_capture
node_gui -->|"starts pipeline"| node_pipeline
node_pipeline -.->|"captures frames"| node_capture
node_pipeline -->|"parses frames"| node_parser
node_parser -->|"checks geometry"| node_glyphs
node_parser -->|"matches glyphs"| node_templates
node_parser -->|"corrects labels"| node_labels
node_parser -->|"validates characters"| node_charset
node_glyphs -->|"uses symbols"| node_charset
node_parser -.->|"recognizes fallback"| node_ocr
node_profiles -->|"selects store"| node_templates
node_pipeline -->|"sends changed grid"| node_mobiflight
node_mobiflight -->|"sanitizes output"| node_charset
node_mobiflight -->|"connects by WebSocket"| node_connector
node_connector -->|"forwards display data"| node_hardware

click node_gui "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/gui.py"
click node_config "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/config.py"
click node_profiles "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/aircraft_profiles.py"
click node_region_ui "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/region_selector.py"
click node_geometry "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/region_geometry.py"
click node_detector "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_detector.py"
click node_capture "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/window_capture.py"
click node_pipeline "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/pipeline.py"
click node_parser "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_parser.py"
click node_glyphs "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_glyphs.py"
click node_templates "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_templates.py"
click node_labels "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_labels.py"
click node_charset "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_charset.py"
click node_mobiflight "https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mobiflight_client.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_gui,node_config,node_profiles,node_region_ui,node_geometry,node_detector,node_capture,node_pilot toneBlue
class node_parser,node_glyphs,node_templates,node_labels,node_charset toneAmber
class node_pipeline,node_mobiflight toneMint
class node_simulator,node_ocr,node_connector,node_hardware toneRose
```

## Components

### Setup and capture

- [Scraper GUI](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/gui.py): `src/gui.py`
- [Configuration](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/config.py): `src/config.py`
- [Aircraft profiles](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/aircraft_profiles.py): `src/aircraft_profiles.py`
- [Region selector](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/region_selector.py): `src/region_selector.py`
- [Region geometry](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/region_geometry.py): `src/region_geometry.py`
- [Display detector](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_detector.py): `src/mcdu_detector.py`
- [Window capture](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/window_capture.py): `src/window_capture.py`

### Grid recognition

- [Grid parser](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_parser.py): `src/mcdu_parser.py`
- [Glyph geometry](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_glyphs.py): `src/mcdu_glyphs.py`
- [Learned templates](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_templates.py): `src/mcdu_templates.py`
- [Page labels](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_labels.py): `src/mcdu_labels.py`
- [Character set](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mcdu_charset.py): `src/mcdu_charset.py`

### Pipeline and delivery

- [Capture pipeline](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/pipeline.py): `src/pipeline.py`
- [WebSocket client](https://github.com/swinir/msfs-winwing-mcdu-scraper/blob/main/src/mobiflight_client.py): `src/mobiflight_client.py`

### External systems

- **MSFS display**
- **EasyOCR**
- **MobiFlight connector**
- **WinWing CDU**

### Other components

- **User**

## Connections

- User → Scraper GUI: configures (evidence: `README.md`)
- Scraper GUI → Configuration: loads settings (evidence: `src/gui.py`)
- Scraper GUI → Aircraft profiles: selects profile (evidence: `src/gui.py`)
- Scraper GUI → Region selector: opens selector (evidence: `src/gui.py`)
- Region selector → Region geometry: uses coordinates (evidence: `src/region_selector.py`)
- Region selector → Display detector: auto-detects (evidence: `src/region_selector.py`)
- Scraper GUI → Window capture: creates capture (evidence: `src/gui.py`)
- MSFS display → Window capture: provides pixels (evidence: `README.md`)
- Scraper GUI → Capture pipeline: starts pipeline (evidence: `src/gui.py`)
- Capture pipeline → Window capture: captures frames (evidence: `README.md`)
- Capture pipeline → Grid parser: parses frames (evidence: `src/pipeline.py`)
- Grid parser → Glyph geometry: checks geometry (evidence: `src/mcdu_parser.py`)
- Grid parser → Learned templates: matches glyphs (evidence: `src/mcdu_parser.py`)
- Grid parser → Page labels: corrects labels (evidence: `src/mcdu_parser.py`)
- Grid parser → Character set: validates characters (evidence: `src/mcdu_parser.py`)
- Glyph geometry → Character set: uses symbols (evidence: `src/mcdu_glyphs.py`)
- Grid parser → EasyOCR: recognizes fallback (evidence: `README.md`)
- Aircraft profiles → Learned templates: selects store (evidence: `src/aircraft_profiles.py`)
- Capture pipeline → WebSocket client: sends changed grid (evidence: `src/pipeline.py`)
- WebSocket client → Character set: sanitizes output (evidence: `src/mobiflight_client.py`)
- WebSocket client → MobiFlight connector: connects by WebSocket (evidence: `README.md`)
- MobiFlight connector → WinWing CDU: forwards display data (evidence: `README.md`)
