Metadata-Version: 2.4
Name: mermaidgui_py
Version: 0.0.1
Summary: A Python library to easily create and manage Mermaid diagrams programmatically, with strong GUI integration support.
Author-email: GeunWoo Seok <bearman.entp@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/bearmanentp/mermaidgui_py
Project-URL: BugTracker, https://github.com/bearmanentp/mermaidgui_py/issues
Keywords: mermaid,diagram,chart,flowchart,sequence diagram,class diagram,visualization,gui,pyside6
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Scientific/Engineering :: Visualization
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: End Users/Desktop
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PySide6
Requires-Dist: PySide6-WebEngineWidgets
Dynamic: license-file

# mermaidgui_py

## English Version

**mermaidgui_py** is an intuitive Python library designed to simplify the creation and programmatic management of Mermaid diagrams, with a strong focus on **GUI integration**. It provides a clean, object-oriented API to define various diagram types such as flowcharts, sequence diagrams, and class diagrams directly from your Python code. Additionally, it offers utility to convert these generated Mermaid codes into image files (PNG, JPG, SVG) using `mermaid.cli`.

### Features
*   **Intuitive API**: Construct Mermaid diagrams using Python objects and method chaining, abstracting the complex Mermaid syntax.
*   **Multiple Diagram Types**: Supports major Mermaid diagram types including Flowcharts (both Top-Down and Left-Right), Sequence Diagrams, and Class Diagrams.
*   **Image Export**: Convert any generated Mermaid code into image formats (PNG, JPG, SVG) effortlessly. (Requires `mermaid.cli` to be installed externally).
*   **Strong GUI Integration Focus**: Designed to be easily integrated into graphical user interfaces (GUIs) built with frameworks like PySide6, enabling developers to create intuitive visual diagram editing and generation tools.

### Installation

1.  **Python Package**:
    Install `mermaidgui_py` and its GUI dependencies using pip:
    ```bash
    pip install mermaidgui_py
    ```

2.  **`mermaid.cli` (for image export)**:
    For `mermaidgui_py`'s image export functionality, you need `Node.js` and `mermaid.cli` installed globally on your system.
    ```bash
    # First, ensure Node.js is installed (download from nodejs.org)
    npm install -g @mermaid-js/mermaid-cli
    ```
    Verify installation by running `mmdc -v` in your terminal.

### Quick Usage

```python
# Note: The internal package name remains 'pymermaid' for import statements
from pymermaid import Flowchart, SequenceDiagram, ClassDiagram

# Example 1: Create a simple Flowchart
flow = Flowchart(direction='LR') \
    .node("A", "Start Process", shape='round') \
    .link("A", "-->", "B", "Input Data") \
    .node("B", "Process Data") \
    .link("B", "--->", "C", "Data Processed") \
    .node("C", "End")

print("--- Flowchart Code ---")
print(flow.generate())
# Save as image (requires mermaid.cli)
flow.to_image("flowchart_example.png")


# Example 2: Create a simple Sequence Diagram
seq = SequenceDiagram() \
    .actor("User") \
    .participant("System") \
    .message("User", "->>", "System", "Request data") \
    .activate("System") \
    .message("System", "-->>", "User", "Data response") \
    .deactivate("System")

print("\n--- Sequence Diagram Code ---")
print(seq.generate())
seq.to_image("sequence_example.png")


# Example 3: Create a simple Class Diagram
cls = ClassDiagram() \
    .class_("Animal") \
    .attribute("-age: int") \
    .method("+eat()") \
    .class_("Dog", stereotype="<<abstract>>") \
    .attribute("+breed: string") \
    .method("+bark()") \
    .relationship("Dog", "--|>", "Animal")

print("\n--- Class Diagram Code ---")
print(cls.generate())
cls.to_image("class_example.png")
