# valeriancarrote/magick-notes architecture

> Architecture diagram of the GitHub repository valeriancarrote/magick-notes, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/valeriancarrote/magick-notes
- Repository: https://github.com/valeriancarrote/magick-notes

## Overview

##### Project Type & Purpose
- Magick-Notes is a lightweight desktop GUI application built using PyDearGUI.
- Its purpose is to allow users to pin notes, supporting both text and images taken directly from the clipboard.
- Additional AI-based functionalities (transformation, OCR, and more) are hinted at in the todo list.

##### Analyzing the File Structure
- Top-Level Files and Directories:
- main.py: Likely the entry point of the application that initiates the PyDearGUI interface.
- copy_sub.py: Possibly a helper module that deals with clipboard copying/substitution logic.
- history_clipboard.json: Represents persisted data for the history or saved state of clipboard notes.
- requirement.txt: Lists the necessary Python dependencies.
- readme.md: Provides usage instructions and an overview of the project.
- __pycache__: Generated for Python caching and not part of the source logic.

##### Main Components
- User Interface (UI) Layer:
- Built using PyDearGUI. This layer will include the windows, forms, and visual elements where users interact with the note-taking feature.
- Clipboard Management Module:
- Responsible for detecting/sourcing text and images from the clipboard. Likely managed partly by copy_sub.py.
- Persistence Module:
- Uses history_clipboard.json to store and retrieve user-pinned notes.
- Asset Manager:
- (Optional Future Modules):
- Modules for AI-transformations, OCR, drag and drop, and LaTeX expression support might be integrated in later stages.

##### Relationships & Interactions
- The application (main.py) initializes the PyDearGUI framework ensuring the UI is responsive.
- The UI interacts with the Clipboard Management Module to capture and process clipboard content.
- Once data is validated or possibly transformed (using functions possibly in copy_sub.py), it is handed off to the Persistence Module to save notes.
- The UI retrieves persisted notes from history_clipboard.json to display to the user.

##### Architectural Patterns & Design Principles
- Separation of Concerns: Distinct separation between the user interface, clipboard handling, and persistence (data storage).
- Extensibility: The todo list hints at planned features (e.g., AI, OCR) that could be integrated as separate modules later.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Main Application Layers
    subgraph "Application Layers"
        UI["PyDearGUI Interface"]:::ui
        Clipboard["Clipboard Service"]:::cm
        Persistence["Note Persistence"]:::persistence
        subgraph "Asset Manager"
            Images["Image Assets"]:::asset
            Icons["Icon Assets"]:::asset
        end
    end

    %% Future Extensions (Optional)
    Future["Future Extensions (AI,OCR,DragDrop,LaTeX)"]:::future

    %% Data Flow Connections
    UI -->|"pastes"| Clipboard
    Clipboard -->|"saves"| Persistence
    Persistence -->|"retrieves"| UI
    Images -->|"supplies"| UI
    Icons -->|"supplies"| UI
    Future ---|"planned"| UI

    %% Click Events
    click UI "https://github.com/valeriancarrote/magick-notes/blob/master/main.py"
    click Clipboard "https://github.com/valeriancarrote/magick-notes/blob/master/copy_sub.py"
    click Persistence "https://github.com/valeriancarrote/magick-notes/blob/master/history_clipboard.json"
    click Images "https://github.com/valeriancarrote/magick-notes/tree/master/image"
    click Icons "https://github.com/valeriancarrote/magick-notes/tree/master/Icon"

    %% Styles
    classDef ui fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef cm fill:#87CEFA,stroke:#333,stroke-width:2px;
    classDef persistence fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef asset fill:#FFB6C1,stroke:#333,stroke-width:2px;
    classDef future fill:#EEE8AA,stroke:#333,stroke-dasharray: 5,5,stroke-width:2px;
```
