# meta-dusk/pytoningans architecture

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

- Interactive diagram: https://gitdiagram.com/meta-dusk/pytoningans
- Repository: https://github.com/meta-dusk/pytoningans

## Overview

PyToNingans is a PySide6 desktop-pet app with a control panel, multiple animated pet windows, and user-editable pet mods. The main workflow selects a mod in the menu, spawns pets, then the manager ticks each pet’s AI, physics, and animation; mod configuration supplies sprites, behavior, and dialogue. Users also manage and edit mods, including animation grids, crops, and behavior settings. The README is brief, so subsystem wiring beyond the sampled entry points is omitted where not evidenced.

Main entry points: [`src/pytoningans/ui/mod_editor/window.py`](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/window.py) (Mod editor), [`src/pytoningans/core/pet_manager.py`](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet_manager.py) (Pet manager), [`src/pytoningans/main.py`](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/main.py) (App startup), [`src/pytoningans/core/pet/window.py`](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/window.py) (Pet window)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["App control"]
  node_entry["App startup<br/>[main.py]"]
  node_paths["Asset paths<br/>[paths.py]"]
  node_menu["Control panel<br/>[main_menu.py]"]
  node_tray["Tray menu<br/>[tray_menu.py]"]
end

subgraph group_pets["Pet runtime"]
  node_petmanager["Pet manager<br/>[pet_manager.py]"]
  node_petwindow["Pet window<br/>[window.py]"]
  node_ai["Pet AI<br/>[ai_brain.py]"]
  node_physics["Pet physics<br/>[physics.py]"]
  node_animation["Pet animation<br/>[animation.py]"]
  node_speech["Speech bubbles<br/>[speech_bubble.py]"]
end

subgraph group_mods["Mods and assets"]
  node_modmanager["Mod manager<br/>[mod_manager.py]"]
  node_modfiles["Installed mod files<br/>[config.json]"]
end

subgraph group_editor["Mod editor"]
  node_modhub["Mod manager hub<br/>[mod_manager_hub.py]"]
  node_editorwindow["Mod editor<br/>[window.py]"]
  node_controller["Editor controller<br/>[controller.py]"]
  node_animpanel["Animation panel<br/>[animation_panel.py]"]
  node_behaviorpanel["Behavior panel<br/>[behavior_panel.py]"]
  node_dialoguepanel["Dialogue panel<br/>[dialogue_panel.py]"]
  node_debugpanel["Debug panel<br/>[debug_panel.py]"]
end

node_user(("Desktop user"))
node_windows(("Visible OS windows"))

node_user -->|"operates"| node_menu
node_entry -->|"resolves assets"| node_paths
node_entry -->|"loads mods"| node_modmanager
node_entry -->|"creates manager"| node_petmanager
node_entry -->|"opens panel"| node_menu
node_entry -->|"opens tray"| node_tray
node_menu -->|"spawns pets"| node_petmanager
node_menu -->|"opens manager"| node_modhub
node_petmanager -->|"loads pet mod"| node_modmanager
node_petmanager -->|"creates windows"| node_petwindow
node_petmanager -->|"queries titles"| node_windows
node_petmanager -->|"ticks systems"| node_petwindow
node_petwindow -->|"updates AI"| node_ai
node_petwindow -->|"updates physics"| node_physics
node_petwindow -->|"updates animation"| node_animation
node_ai -->|"triggers dialogue"| node_speech
node_ai -->|"matches triggers"| node_windows
node_modmanager -->|"reads and saves"| node_modfiles
node_modhub -->|"lists mods"| node_modmanager
node_modhub -->|"opens editor"| node_editorwindow
node_editorwindow -->|"uses"| node_controller
node_editorwindow -->|"hosts"| node_animpanel
node_editorwindow -->|"hosts"| node_behaviorpanel
node_editorwindow -->|"hosts"| node_dialoguepanel
node_editorwindow -->|"hosts"| node_debugpanel
node_animpanel -->|"requests previews"| node_controller
node_controller -->|"reads and updates"| node_modmanager

