Metadata-Version: 2.4
Name: uitk
Version: 1.13.0
Summary: Convention-driven Qt UI toolkit for Python (PySide6 via qtpy): Designer .ui files or code-built UIs, signal-slot wiring by widget name, state persistence, custom widgets and presets.
Author-email: Ryan Simpson <m3trik@outlook.com>
License-Expression: LGPL-3.0-or-later
Project-URL: Homepage, https://github.com/m3trik/uitk
Project-URL: Repository, https://github.com/m3trik/uitk
Project-URL: Changelog, https://github.com/m3trik/uitk/blob/main/CHANGELOG.md
Project-URL: Issues, https://github.com/m3trik/uitk/issues
Keywords: m3trik,qt,pyside6,qtpy,qt-designer,gui,python-library
Classifier: Programming Language :: Python :: 3
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: User Interfaces
Requires-Python: >=3.9
Description-Content-Type: text/markdown
License-File: COPYING
License-File: COPYING.LESSER
Requires-Dist: pythontk>=0.27.1
Requires-Dist: qtpy>=2.0
Requires-Dist: tomli>=1.1; python_version < "3.11"
Dynamic: license-file

[![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0.en.html)
[![PyPI](https://img.shields.io/pypi/v/uitk.svg)](https://pypi.org/project/uitk/)
[![Python](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://www.python.org/)
[![Qt](https://img.shields.io/badge/Qt-PySide6%20via%20qtpy-green.svg)](https://doc.qt.io/)
[![Tests](https://img.shields.io/badge/Tests-5970%20passed-brightgreen.svg)](../tests/)
![Platform](https://img.shields.io/badge/Platform-Windows%2C%20Linux-lightgrey.svg)

# uitk

> **Name it, and it connects.**
> A convention-driven Qt framework that turns UIs — Qt Designer files or widget trees built in code — plus Python slot classes into working applications with zero glue code.

<!-- diagram:ecosystem/uitk -->
<!-- Generated by m3trik/scripts/generate_readme_diagrams.py from the workspace's declarations: change those and re-run it, never this block. -->
<p align="center">
<a href="https://github.com/m3trik/m3trik#readme"><picture><source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/m3trik/m3trik/main/docs/diagrams/ecosystem-uitk-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://raw.githubusercontent.com/m3trik/m3trik/main/docs/diagrams/ecosystem-uitk-light.svg"><img alt="uitk (highlighted) in the ecosystem: uitk requires pythontk; unitytk requires pythontk; mayatk requires uitk; blendertk requires uitk; tentacle requires uitk; extapps requires uitk; tentacle installs mayatk as its [maya] extra; tentacle installs blendertk as its [blender] extra; tentacle opens extapps by name (its [apps] extra) and never imports it; mayatk and blendertk share a mirrored API. tentacle and extapps are products, which nothing imports." src="https://raw.githubusercontent.com/m3trik/m3trik/main/docs/diagrams/ecosystem-uitk-light.svg" width="781"></picture></a>
</p>
<!-- /diagram:ecosystem/uitk -->

<!-- sync:why -->
## Why uitk exists

UITK comes from years of building artist tooling for DCC pipelines (Maya, Blender), where you don't need one big application — you need *dozens of small ones*. Each traditionally pays the same Qt tax before doing anything useful: load the `.ui`, `findChild()` every widget, `.connect()` every signal, restore and save state, style it, and behave correctly standalone or inside a host app. None of that code is the tool — and hand-rolling it slightly differently each time is how a toolkit of thirty tools becomes thirty apps by thirty authors.
<!-- /sync:why -->

<!-- sync:design -->
## Design

| Principle | In practice |
|:--|:--|
| **Names do the wiring** | A widget's name in Designer is the name of the method it calls on the panel's slot class, and `<name>_init` runs once when the widget registers. UI files map to slot classes the same way, so a panel's code holds only what the tool does. |
| **Good behavior by default** | Every widget's value is saved when it changes and restored the next time its window opens; every window remembers its place, and the theme applies with no code. A fleet of small tools then behaves as one application. |
| **Options live on their widget** | Advanced settings attach to the control they belong to, as a `.menu` or an `.option_box` built with one call and read back by name, so a tool needs no separate settings dialog. |
| **No application inside** | uitk names no DCC and no product. A host answers a small adapter (`MarkingMenu(host=...)`, a `UiHandler`), and the same panels run standalone, in Maya and in Blender. |
| **Every convention has an override** | `@Signals` picks the signals a slot connects to, a handler replaces how windows are shown and styled, and any default can be switched off for one widget or one UI. |
| **Compiled UI that cannot go stale** | A `.ui` file compiles to a module stamped with its source's hash, and a stale one recompiles on load. Compilation uses the running binding's own `uic`, so the output loads where a venv's PySide6 and Maya's bundled one differ. |
| **Saved settings survive renames** | When a panel is renamed or merged into another, its users' saved values, widget states and shortcut overrides are carried into the panel that took its place. |
| **Test-driven, on live widgets** | Every bug is reproduced as a failing test before it is fixed, and the test stays in the suite. Nearly 6,000 tests run against live Qt widgets offscreen, and a release requires a full passing run recorded against that exact source. |

**Fits:** fleets of small-to-medium tools, built in Designer or in code, standalone or hosted in an application such as a DCC. **Doesn't:** a single large app with its own UI layer, or non-Qt targets. [tentacle](https://github.com/m3trik/tentacle)'s panels and [extapps](https://github.com/m3trik/extapps)' apps are all built on it. The reasoning behind each rule is in the [code standard](https://github.com/m3trik/m3trik/blob/main/docs/CODE_STANDARD.md).
<!-- /sync:design -->

<!-- sync:whats-in-it -->
## What's in it

| Part | What it is for | Guide |
|:--|:--|:--|
| `Switchboard` | Finds UI files and slot classes, wires them and owns the registries and settings: one object starts a whole fleet of tools | [Architecture](https://github.com/m3trik/uitk/blob/main/docs/ARCHITECTURE.md) |
| Slots | The method-naming contract: default signals, `@Signals`, parameter injection, debounce, cancel | [Slots Contract](https://github.com/m3trik/uitk/blob/main/docs/SLOTS.md) |
| `MainWindow` | Wraps every loaded UI: lifecycle signals, saved geometry and state, styling, placement | [User Guide](https://github.com/m3trik/uitk/blob/main/docs/USER_GUIDE.md) |
| Widgets | `.menu`, `.option_box`, tables, header and footer, each placeable in Qt Designer (`python -m uitk.designer`) | [Widgets](https://github.com/m3trik/uitk/blob/main/docs/WIDGETS.md) |
| Marking menu | A radial gesture menu: a whole toolkit reached from one held key | [Marking Menu](https://github.com/m3trik/uitk/blob/main/docs/MARKING_MENU.md) |
| Sequencer and editors | An NLE-style timeline (clips, keys, markers, audio scrub) and the bundled Style, Shortcut and UI Browser editors | [Widgets](https://github.com/m3trik/uitk/blob/main/docs/WIDGETS.md#sequencer-package) |
| Handlers | Host-specific behavior (Maya, Blender, standalone) without forking the library or the tools | [Architecture](https://github.com/m3trik/uitk/blob/main/docs/ARCHITECTURE.md#handler-ecosystem) |
| Bridge | Parameter panels for jobs run in another program: options built from specs, presets, a log and a Run button | [Bridge](https://github.com/m3trik/uitk/blob/main/docs/BRIDGE.md) |

New here: the [Tutorial](https://github.com/m3trik/uitk/blob/main/docs/EXAMPLES.md) goes from an empty folder to a working app, the [Cookbook](https://github.com/m3trik/uitk/blob/main/docs/COOKBOOK.md) has recipes from real tools, and the [API Reference](https://github.com/m3trik/uitk/blob/main/docs/API_REFERENCE.md) lists the public signatures.
<!-- /sync:whats-in-it -->

## Install

```bash
pip install uitk PySide6          # standalone (PySide6 is the supported binding)
python -m uitk.examples.example   # optional: interactive demo of the full feature set
```

<!-- sync:qt-install-note -->
Inside a DCC, `pip install uitk` is enough — the host provides its own Qt binding (uitk pulls in the pure-Python `qtpy` shim but deliberately no binding).
<!-- /sync:qt-install-note -->

<!-- sync:quickstart -->
```python
from uitk import Switchboard

class EditorSlots:
    def __init__(self, **kwargs):
        self.sb = kwargs["switchboard"]
        self.ui = self.sb.loaded_ui.editor

    def btn_save_init(self, widget):   # runs once when btn_save registers
        widget.setText("Save")

    def btn_save(self):                # runs on clicked (QPushButton default signal)
        self.sb.message_box("Saved")

sb = Switchboard(ui_source="editor.ui", slot_source=EditorSlots)
sb.loaded_ui.editor.show(pos="screen", app_exec=True)
```

Widget `btn_save` in `editor.ui` is connected to `EditorSlots.btn_save` because the names match.
<!-- /sync:quickstart -->

No `.connect()` calls. No `findChild()`. No manual state restore.

See also: [changelog](https://github.com/m3trik/uitk/blob/main/CHANGELOG.md) · [tests](https://github.com/m3trik/uitk/tree/main/tests) · [contributing](https://github.com/m3trik/uitk/blob/main/AGENTS.md) · [docs ledger](https://github.com/m3trik/uitk/blob/main/docs/DOCMAP.md).

## License

LGPL-3.0-or-later — see [COPYING.LESSER](https://github.com/m3trik/uitk/blob/main/COPYING.LESSER) and [COPYING](https://github.com/m3trik/uitk/blob/main/COPYING).
