Metadata-Version: 2.4
Name: fry-qt6-image-widget
Version: 0.1.0
Summary: A PyQt6 QWidget for image viewing, annotation, and shape editing.
Author: FanRenyi
Project-URL: Homepage, https://gitlab.com/fanrenyi33/fry_python_lib_d150_fry_image_view
Project-URL: Repository, https://gitlab.com/fanrenyi33/fry_python_lib_d150_fry_image_view
Keywords: pyqt6,qt,image,widget,annotation,labelme
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: X11 Applications :: Qt
Classifier: Framework :: Pytest
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics :: Viewers
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: PyQt6>=6.5
Requires-Dist: numpy>=1.23
Requires-Dist: opencv-python>=4.7
Requires-Dist: Pillow>=9.0
Requires-Dist: scikit-image>=0.20
Requires-Dist: imgviz>=1.7
Requires-Dist: loguru>=0.7
Requires-Dist: qtawesome>=1.3
Provides-Extra: dev
Requires-Dist: build>=1.0; extra == "dev"
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-qt>=4.4; extra == "dev"
Requires-Dist: twine>=4.0; extra == "dev"

# fry-qt6-image-widget

`fry-qt6-image-widget` is a PyQt6 image viewing and annotation widget. The core class is `FryCanvas`, and it inherits from `QtWidgets.QWidget`, so it can be placed directly into a layout, a `QMainWindow`, a `QScrollArea`, or wrapped by the application as a `QDockWidget` when needed.

The package intentionally exposes a widget, not a dock. Dock behavior belongs to the host application.

## Install

```bash
pip install fry-qt6-image-widget
```

For local development:

```bash
python -m pip install -e ".[dev]"
python -m pytest
```

## Quick Start

```python
import sys

import numpy as np
from PyQt6 import QtWidgets
from fry_qt6_image_widget import FryCanvas


app = QtWidgets.QApplication(sys.argv)

canvas = FryCanvas()
canvas.resize(900, 600)
canvas.setViewMode()

image = np.ones((480, 640, 3), dtype=np.uint8) * 255
canvas.show_image_np(image, description="white demo image")

canvas.show()
sys.exit(app.exec())
```

## Common Imports

```python
from fry_qt6_image_widget import (
    FryCanvas,
    FryCanvasMode,
    create_shape,
)
```

Backward-compatible imports are also available:

```python
from fry_base_classes import FryCanvas
```

## Typical Operations

```python
canvas = FryCanvas()

canvas.show_image("demo.png")
canvas.show_image_np(image_np)
image_np = canvas.get_image_np()

canvas.set_canvas_mode("view")
canvas.set_canvas_mode("draw")
canvas.set_shape_type("rectangle")

shape = create_shape("rectangle", label="box")
canvas.append_shape(shape)
all_shapes = canvas.get_all_shapes_data()
```

Supported shape type strings include `polygon`, `rectangle`, `circle`, `line`, `linestrip`, `point`, `points`, `mask`, and `brush`.

## Examples

- [examples/basic_widget.py](examples/basic_widget.py): create a `FryCanvas` widget and show a NumPy image.
- [examples/embed_in_main_window.py](examples/embed_in_main_window.py): embed the widget into a normal `QMainWindow` with a small toolbar.
- [examples/wrap_as_dock.py](examples/wrap_as_dock.py): optional host-app code showing how to wrap the widget as a dock outside the package.

## Core Notes

The key concepts and integration notes are documented in [docs/CORE_CONCEPTS.md](docs/CORE_CONCEPTS.md).

## Build a pip Package

```bash
python -m pip install build twine
python -m build
python -m twine check dist/*
```

This produces a source distribution and a wheel in `dist/`. To publish to PyPI, run:

```bash
python -m twine upload dist/*
```

Publishing needs a PyPI account and token, so the repository is prepared for upload but credentials are not stored in the project.
