[chimera-dev] accelerators and stereo
Thomas Goddard
goddard at cgl.ucsf.edu
Tue Apr 19 10:10:37 PDT 2005
Hi Matthew,
Below is some Python code to make a button to toggle between stereo
and mono viewing in Chimera. I assumed you mean hardware stereo (LCD
or polarized glasses, or special monitor). You can adapt the code to
toggle to cross-eye or wall-eye stereo by changing 'stereo' to
'cross-eye stereo' or 'wall-eye stereo' in the code.
Make a directory in you Chimera distribution chimera/share/Stereo
(directory name does not matter) and put the code below in a file
ChimeraExtension.py (name does matter). This will add a
Tools->Utilities->Stereo/Mono menu entry to toggle modes.
To put a button for this on the Chimera main window use
Favorites/Preferences under Category tools you'll see all the Tools
menu entries listed in order. Find Utilities->Stereo/Mono and turn on
the checkbutton in the "On Toolbar" (second) column. The button will
show up on the left edge of the main Chimera window. Press the Save
button at the bottom of the Preferences dialog if you want this button
to be on the main window every time you start Chimera.
Tom
------
ChimeraExtension.py code follows:
# -----------------------------------------------------------------------------
#
import chimera.extension
# -----------------------------------------------------------------------------
#
class Stereo_Mono_EMO(chimera.extension.EMO):
def name(self):
return 'Stereo / Mono'
def description(self):
return 'Toggle between stereo and mono modes'
def categories(self):
return ['Utilities']
def icon(self):
return None
def activate(self):
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'
#
# -----------------------------------------------------------------------------
#
chimera.extension.manager.registerExtension(Stereo_Mono_EMO(__file__))
More information about the Chimera-dev
mailing list