The Accelerators extension allows simple keyboard shortcuts to be used for many operations in Chimera. Accelerators (keyboard shortcuts) usually consist of two or three characters, but any number of characters is possible. Uppercase letters are sometimes used and are distinct from lowercase.
Many accelerators are included with Chimera, and new accelerators can be added.
There are several ways to start each of the three items relating to Accelerators, classified as tools in the General Controls category:
To enable accelerators automatically upon Chimera startup, check the Auto Start option for Accelerators On in the Tools preferences and then Save the preferences.
Accelerator List opens the Accelerators dialog, which lists the known accelerators along with brief descriptions. Clicking on an entry in the list shows a more detailed description (if available) at the bottom of the dialog.
Key press time-out (seconds) (2 seconds by default) controls how long keystrokes that form part of an accelerator are remembered.
The status line setting, accelerator file pathname, and time-out setting are saved in the preferences file.
Keystrokes may be interpreted as accelerators, as commands, or as information intended for other dialogs. Obviously, commands but not accelerators should be sent to the Command Line. Situations without conflict:
Situations with conflict possible:
Keystrokes being interpreted as accelerators are shown in the status line; the time-out setting controls how long a partial accelerator entry is retained. If the wrong key has been pressed, simply waiting for the time-out period to elapse allows a fresh start. Alternatively, pressing the escape key clears the partial accelerator from memory. Finally, if no accelerator starts with the key that has been pressed, an "unknown accelerator" status message results and the keystroke is not retained. Completed accelerator operations are reported in the status line and Reply Log.
The standard accelerators are defined in
chimera/share/Accelerators/standard_accelerators.pyAccelerators can be added by writing their definitions in a Python file and reading the file with Load on the Accelerators dialog.
Example accelerators file:
def register_accelerators(): from Accelerators import standard_accelerators standard_accelerators.register_accelerators() from Accelerators import add_accelerator add_accelerator('ry', 'Rotate models about y axis', rotate_y) add_accelerator('rs', 'Stop model rotation', stop_rotation) def rotate_y(): 'Spins models about the y axis' import Midas Midas.roll(axis = 'y') def stop_rotation(): 'Stops spinning models' import Midas Midas.freeze()
The register_accelerators() function is called by the Accelerators extension. The first two lines load the standard accelerators. The next three lines define accelerators ry and rs to spin the models about the Y axis and to stop the spinning. The routines that spin and stop the spinning use the Chimera Midas module. The comment strings in the add_accelerator lines are the short descriptions that appear in the top part of the Accelerators dialog and, when the accelerator operation is performed, in the status line; the comment string within each function is the explanation shown at the bottom of the Accelerators dialog when the accelerator list entry is clicked.
Since accelerators take effect immediately (without return), a new accelerator cannot start with an existing accelerator. For example, if ab is a known accelerator, accelerators of the form abx, where x is any character, cannot be used.
A click in the graphics window may be required.
As mentioned above, a click in the graphics window is sometimes required for either accelerator or command keystrokes to register, since some other dialog has stolen the "focus."
"Off by one" situations can occur.
Suppose sv (open the Side View) is intended, but "xv" is typed accidentally. If there is no accelerator starting with "x," an "unknown accelerator" status message results and only the "v" is retained in memory. If sv is then typed before the time-out period has elapsed, the keystrokes will be interpreted as the accelerator vs (show volume) and another "v" is retained in memory until the time-out period has again elapsed (or the escape key is pressed).
IDLE steals status messages.
When the IDLE tool (Python shell) is on, it displays all status messages and prevents them from being displayed on the status line. IDLE also diverts warnings, errors and all other messages that would otherwise go to the Reply Log and pop-up dialogs.
Only one line is visible for status messages.
Only a single line of text can be shown in the status line, even though status messages can be defined as multiple lines.
Accelerators could be shown on menu entries.
The keyboard shortcuts could be shown on the corresponding menu entries to make them easier to learn. More accelerators could be defined so that they are available for all suitable menu entries.