click node_entry "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/main.py"
click node_paths "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/utils/paths.py"
click node_menu "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/main_menu.py"
click node_tray "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/tray_menu.py"
click node_petmanager "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet_manager.py"
click node_petwindow "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/window.py"
click node_ai "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/ai_brain.py"
click node_physics "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/physics.py"
click node_animation "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/animation.py"
click node_speech "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/speech_bubble.py"
click node_modmanager "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/mod_manager.py"
click node_modfiles "https://github.com/meta-dusk/pytoningans/blob/stable/assets/mods/default_pet/config.json"
click node_modhub "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_manager_hub.py"
click node_editorwindow "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/window.py"
click node_controller "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/controller.py"
click node_animpanel "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/animation_panel.py"
click node_behaviorpanel "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/behavior_panel.py"
click node_dialoguepanel "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/dialogue_panel.py"
click node_debugpanel "https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/debug_panel.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_entry,node_paths,node_menu,node_tray,node_user toneBlue
class node_petmanager,node_petwindow,node_ai,node_physics,node_animation,node_speech toneAmber
class node_modmanager,node_modfiles toneMint
class node_modhub,node_editorwindow,node_controller,node_animpanel,node_behaviorpanel,node_dialoguepanel,node_debugpanel toneRose
class node_windows toneIndigo
```

## Components

### App control

- [App startup](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/main.py): `src/pytoningans/main.py`
- [Asset paths](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/utils/paths.py): `src/pytoningans/utils/paths.py`
- [Control panel](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/main_menu.py): `src/pytoningans/ui/main_menu.py`
- [Tray menu](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/tray_menu.py): `src/pytoningans/ui/tray_menu.py`

### Pet runtime

- [Pet manager](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet_manager.py): `src/pytoningans/core/pet_manager.py`
- [Pet window](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/window.py): `src/pytoningans/core/pet/window.py`
- [Pet AI](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/ai_brain.py): `src/pytoningans/core/pet/ai_brain.py`
- [Pet physics](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/physics.py): `src/pytoningans/core/pet/physics.py`
- [Pet animation](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/animation.py): `src/pytoningans/core/pet/animation.py`
- [Speech bubbles](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/pet/speech_bubble.py): `src/pytoningans/core/pet/speech_bubble.py`

### Mods and assets

- [Mod manager](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/core/mod_manager.py): `src/pytoningans/core/mod_manager.py`
- [Installed mod files](https://github.com/meta-dusk/pytoningans/blob/stable/assets/mods/default_pet/config.json): `assets/mods/default_pet/config.json`

### Mod editor

- [Mod manager hub](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_manager_hub.py): `src/pytoningans/ui/mod_manager_hub.py`
- [Mod editor](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/window.py): `src/pytoningans/ui/mod_editor/window.py`
- [Editor controller](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/controller.py): `src/pytoningans/ui/mod_editor/controller.py`
- [Animation panel](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/animation_panel.py): `src/pytoningans/ui/mod_editor/panels/animation_panel.py`
- [Behavior panel](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/behavior_panel.py): `src/pytoningans/ui/mod_editor/panels/behavior_panel.py`
- [Dialogue panel](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/dialogue_panel.py): `src/pytoningans/ui/mod_editor/panels/dialogue_panel.py`
- [Debug panel](https://github.com/meta-dusk/pytoningans/blob/stable/src/pytoningans/ui/mod_editor/panels/debug_panel.py): `src/pytoningans/ui/mod_editor/panels/debug_panel.py`

### Other components

- **Desktop user**
- **Visible OS windows**

## Connections

- Desktop user → Control panel: operates
- App startup → Asset paths: resolves assets
- App startup → Mod manager: loads mods
- App startup → Pet manager: creates manager
- App startup → Control panel: opens panel
- App startup → Tray menu: opens tray
- Control panel → Pet manager: spawns pets
- Control panel → Mod manager hub: opens manager
- Pet manager → Mod manager: loads pet mod
- Pet manager → Pet window: creates windows
- Pet manager → Visible OS windows: queries titles
- Pet manager → Pet window: ticks systems
- Pet window → Pet AI: updates AI
- Pet window → Pet physics: updates physics
- Pet window → Pet animation: updates animation
- Pet AI → Speech bubbles: triggers dialogue
- Pet AI → Visible OS windows: matches triggers
- Mod manager → Installed mod files: reads and saves
- Mod manager hub → Mod manager: lists mods
- Mod manager hub → Mod editor: opens editor
- Mod editor → Editor controller: uses
- Mod editor → Animation panel: hosts
- Mod editor → Behavior panel: hosts
- Mod editor → Dialogue panel: hosts
- Mod editor → Debug panel: hosts
- Animation panel → Editor controller: requests previews
- Editor controller → Mod manager: reads and updates
