stoner_measurement.plugins.sequence.base.SequencePlugin¶
- class stoner_measurement.plugins.sequence.base.SequencePlugin[source]¶
Bases:
BasePluginAbstract base class for plugins that act as containers in the sequence tree.
A
SequencePlugincan hold nested sub-steps. The sequence engine and the UI tree widget both recogniseSequencePlugininstances as branch nodes that may accept child steps dropped onto them.Concrete implementations must supply
name(fromBasePlugin) andexecute_sequence().StateControlPlugininherits from this class to gain sub-sequence container behaviour, whilst retaining its full instrument-lifecycle API.- Variables:
sub_steps (list) – The sub-step descriptors assigned by the sequence engine when building an execution plan from the sequence tree. Each element is either a plain entry-point name string (for a leaf sub-step) or a
(ep_name, [sub-steps…])tuple (for a nestedSequencePluginsub-step). Defaults to an empty list.
Examples
>>> from stoner_measurement.plugins.sequence import SequencePlugin >>> issubclass(SequencePlugin, SequencePlugin) True
- declared_outputs() PluginOutputs[source]¶
Declare no outputs for a transparent sequence container.
- abstractmethod execute_sequence(sub_steps: list) None[source]¶
Execute sub_steps at the appropriate point in this plugin’s lifecycle.
The sequence engine calls this method when running a sequence tree. Each element of sub_steps is a zero-argument callable that, when invoked, runs the corresponding nested step (including its own lifecycle and any further sub-steps).
Direct state-scan and state-sweep helpers perform their own setup and cleanup around the callable children. Generated scripts instead own whole-sequence setup and cleanup, then render this container’s action through
generate_action_code(). Overriding this direct helper alone does not change generated control flow. Implementations of both paths must agree on child ordering, point metadata and collection.- Parameters:
sub_steps (list) – Ordered list of zero-argument callables, one per nested step.
Examples
>>> from stoner_measurement.plugins.sequence import TopLevelSequence >>> seq = TopLevelSequence() >>> called = [] >>> seq.execute_sequence([lambda: called.append(1), lambda: called.append(2)]) >>> called [1, 2]
- generate_action_code(indent: int, sub_steps: list, render_sub_step: Callable) list[str][source]¶
Return action code lines by transparently rendering all sub-steps.
A generic
SequencePlugincontainer has no action of its own; it simply delegates to each nested step at the same indentation level.StateControlPluginoverrides this method to wrap sub-steps inside a scan loop.- Parameters:
- Returns:
Lines for all nested sub-steps at the same indentation level.
- Return type:
Examples
>>> from stoner_measurement.plugins.sequence import TopLevelSequence >>> seq = TopLevelSequence() >>> lines = seq.generate_action_code(0, [], lambda s, i: []) >>> lines []