Skip to main content

Qt with less boilerplate

Project description

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 (Even attrs! 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

qtlets-0.5.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

qtlets-0.5-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file qtlets-0.5.tar.gz.

File metadata

  • Download URL: qtlets-0.5.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qtlets-0.5.tar.gz
Algorithm Hash digest
SHA256 618575b32e38ac60d36d029a136a8f771dc805b5a38161071e6f7d238a5cb4a7
MD5 8f9e50f17f25db1cf585752064fbed61
BLAKE2b-256 9674a3df3802d7292e83a70e017484df51fd39cabc60d567a8c584d0ad0e59c7

See more details on using hashes here.

File details

Details for the file qtlets-0.5-py3-none-any.whl.

File metadata

  • Download URL: qtlets-0.5-py3-none-any.whl
  • Upload date:
  • Size: 7.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for qtlets-0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 9e573e48c2da9005080fdff8545794c4b1a35def7efb4848840b8b3272770a9c
MD5 174413a990eb655a8644dbfbe8a1c5ce
BLAKE2b-256 9dda45f958359db0c2845460093aca556c213acf8ea5e5325e7ce860e8c68a86

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page