Skip to main content

TouchUtilCollection

A collection of (hopefully) useful python-functions, methods and other trinkets.

Install via PIP, UV, Conda or whatever you like.

Not all are isted in the readme, see this as a list of "highlights"

tdasync

Bring asyncio to TD in this minimal wrapper.

from touchutilcollection.tdasync import execute
from asyncio import sleep
async def coro( waittime ):
    op("text1").text = "Starting Coro"
    await sleep(waittime)
    op("text1").text = "Done"
execute( coro(5) )

Powerfull with TauCetiTweener and the .Resolve() functionality.

Extension

Makes your live with extensions easier by allowing for autocreation of custompars.

from touchutilcollection.extensions import EnsureExtension, partypes, parfield, pargrouptypes, pargroupfield

class extExample( 
    EnsureExtension # Required
     ):
    class par:
        Foo = parfield(partypes.ParFloat)
        Bar = parfield(partypes.ParFloat, page ="Different", min = 0, max = 10)
        Baba = parfield( 
            partypes.ParMenu, 
            menuLabels=["Eins", "Zwei", "Drei" ], 
            menuNames=["1", "2", "3"], 
            bindExpr="op.Settings.par.Baba" 
        )

    class parGroup:
        Somergb = pargroupfield( pargrouptypes.ParGroupRGBA, size = 3, default = (2,2,2) )

    def __init__(self, ownerComp) -> None:
        super().__init__(ownerComp) # Also required
        self.par.Foo.val = 23
        self.parGroup.Somergb[0].val = 2 # access pars using index
        self.parGroup.default = (1,2,3) # same members as pars, but as touples. size needs to be considered!

Alost helps with the autocallback-system for parameters.

from touchutilcollection.extensions import auto_callback_system

def my_extensions:
    def __init__(self, ownerComp:COMP):
        auto_callback_system( ownerComp )

    def on_Foobar_Value_Change( self, par:Par, prev_val:str):
        """ Gets called when the value of the parameter Foobar changes,"""
        debug("Foobar")

Ensure

Ensure existence of components without having to manualy create them (or even see them. )

Ensure Tox

Ensure the existence of the given TOX-COMP using a global op shortcut.

from touchutilcollection.ensure import ensure_global_tox
from TauCeti import Tweener
TweenerComp = ensure_global_tox( Tweener.ToxFile, "TAUCETI_TWEENER" )

Ensure TDP

Takes values from a TDP and applies the same Logic.

from touchutilcollection.ensure import ensure_global_tox
from TauCeti import Tweener
TweenerComp = ensure_global_tox( Tweener )

Network

from touchutilcollection.network import get_free_port
# Will return any free port currently available on the system

Events

A pruely python approach to event-handling similiar to how it is handled in the DOM/HTML. You can subscribe to any operator and any event. Events will bubble up the path.

from touchutilcollection.events import subscribe, emit

def example_handler(_source:OP, emitter:OP, event_name:str, bubbled:bool, *args, **kwargs):
    debug( _source, emitter, event_name, bubbled, args, kwargs)
    pass

subscribe( root, "foobar", example_handler)
emit( me, "foobar", "example_arg")
# note that bubbled will be true in the event-handler as we emittet the event from a child-component.

Metadata

Release files for tdp-touchutilcollection 0.8.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tdp-touchutilcollection 0.8.0
File Size Uploaded
tdp_touchutilcollection-0.8.0.tar.gz 14.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tdp-touchutilcollection 0.8.0
File Interpreter ABI Platform
tdp_touchutilcollection-0.8.0-py3-none-any.whl Python 3 none any Details

Total release size: 33.9 kB

Release files / tdp_touchutilcollection-0.8.0.tar.gz

Download URL tdp_touchutilcollection-0.8.0.tar.gz
Size 14.5 kB
Tags Source
SHA-256 checksum
How to use checksums
d215931fbe48bdbd1cd219b42ea5b7953b62fadfe30b51e1d61816ad3e29e1b8
BLAKE2b-256 checksum
How to use checksums
e964456befd82260482aa7500a44491c75dde853d16f2f334e3e85dd954a59a8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / tdp_touchutilcollection-0.8.0-py3-none-any.whl

Download URL tdp_touchutilcollection-0.8.0-py3-none-any.whl
Size 19.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
19f964af029d73438707768b84a791487599a7d5f297932a5aeaf4dda241a305
BLAKE2b-256 checksum
How to use checksums
732d47743e973e522cb31b8dc2990a6d57469d63fcccfddd1d16e96e6801cf7d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.3 {"installer":{"name":"uv","version":"0.11.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.8.0 This release

2 release files

0.7.4

2 release files

0.7.3

2 release files

0.7.2

2 release files

0.7.1

2 release files

0.7.0

2 release files

0.6.1

2 release files

0.6.0

2 release files

0.5.0

2 release files

0.4.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page