RE: [chimera-dev] accelerators and stereo

Hi Eric and Tom thanks for the code accelerator example. definetly want to have it use the f1 button matt
===== Original Message From Eric Pettersen <pett@cgl.ucsf.edu> ===== 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
------------------------------------------ Matthew Dougherty/713-433-3849 National Center for Macromolecular Imaging Baylor College of Medicine

Hi Matthew, Here is a modification of the ChimeraExtension.py code I sent earlier that will make the F1 function key switch between stereo and mono viewing. It directly grabs the F1 key presses from the main Chimera window since our current accelerator mechanism is ignoring the function keys. This code still provides the menu entry Tools->Utilities->Stereo/Mono and allows you to add a toolbar button as I described previously. To use this code make a directory in your 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 the F1 function key binding and the Tools->Utilities->Stereo/Mono menu entry to toggle modes. 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' # # ----------------------------------------------------------------------------- # emo = Stereo_Mono_EMO(__file__) chimera.extension.manager.registerExtension(emo) from chimera.tkgui import app app.bind('<KeyPress-F1>', lambda event, emo=emo: emo.activate()) app.graphics.bind('<KeyPress-F1>', lambda event, emo=emo: emo.activate())
participants (2)
-
Matthew Dougherty
-
Thomas Goddard