# techartorg/bqt architecture

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

- Interactive diagram: https://gitdiagram.com/techartorg/bqt
- Repository: https://github.com/techartorg/bqt

## Overview

##### Project Type and Purpose
- BQt is a library/addon for Blender that enables the integration of fully custom QT user interfaces (via PySide2) into Blender, and it can even extend to other DCC tools.
- The README emphasizes features like “fully custom UI”, “cross app” usage (for popular DCC tools), and theming that matches Blender’s look, which clearly defines its purpose.

##### File Structure
- The top-level directories include:
- .github – CI/CD workflows (e.g., python-publish.yml) for continuous integration or publishing.
- bqt – Primary library code.
○ Submodules like blender_applications that include OS-specific integrations (darwin and win32 implementations) suggest that the system abstracts platform-specific behavior for launching Qt widgets in Blender.
○ Other components such as focus.py, manager.py, qt_core.py, and utils.py represent core functionalities like managing the application state, providing a QT core abstraction, and handling utility functions.
- bqt/ui – Contains the files related to creating UI elements (e.g., quit_dialogue.py), indicating that there’s a separation between non-UI logic and UI code.
- bqt_demo – A demonstration project containing examples (e.g., demo.py, hello_world.py, anim_bar.py) that illustrate how to use the library.
- Configuration files (requirements.txt, setup.py, license) and additional quality tools (pylintrc, pre-commit) support project maintenance.
- This structure underlines separation of concerns: library core with application and UI support, platform-specific integrations, and demonstration samples.

##### Readme Insights
- The README explains the integration with Blender (version 2.83 or higher), the support for multiple platforms (Windows & Mac), and special dependencies (PySide2, PyObjC for Mac).
- It also directs users to browse the Wiki for installation and further integration details, hinting at a modular design where external configuration and environment variables can toggle functionality.
- The sample code from bqt_demo serves as a practical guide to how the core library is applied.

a. Main Components to Represent:
- Core Library (bqt)
- Core Modules: manager.py, focus.py, qt_core.py, and utils.py.
- Platform-Specific Applications (bqt/blender_applications)
- Submodules: blender_application.py (base class), darwin_blender_application.py, and win32_blender_application.py.
- UI Module (bqt/ui)
- Example: quit_dialogue.py and any additional UI helpers.
- Demonstration/Application Examples (bqt_demo)
- Components: demo.py, hello_world.py, anim_bar.py, timer.py, and pyside_widgets.py.
- External Dependencies/Frameworks
- PySide2 for the actual UI elements.
- Blender integration environment (Blender environment variables, registration mechanism).

b. Relationships and Interactions:
- The Core Library manages the initialization and integration of custom QT widgets with Blender.
- The Blender Applications module provides platform-specific implementations to properly launch and integrate UI on different OSes.
- The UI module contains the components responsible for display and interaction (e.g., dialogue windows).
- Demo components illustrate usage and serve as client examples that instantiate QT widgets, register them with the manager, and interact with the core of the library.

c. Architectural Patterns / Design Principles:
- Modular/Layered Architecture: Separation between core logic, platform-specific integrations, and user interface components.
- Abstraction: The platform-specific modules hide OS details, allowing the generic parts to remain stable.
- Extensibility: The demo folder and environment variables hint at ease of extension and customization (“plug-and-play” style integration).

d. Relevant Technologies and Frameworks:
- Python as the primary language.
- PySide2 for QT widget development.
- Blender for the target environment.
- GitHub Actions for CI/CD automation.

- Each component should have a clear label (e.g., “Core Manager”, “Blender App (Darwin)”, “UI - Quit Dialogue”, “Demo - Hello World”).
- UI elements (another style).
- External dependencies (maybe in a border or different style).

