autoqt
A simple single file module that makes setting up basic Qt properties a little bit nicer without restricting you.
This is very useful if you have QObjects with many readonly properties and a few special setters or state modifying slots.
Example:
from PyQt5.QtCore import pyqtSignal, pyqtSlot
from autoqt import AutoObject, AutoProp
class SomeObject(AutoObject):
valuesChanged = pyqtSignal()
aNumber = AutoProp(int, 'valuesChanged', '_aNumber')
otherNumber = AutoProp(float, 'valuesChanged', '_otherNumber')
aString = AutoProp(str, 'valuesChanged', '_aString', write=True)
def __init__(self, parent=None):
super().__init__(parent=parent)
self._aNumber = 10
self._otherNumber = 20
self._aString = 'spam'
@pyqtSlot()
def incrementNumber(self):
self._aNumber += 1
self.valuesChanged.emit()
@otherNumber.setter
def otherNumber(self, value):
self._otherNumber = value + 2
self.valuesChanged.emit()
x = SomeObject()
print(x.aNumber) # 10
x.aNumber = 10 # throws AttributeError, readonly property
x.incrementNumber() # valuesChanged is emitted
print(x.aNumber) # 11
print(x.otherNumber) # 20
x.otherNumber = 40 # otherNumber.setter called, valuesChanged is emitted
print(x.otherNumber) # 42
print(x.aString) # 'spam'
x.aString = 'ham' # valuesChanged is emitted, writable property
print(x.aString) # 'ham'
Metadata
Release files for autoqt 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| autoqt-0.0.6.tar.gz | 3.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| autoqt-0.0.6-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 7.2 kB
Release files / autoqt-0.0.6.tar.gz
| Download URL | autoqt-0.0.6.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
71c8dd8c8ed06b82a615c5a73d4492404c40de2989979ffca2af7aee2c000a01
|
|
BLAKE2b-256 checksum How to use checksums |
d2529bb3f1750c62f9c1e5eba6d7eb9702c81efb7b5a18fccbf31df6b5c7f769
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
|
Release files / autoqt-0.0.6-py3-none-any.whl
| Download URL | autoqt-0.0.6-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
9fe481dfe9ae2bb905f131fa972fe5817c6993665b00ee283b89aa1b29ccff02
|
|
BLAKE2b-256 checksum How to use checksums |
10d3c10f747e9f8e2455ae94cfa01013388c3f1dbbb18de916c575562db68b5f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.3
|