def do ( self, event, controller, *args ): """ Processes a keyboard event. """ key_name = toolkit().key_event_to_name( event ) for binding in self.bindings: if (key_name == binding.binding1) or (key_name == binding.binding2): method_name = '%s%s%s' % ( self.prefix, binding.method_name, self.suffix ) return (getattr( controller, method_name )( *args ) != False) return False
def do(self, event, controller, *args): """ Processes a keyboard event. """ key_name = toolkit().key_event_to_name(event) for binding in self.bindings: if (key_name == binding.binding1) or (key_name == binding.binding2): method_name = '%s%s%s' % (self.prefix, binding.method_name, self.suffix) return (getattr(controller, method_name)(*args) != False) return False
def get_plugin_classes(): """Get list of default plugin classes to use for Mayavi.""" # Force the selection of a toolkit: from enthought.traits.ui.api import toolkit toolkit() from enthought.etsconfig.api import ETSConfig try_use_ipython = preference_manager.root.use_ipython use_ipython = False if ETSConfig.toolkit == 'wx' and try_use_ipython: try: # If the right versions of IPython, EnvisagePlugins and # Pyface are not installed, this import will fail. from enthought.plugins.ipython_shell.view.ipython_shell_view \ import IPythonShellView use_ipython = True except: pass if use_ipython: from enthought.plugins.ipython_shell.ipython_shell_plugin import \ IPythonShellPlugin PythonShellPlugin = IPythonShellPlugin else: from enthought.plugins.python_shell.python_shell_plugin import PythonShellPlugin from enthought.plugins.text_editor.text_editor_plugin import TextEditorPlugin from enthought.logger.plugin.logger_plugin import LoggerPlugin from enthought.tvtk.plugins.scene.ui.scene_ui_plugin import SceneUIPlugin from enthought.mayavi.plugins.mayavi_ui_plugin import MayaviUIPlugin plugins = get_non_gui_plugin_classes() plugins.extend([ LoggerPlugin, MayaviUIPlugin, SceneUIPlugin, PythonShellPlugin, TextEditorPlugin, ]) return plugins