SelectionCallbackProperty

class echo.SelectionCallbackProperty(default_index=0, choices=None, display_func=None, comparison_type=None, **kwargs)[source]

Bases: echo.core.CallbackProperty

Methods

add_callback(instance, func[, echo_old, ...])

Add a callback to a specific instance that manages this property

clear_callbacks(instance)

Remove all callbacks on this property.

disable(instance)

Disable callbacks for a specific instance

enable(instance)

Enable previously-disabled callbacks for a specific instance

notify(instance, old, new)

Call all callback functions with the current value

remove_callback(instance, func)

Remove a previously-added callback

setter(func)

Method to use as a decorator, to mimic @property.setter

enabled

force_next_sync

get_choice_labels

get_choices

get_display_func

set_choices

set_display_func

Methods Summary

add_callback(instance, func[, echo_old, ...])

Add a callback to a specific instance that manages this property

clear_callbacks(instance)

Remove all callbacks on this property.

disable(instance)

Disable callbacks for a specific instance

enable(instance)

Enable previously-disabled callbacks for a specific instance

enabled(instance)

force_next_sync(instance)

get_choice_labels(instance)

get_choices(instance)

get_display_func(instance)

notify(instance, old, new)

Call all callback functions with the current value

remove_callback(instance, func)

Remove a previously-added callback

set_choices(instance, choices)

set_display_func(instance, display)

setter(func)

Method to use as a decorator, to mimic @property.setter

Methods Documentation

add_callback(instance, func, echo_old=False, priority=0)

Add a callback to a specific instance that manages this property

Parameters
instance

The instance to add the callback to

funcfunc

The callback function to add

echo_oldbool, optional

If True, the callback function will be invoked with both the old and new values of the property, as func(old, new). If False (the default), will be invoked as func(new)

priorityint, optional

This can optionally be used to force a certain order of execution of callbacks (larger values indicate a higher priority).

clear_callbacks(instance)

Remove all callbacks on this property.

disable(instance)

Disable callbacks for a specific instance

enable(instance)

Enable previously-disabled callbacks for a specific instance

enabled(instance)
force_next_sync(instance)[source]
get_choice_labels(instance)[source]
get_choices(instance)[source]
get_display_func(instance)[source]
notify(instance, old, new)

Call all callback functions with the current value

Each callback will either be called using callback(new) or callback(old, new) depending on whether echo_old was set to True when calling add_callback()

Parameters
instance

The instance to consider

old

The old value of the property

new

The new value of the property

remove_callback(instance, func)

Remove a previously-added callback

Parameters
instance

The instance to detach the callback from

funcfunc

The callback function to remove

set_choices(instance, choices)[source]
set_display_func(instance, display)[source]
setter(func)

Method to use as a decorator, to mimic @property.setter