qtspock

A RichJupyterWidget that loads a spock profile.

Note

The qtspock module has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.

Classes

QtSpockWidget

Inheritance diagram of QtSpockWidget
class QtSpockWidget(**kwargs: Any)[source]

Bases: RichJupyterWidget, TaurusBaseWidget

A RichJupyterWidget that starts a kernel with a spock profile.

Note

The QtSpockWidget class has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.

It is important to call shutdown_kernel to gracefully clean up the started subprocesses.

Useful methods of the base class include execute, interrupt_kernel, restart_kernel, and clear.

Parameters:
  • profile (str) – The name of the spock profile to use. The default is ‘spockdoor’.

  • kernel (str) – The name of the kernel to use. The default is ‘python3’.

  • use_model_from_profile (bool) – If true, the door name is taken from the spock profile, otherwise it has to be set via setModel.

  • kwargs – All remaining keywords are passed to the RichJupyterWidget base class

Examples:

from taurus.external.qt import Qt
from sardana.taurus.qt.qtgui.extra_sardana.qtspock import QtSpockWidget
app = Qt.QApplication(["qtspock"])
widget = QtSpockWidget(use_model_from_profile=True)
widget.show()
widget.start_kernel()
app.aboutToQuit.connect(widget.shutdown_kernel)
app.exec_()
start_kernel()[source]

Start the kernel

A normal IPython kernel is started if no model is set via setModel or use_model_from_profile.

setModel(door)[source]

Set a door as the model

An empty string or None will start a normal IPython kernel without spock functionality.

getModel()[source]

Returns the model name for this component.

Parameters:

key (object) – the model key. Defaults to first element of .modelKeys

Returns:

the model name.

Return type:

str

runMacro(macro_node)[source]
get_value(var, timeout=None)[source]

Retrieve a value from the user namespace through a blocking call.

The value must be able to be pickled on the kernel side and unpickled on the frontend side.

The command will import the pickle module in the user namespace. This may overwrite a user defined variable with the same name.

Parameters:
  • var (str) – The name of the variable to be retrieved

  • timeout (int or None) – Number of seconds to wait for reply. If no reply is recieved, a Queue.Empty exception is thrown. The default is to wait indefinitely

Returns:

The value of the variable from the user namespace

shutdown_kernel()[source]

Cleanly shut down the kernel and client subprocesses

QtSpock

Inheritance diagram of QtSpock
class QtSpock(parent=None, designMode=False)[source]

Bases: TaurusMainWindow

A standalone QtSpock window

Note

The QtSpock class has been included in Sardana on a provisional basis. Backwards incompatible changes (up to and including its removal) may occur if deemed necessary by the core developers.

createConfigureAction()[source]
changeConfiguration()[source]

This method is used to change macroserver as a model of application. It shows dialog with list of all macroservers on tango host, if the user Cancel dialog it doesn’t do anything.