accelerators and stereo

I would like to have the f1 key do stereo/mono. can you recommend a change I can make? ------------------------------------------ Matthew Dougherty/713-433-3849 National Center for Macromolecular Imaging Baylor College of Medicine

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__))

It is also possibly to have the F1 button do the toggling, if that is specifically what you require. If it is, let me know and I can provide details. --Eric On Apr 19, 2005, at 10:10 AM, Thomas Goddard wrote:
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__))
_______________________________________________ Chimera-dev mailing list Chimera-dev@cgl.ucsf.edu http://www.cgl.ucsf.edu/mailman/listinfo/chimera-dev

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' #
participants (3)
-
Eric Pettersen
-
Matthew Dougherty
-
Thomas Goddard