plectrum.api

plectrum.api.pick_single(items, message=None, validator=None)[source]

Return index of selected item from items.

message should be an optional string to display to the user prior to the select control (an instruction for example).

validator should be an optional callable with signature (items, selection). It should be called when the selection is confirmed and is expected to return a list of validation errors found. If the returned list is empty then the selection is approved and confirmation continues. Otherwise the errors are displayed to the user and confirmation prevented.

If cancelled, return None.

plectrum.api.pick_multiple(items, message=None, validator=None)[source]

Return indexes of selected items from items.

message should be an optional string to display to the user prior to the select control (an instruction for example).

validator should be an optional callable with signature (items, selection). It should be called when the selection is confirmed and is expected to return a list of validation errors found. If the returned list is empty then the selection is approved and confirmation continues. Otherwise the errors are displayed to the user and confirmation prevented.

If cancelled, return None.