def create_control(self, parent): """ Creates the toolkit-specific control that represents the view. """ self.shell = shell = PythonShell(parent) shell.on_trait_change(self._on_key_pressed, 'key_pressed') shell.on_trait_change(self._on_command_executed, 'command_executed') # Write application standard out to this shell instead of to DOS window self.on_trait_change( self._on_write_stdout, 'stdout_text', dispatch='ui' ) self.original_stdout = sys.stdout sys.stdout = PseudoFile(self._write_stdout) # Namespace contributions. for bindings in self._bindings: for name, value in bindings.items(): self.bind(name, value) for command in self._commands: self.execute_command(command) # We take note of the starting set of names and types bound in the # interpreter's namespace so that we can show the user what they have # added or removed in the namespace view. self._namespace_types = set((name, type(value)) for name, value in \ self.namespace.items()) # Register the view as a service. app = self.window.application self._service_id = app.register_service(IPythonShell, self) return self.shell.control
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the split. """ self._python_shell = PythonShell(parent) self._python_shell.bind('widget', self._tree) self._python_shell.bind('w', self._tree) return self._python_shell.control
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the style. """ self._python_shell = PythonShell(parent) self._python_shell.bind("widget", self._tree_viewer) self._python_shell.bind("w", self._tree_viewer) return self._python_shell.control
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the style. """ self.python_shell = PythonShell(parent) self.python_shell.bind('scene', self.scene) self.python_shell.bind('s', self.scene) return self.python_shell.control
def _create_python_shell(self, parent): """ Creates the Python shell. """ self._python_shell = python_shell = PythonShell(parent) python_shell.bind('widget', self._tree_viewer) python_shell.bind('w', self._tree_viewer) python_shell.bind('window', self) python_shell.bind('actions', self._actions) return python_shell.control
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the style. 's' and 'scene' are bound to the Scene instance.""" self.python_shell = PythonShell(parent) self.python_shell.bind('scene', self.scene) self.python_shell.bind('s', self.scene) self.python_shell.bind('tvtk', tvtk) return self.python_shell.control
def _create_rhs(self, parent): """ Creates the right hand side or bottom depending on the split. """ widget = self._grid self._python_shell = PythonShell(parent) self._python_shell.bind("widget", widget) self._python_shell.bind("w", widget) return self._python_shell.control
def _create_python_shell(self, parent): """ Creates the Python shell. """ self._python_shell = python_shell = PythonShell(parent) # Bind useful names. python_shell.bind('widget', self._tree) python_shell.bind('w', self._tree) python_shell.bind('window', self) python_shell.bind('explore', explore) # Execute useful commands to bind useful names ;^) python_shell.execute_command('from apptools.naming.api import *') return python_shell.control
def create(self, parent): """ Create the python shell task pane This wraps the standard pyface PythonShell """ logger.debug("PythonShellPane: creating python shell pane") self.editor = PythonShell(parent) self.control = self.editor.control # bind namespace logger.debug("PythonShellPane: binding variables") for binding in self.bindings: for name, value in binding.items(): self.editor.bind(name, value) # execute commands logger.debug("PythonShellPane: executing startup commands") for command in self.commands: self.editor.execute_command(command) logger.debug("PythonShellPane: created")
def _create_contents(self, parent): """ Create the editor. """ self._shell = PythonShell(parent) return self._shell.control
def _create_contents(self, parent): """ Create the shell widget. """ self.shell = PythonShell(parent) return self.shell.control