PYME.Acquire.webui.ipy module

A single common terminal for all websockets.

class PYME.Acquire.webui.ipy.IPY(user_ns=None, user_module=None)

Bases: object

kill(signal=None)
start_ipython(*args, **kwargs)
class PYME.Acquire.webui.ipy.IPYTermManager(server_url='', ioloop=None, user_ns=None, user_module=None)

Bases: object

Base class for a terminal manager.

client_disconnected(websocket)

Override this to e.g. kill terminals on client disconnection.

get_terminal(url_component=None)

Override in a subclass to give a terminal to a new websocket connection

The TermSocket handler works with zero or one URL components (capturing groups in the URL spec regex). If it receives one, it is passed as the url_component parameter; otherwise, this is None.

kill_all = <Mock name='mock.gen.coroutine()' id='139772199703440'>
new_terminal(**kwargs)

Make a new terminal, return a PtyWithClients instance.

on_eof(ptywclients)

Called when the pty has closed.

pty_read(fd, events=None)

Called by the event loop when there is pty data ready to read.

shutdown = <Mock name='mock.gen.coroutine()' id='139772199703440'>
start_reading(ptywclients)

Connect a terminal to the tornado event loop to read data from it.

class PYME.Acquire.webui.ipy.IPYWithClients(ipy)

Bases: object

kill(sig=None)

Send a signal to the process in the pty

killpg(sig=None)

Send a signal to the process group of the process in the pty

property ptyproc
resize_to_smallest()

Set the terminal size to that of the smallest client dimensions.

A terminal not using the full space available is much nicer than a terminal trying to use more than the available space, so we keep it sized to the smallest client.

terminate(force=False)
class PYME.Acquire.webui.ipy.TTYDummy(filelike, fileno=None)

Bases: object

encoding = 'UTF-8'
errors = None
fileno()
isatty()
read(size=1024)

Read and return at most size bytes from the pty.

Can block if there is nothing to read. Raises EOFError if the terminal was closed.

Unlike Pexpect’s read_nonblocking method, this doesn’t try to deal with the vagaries of EOF on platforms that do strange things, like IRIX or older Solaris systems. It handles the errno=EIO pattern used on Linux, and the empty-string return used on BSD platforms and (seemingly) on recent Solaris.

readline()

Read one line from the pseudoterminal, and return it as unicode.

Can block if there is nothing to read. Raises EOFError if the terminal was closed.

write(text)
PYME.Acquire.webui.ipy.create_ipy_server(user_ns=None, user_module=None)
PYME.Acquire.webui.ipy.launch_ipy_server_thread(user_ns=None, user_module=None)