Re: [chimera-dev] accelerators and stereo

Hi Matthew, Ok I think I have it right now. The code below where I've added a second argument to the c.setMode() call now makes the F1 function key toggle between stereo and mono. Sorry the previous code did not work. I tested it with "cross-eye stereo" because my machine did not have hardware stereo and that worked with the previous code. But when I tested with hardware stereo I found that it needed the second argument to the setMode() function. 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', chimera.viewer) else: if not c.setMode('stereo', chimera.viewer): 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 (1)
-
Thomas Goddard