apptools.selection.i_selection_provider module

class apptools.selection.i_selection_provider.ISelectionProvider(adaptee, default=<class 'traits.adaptation.adaptation_error.AdaptationError'>)[source]

Bases: Interface

Source of selections.

get_selection()[source]

Return the current selection.

Returns

selection – ISelection

Object representing the current selection.

provider_id = Str()

Unique ID identifying the provider.

selection = Event

Event triggered when the selection changes. The content of the event is an ISelection instance.

set_selection(items, ignore_missing=False)[source]

Set the current selection to the given items.

If ignore_missing is True, items that are not available in the selection provider are silently ignored. If it is False (default), an ValueError should be raised.

Parameters
  • list (items --) – List of items to be selected.

  • bool (ignore_missing --) – If False (default), the provider raises an exception if any of the items in items is not available to be selected. Otherwise, missing elements are silently ignored, and the rest is selected.