propsettings
This packages enables you to decorate class member variables as a Setting. A Setting is a type of property that allows defining characteristics of a variable that are taken into account by a user interface code to render that variable properly.
Installation
pip install propsettings
Usage
To register a member variable as a Setting you must use the method register_as_setting, e.g.
from propsettings.configurable import register_as_setting
class Example:
def __init__():
self._variable = 4
register_as_setting(Example, "_variable")
You can specify the label the UI will show for that variable with
register_as_setting(Example, "_variable", label="Variable label")
When the variable you want to decorate is initialized with None you must also specify the data type
class Example:
def __init__():
self._variable = None
register_as_setting(Example, "_variable", setting_value_type=str)
Sometimes is desirable to draw (in the user interface) your variable in a different way than the default. For example, the default way to show an integer value is with a text edit validated to only accept numeric values. However, maybe your variable only makes sense in the range [0 , 10]. In that case is better to have a slider than a text edit. That is when setting types come into play. A setting type is a type of annotation that gives more information about how to draw and validate a variable. For example:
from propsettings.setting_types.range_setting_type import Range
register_as_setting(Example, "_variable", setting_type=Range(0, 10))
To get a list of an object settings you can use
from propsettings.configurable import get_settings
e = Example()
settings = get_settings(e)
How to draw UI
This package is for variable annotation only. In order to draw user interfaces that take into account this annotations to render the variables you annotate, you must use another library. For Qt aaplications there is propsettings_qt
Metadata
Release files for propsettings 0.1.15
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| propsettings-0.1.15.tar.gz | 6.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| propsettings-0.1.15-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / propsettings-0.1.15.tar.gz
| Download URL | propsettings-0.1.15.tar.gz |
|---|---|
| Size | 6.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0455522604fea38e38e525a4933a98721270529da4b520952ae7575ef1388303
|
|
BLAKE2b-256 checksum How to use checksums |
61e1c718547a17c514ff5c0c4a4a0a50cdbe6bfc66f7acf43161d625bb671373
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|
Release files / propsettings-0.1.15-py3-none-any.whl
| Download URL | propsettings-0.1.15-py3-none-any.whl |
|---|---|
| Size | 8.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
89bd697f58eaec213f17a292224dd9f111577f5819781c6f67543569053da7f1
|
|
BLAKE2b-256 checksum How to use checksums |
d3f5998e9138093098da1fe8be4cd8cf485ab7e8a3c9c94de5611551ac11823b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.0 CPython/3.9.12
|