##### Final Remarks
- Detail every portion of the project. Even if it might seem granular, capturing all relevant components like demos, utilities, and even CI/CD config can help in understanding integration points.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External Dependencies
    subgraph "External Dependencies"
        E1("PySide2"):::external
        E2("Blender Integration"):::external
        E3("PyObjC"):::external
    end

    %% Core Library
    subgraph "Core Library"
        C1("Core Manager (manager.py, focus.py, qt_core.py, utils.py)"):::core
    end

    %% Platform-Specific Applications
    subgraph "Platform-Specific Applications"
        P1("Blender Application Base (blender_application.py)"):::platform
        P2("Darwin Application (darwin_blender_application.py)"):::platform
        P3("Win32 Application (win32_blender_application.py)"):::platform
    end

    %% UI Components
    subgraph "UI Components"
        U1("UI - Quit Dialogue (quit_dialogue.py)"):::ui
    end

    %% Demonstration Applications
    subgraph "Demonstration Applications"
        D1("Demo - Demo (demo.py)"):::demo
        D2("Demo - Hello World (hello_world.py)"):::demo
        D3("Demo - Anim Bar (anim_bar.py)"):::demo
        D4("Demo - Timer (timer.py)"):::demo
        D5("Demo - PySide Widgets (pyside_widgets.py)"):::demo
    end

    %% CI/CD
    subgraph "CI/CD"
        CI("GitHub Workflow (python-publish.yml)"):::ci
    end

    %% Connections from External Dependencies to Core
    E1 -->|"leverages"| C1
    E2 -->|"leverages"| C1
    E3 -->|"leverages"| C1

    %% Connections from Core Library to Platform-Specific Applications
    C1 -->|"callsOSSpecific"| P1
    C1 -->|"callsOSSpecific"| P2
    C1 -->|"callsOSSpecific"| P3

    %% Connection from Core Library to UI Components
    C1 -->|"launchesQTWidget"| U1

    %% Connections from Demonstration Applications to Core Library
    D1 -->|"registerWidget"| C1
    D2 -->|"registerWidget"| C1
    D3 -->|"registerWidget"| C1
    D4 -->|"registerWidget"| C1
    D5 -->|"registerWidget"| C1

    %% Styles
    classDef core fill:#CDE5FF,stroke:#333,stroke-width:2px;
    classDef platform fill:#FFD699,stroke:#333,stroke-width:2px;
    classDef ui fill:#D9EAD3,stroke:#333,stroke-width:2px;
    classDef demo fill:#FFF2CC,stroke:#333,stroke-width:2px;
    classDef external fill:#D9D2E9,stroke:#333,stroke-width:2px;
    classDef ci fill:#F4CCCC,stroke:#333,stroke-width:2px;

    %% Click Events for Core Library Modules
    click C1 "https://github.com/techartorg/bqt/blob/master/bqt/manager.py"
    click C1 "https://github.com/techartorg/bqt/blob/master/bqt/focus.py"
    click C1 "https://github.com/techartorg/bqt/blob/master/bqt/qt_core.py"
    click C1 "https://github.com/techartorg/bqt/blob/master/bqt/utils.py"

    %% Click Events for Platform-Specific Applications
    click P1 "https://github.com/techartorg/bqt/blob/master/bqt/blender_applications/blender_application.py"
    click P2 "https://github.com/techartorg/bqt/blob/master/bqt/blender_applications/darwin_blender_application.py"
    click P3 "https://github.com/techartorg/bqt/blob/master/bqt/blender_applications/win32_blender_application.py"

    %% Click Event for UI Component
    click U1 "https://github.com/techartorg/bqt/blob/master/bqt/ui/quit_dialogue.py"

    %% Click Events for Demonstration Applications
    click D1 "https://github.com/techartorg/bqt/blob/master/bqt_demo/demo.py"
    click D2 "https://github.com/techartorg/bqt/blob/master/bqt_demo/hello_world.py"
    click D3 "https://github.com/techartorg/bqt/blob/master/bqt_demo/anim_bar.py"
    click D4 "https://github.com/techartorg/bqt/blob/master/bqt_demo/timer.py"
    click D5 "https://github.com/techartorg/bqt/blob/master/bqt_demo/pyside_widgets.py"

    %% Click Event for CI/CD Workflow
    click CI "https://github.com/techartorg/bqt/blob/master/.github/workflows/python-publish.yml"
```
