The Selection Manager

Some extensions may identify sets of Selectables that it would be useful for other extensions to be able to identify, or for the user to select from the Selection menu. For example, the ChemGroup extension identifies chemical entities such as aromatic rings. It is useful to allow other extensions (and the user) to also pick out these entities without replicating the ChemGroup code. This is accomplished by registering selections with the Chimera selection manager.

The Chimera selection manager is defined in chimera.selection.manager. Selections are registered with the selection manager as strings (either Python code or OSL strings) and are made available in the Chimera Selection menu. Selections can (only) be retrieved from the selection manager en masse as a dictionary organized in the same fashion as the Selection menu. The keys in the dictionary are the same as the menu labels, and the values are either a 2-tuple of the registered selection string and a help description, or a dictionary introducing a submenu which is organized the same as the main dictionary. The selectionFromText method of the selection manager converts a registered selection string into the appropriate Selection subclass.

chimera.selection.manager also defines the CodeItemizedSelection class, which is similar to the CodeSelection class described above, except that the code is given an empty ItemizedSelection to fill in instead of functions to apply.

The Python strings registered with the selection manager are expected to be useable in conjunction with CodeItemizedSelections.

This example is not yet finished. Sorry!