[chimera-dev] accelerators and stereo

Thomas Goddard goddard at cgl.ucsf.edu
Tue Apr 19 10:46:31 PDT 2005


Hi Matthew,

  If you would rather toggle between stereo and mono with the keyboard
instead of a button on the main window as I mentioned before here is
some code to do that.

  Put the code below in a file "accel.py" (name does not matter).
Then use menu entry Tools/Keyboard/Accelerator List and enter the path
the the accel.py file and press the Load button.  Also turn on the
"Accelerators on" switch in that dialog.  Then typing "ts" in the main
window will toggle between stereo and mono.  There are about 80 other
accelerators that are defined in the standard Chimera distribution.
Accelerators only work when typed to the main window.

  It isn't currently possible to use function keys in accelerators.
Function keys are silently ignored.  The accelerators are usually two
keys because there are so many of them.  You can have a one key
accelerator but it will prevent all other defined 2 key accelerators
starting with that one key from being used.

  Accelerators are off by default.  You can turn them on by default
using Favorites/Preferences category Tools and turning on the "Auto
Start" checkbutton (first column) next to "Accelerators On".  All the
entries from the Tools menu are listed in the same order as in the
Tools menu.  So you'll find "Accelerators On" in the Keyboard section
about half way down the Preferences dialog list.

     Tom

----
accel.py code follows

def register_accelerators():

  # Enable standard accelerators included with Chimera distribution
  from Accelerators import standard_accelerators, add_accelerator
  standard_accelerators.register_accelerators()

  add_accelerator('ts', 'Toggle stereo/mono viewing', toggle_stereo)
    
def toggle_stereo():
  'Toggle between stereo and mono viewing'
  import chimera
  c = chimera.viewer.camera
  if c.mode() == 'stereo':
    c.setMode('mono')
  else:
    if not c.setMode('stereo'):
      from chimera import replyobj
      replyobj.status('Start chimera with the --stereo command-line switch to enable stereo')
    #
    # Chimera camera modes:
    #   'VRex row stereo', 'cross-eye stereo', 'mono', 'stereo',
    #   'stereo left eye', 'stereo right eye', 'wall-eye stereo'
    #


More information about the Chimera-dev mailing list