EditableSelectPluginComponent#

class jdaviz.core.template_mixin.EditableSelectPluginComponent(**kwargs: Any)[source]#

Bases: SelectPluginComponent

Plugin select with support for renaming, adding, and deleting items (by the user).

Useful API methods/attributes:

Parameters:
plugin

the parent plugin object

itemsstr

the name of the items traitlet defined in plugin

selectedstr

the name of the selected traitlet defined in plugin

edit_valuestr

the name of the traitlet containing the temporary edit value defined in plugin

manual_optionslist

list of entries present before user-modification

namestr

the user-friendly name of the items, used in error message in place of “entry”

on_addcallable

callback when a new item is added, but before the selection is updated

on_add_after_selectioncallable

callback when a new item is added and the selection is updated

on_renamecallable

callback when an item is renamed, but before the selection is updated

on_rename_after_selectioncallable

callback when an item is renamed and the selection is updated

on_removecallable

callback when an item is removed, but before the selection is updated

on_remove_after_selectioncallable

callback when an item is removed and the selection is updated

Methods Summary

add_choice(label[, set_as_selected])

Add a new entry/choice.

remove_choice([label])

Remove an existing entry.

rename_choice(old, new)

Rename an existing entry.

Methods Documentation

add_choice(label, set_as_selected=True)[source]#

Add a new entry/choice.

Parameters:
* labelstr

label of the new entry, must not already be one of the choices

* set_as_selectedbool

whether to immediately set the new entry as the selected entry

remove_choice(label=None)[source]#

Remove an existing entry.

Parameters:
* labelstr

label of an existing entry. If not provided, will default to the currently selected entry

rename_choice(old, new)[source]#

Rename an existing entry.

Parameters:
* oldstr

label of the existing entry to modify

* newstr

new label. Must not be another existing entry.