spock
Spock is basically an IPython extension.
It implements the load_ipython_extension()
hook function where it exposes some
variables and magic commands to the IPython namespace on startup.
There are two different groups of variables and magics: the built-in ones and the custom ones.
The built-in ones are exposed directly by the load_ipython_extension()
function and are common to all Sardana systems and Spock sessions
e.g. www
and edmac
magics or MACRO_SERVER
and DOOR
variables.
The custom ones are exposed by the MacroServer’s elements attribute listener as explained in the next paragraph.
Spock implements its own Taurus extensions for MacroServer and Door devices in
SpockMacroServer
and SpockDoor
classes. This extenstion enhances the standard
Taurus extensions for Sardana devices
in the following way. In case of the MacroServer, when the
SpockMacroServer
receives the elements attribute event it exposes
the current Device Pool elements as variables
e.g. mot01
, mntgrp01
, and macros as magics
e.g. sar_demo
, mv
, ct
. On Spock startup, when the SpockMacroServer
object
is created, it will expose at once all variables corresponding
to all elements proceding from all Device Pools the MacroServer is connected to
and magics corresponding to all macros present in the MacroServer.
In case of the Door, when the macro magics are executed the SpockDoor
extensions
executes them in synchronous way i.e. holds the Spock prompt until the macro has
finished, and handles KeyboardInterrupt
exceptions (Ctrl+C
) to interrupt
the macro execution.
Modules