qtlets
Automatic linking of data to qt widgets. MCV without the boilerplate.
qtlets provides a simple way to keep in sync Qt widgets and data, without
forcing a redesign of your data classes. The rule is: if you like your class, you can
keep your class.
Currently, bidirectional linking can be performed in a simple call1:
instance.link_widget(my_widget, "name")
The data displayed on my_widget will be updated whenever instance.name is
modified. Changing the value on my_widget will update instance.name.
Multiple widgets can be kept synchronized in this way.
This functionnality is provided by a lightweight Mixin class called HasQtlets.
To enable qtlets on an Existing class, simply do:
class Data(HasQtlets, Existing): pass
and then use Data as a drop-in replacement for Existing. To link widgets,
make calls to link_widget. The widget should be able to send and receive the
appropriate data type. A few basic types are availalbe in qtlets.widgets
This library is currently in early stages. The documentation is light, and the API is changing quickly. All help is appreciated...
1 Some conditions currently apply, see the Features section.
Getting started
Requires Python 3.8+.
Installation
Regular installation
pip install qtlets
Development installation
For development, clone the repository and install with dev dependencies:
pip install -e ".[dev]"
Running tests
After installation:
pytest
Features
The following features are currently supported:
- Linking of widgets and data. Currently, scalar data members are supported;
- Multiple widgets can be linked with the same data attribute;
- Compatibility with simple vanilla classes, as well as more complex
third-party libraries such as
traitlets(Evenattrs! Isn't inheritance wonderful?); - Support for
properties; - The signal and slots used to communicate with the widget can be specified explicitly. For some widgets, a reasonable default is provided.
The following features are desired:
- Adding more data types and widgets.
- Streamlined type conversions and checks. For type conversion, we can pass
conversion functions to
link_widget. - Support for collections attributes (ex:
instance.values = []) - Support polling (
inst.link(widget, attrname, poll_interval=15)) - Leverage Qt's thread affinity when using signals and slots, for setting as well as for getting.
- More dedicated widgets.
- Use either PySide6 or PyQt. See how pyqtgraph does it.
Release files for qtlets 0.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| qtlets-0.5.tar.gz | 11.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| qtlets-0.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 18.6 kB
Release files / qtlets-0.5.tar.gz
| Download URL | qtlets-0.5.tar.gz |
|---|---|
| Size | 11.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
618575b32e38ac60d36d029a136a8f771dc805b5a38161071e6f7d238a5cb4a7
|
|
BLAKE2b-256 checksum How to use checksums |
9674a3df3802d7292e83a70e017484df51fd39cabc60d567a8c584d0ad0e59c7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|
Release files / qtlets-0.5-py3-none-any.whl
| Download URL | qtlets-0.5-py3-none-any.whl |
|---|---|
| Size | 7.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9e573e48c2da9005080fdff8545794c4b1a35def7efb4848840b8b3272770a9c
|
|
BLAKE2b-256 checksum How to use checksums |
9dda45f958359db0c2845460093aca556c213acf8ea5e5325e7ce860e8c68a86
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.0
|