IPythonPanel
For conceptual usage, see:
- class pyrogue.pydm.widgets.IPythonPanel(parent=None, init_channel=None)[source]
An IPython session with a connected Rogue client, in a detachable tab.
A pseudo-terminal running IPython, with
pyrogue.interfaces.VirtualClientalready connected and bound asclient, and the tree root asroot. It is the session the Rogue server suggests at startup, opened for the user instead of typed out.The console runs on the machine displaying the GUI as the user who launched it, not on the Rogue server, and it reaches the tree the same way any other client does, over ZMQ. Anyone who can reach the GUI window can run arbitrary Python, and anything Python can reach, with that user’s privileges, which is why the feature is opt-in.
The connection is its own client in its own process, not the one the PyDM channels share, so a session that is stopped or wedged from the prompt cannot take the rest of the GUI’s channels with it.
IPython starts on first display rather than on construction, so enabling the feature costs nothing until the tab is opened, and the up to five second connection attempt never delays the GUI coming up. Exiting the session starts a fresh, reconnected one.
- pyrogue.pydm.widgets.ipython_core.ipythonArgv(addr, port, executable=None)[source]
Return the argv that starts IPython with the client already connected.
Started as
-m IPythonon the interpreter running the GUI rather than through anipythonfound onPATH. A console that runs on a different interpreter would import a different, or no,pyrogue, and would not see thePYTHONPATHof a local Rogue build.-iis what keeps the session alive after the-ccode has run, so the connected client stays in the namespace the user types into.- Parameters:
- Returns:
Argument vector suitable for
pyrogue.pydm.widgets.terminal_core.spawnShell().- Return type:
- pyrogue.pydm.widgets.ipython_core.startupCode(addr, port)[source]
Return the code IPython runs before handing over the prompt.
Connects a
pyrogue.interfaces.VirtualClientand leaves it bound asclient, with the tree root asroot, which is the naming the Rogue server itself suggests when it starts and the one the notebooks and docs use.A failure to connect is caught rather than left to propagate. The console is still useful without a link, and the user gets the exact line to retry with once the server is up.
VirtualClientprints its own connection banner, so the success path only names what is now in scope.