=================================================== pysimultanui
Python library for creating simple user interfaces for PySimultan
Installation
pysimultanui can be installed using pip:
pip install pysimultanui
Usage
Running the UI
uvicorn is used to run the UI. To run the UI, use the following command:
import pysimultanui as psui
from PySimultan2.taxonomy_maps import TaxonomyMap, Content
# example class to be mapped:
class ExampleClass:
def __init__(self, *args, **kwargs):
self.a = kwargs.get('a', None)
self.b = kwargs.get('b', None)
self.c = None
def add(self):
self.c = self.a + self.b
def subtract(self):
self.c = self.a - self.b
def multiply(self):
self.c = self.a * self.b
# create content and taxonomy map:
contents = {}
contents['a'] = Content(text_or_key='a_in_simultan',
property_name='a',
type=None,
unit=None,
documentation='Content a')
contents['b'] = Content(text_or_key='b_in_simultan',
property_name='b',
type=None,
unit=None,
documentation='Content b')
contents['c'] = Content(text_or_key='c_in_simultan',
property_name='c',
type=None,
unit=None,
documentation='Content c')
example_class_map = TaxonomyMap(taxonomy_name='PySimultanUI',
taxonomy_key='PySimultanUI',
taxonomy_entry_name='ExampleClass',
taxonomy_entry_key='ExampleClass',
content=[contents['a'],
contents['b'],
contents['c']
],
)
# get the mapper:
mapper = psui.core.mapper
# register the class to be mapped:
mapper.register(example_class_map.taxonomy_entry_key,
ExampleClass,
taxonomy_map=example_class_map)
# register methods:
cls = mapper.get_mapped_class('ExampleClass')
# get the method mapper:
method_mapper = psui.core.method_mapper
method_mapper.register_method(cls=cls,
name='subtract',
method=cls.subtract,
args=[],
kwargs={})
method_mapper.register_method(cls=cls,
name='add',
method=cls.add,
args=[],
kwargs={})
method_mapper.register_method(cls=cls,
name='multiply',
method=cls.multiply,
args=[],
kwargs={})
# run the UI:
psui.run_ui()
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pysimultanui-1.4.0.tar.gz
(57.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pysimultanui-1.4.0.tar.gz.
File metadata
- Download URL: pysimultanui-1.4.0.tar.gz
- Upload date:
- Size: 57.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
99fdb42f24231a59a5c31cdd2098ad20051f4cee1664583fa815e21cbdffcfe6
|
|
| MD5 |
1475a1ea3da4d31a92808cfb070089eb
|
|
| BLAKE2b-256 |
42b3741fb139fcd44dd829b7daca4b822090a4bb2fa125c5210db48ab726b261
|
File details
Details for the file pysimultanui-1.4.0-py3-none-any.whl.
File metadata
- Download URL: pysimultanui-1.4.0-py3-none-any.whl
- Upload date:
- Size: 75.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/5.1.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
390e557b993c94eebcd84f40a71e7617c08faed5b709b1bc73f1c7978892392f
|
|
| MD5 |
5aa71f44c64a4c7abfbb2fbbdec514ce
|
|
| BLAKE2b-256 |
56460f177a9772d85adb3516e0c43f51ceb1c2da8d2af3c7edf180227a285909
|