stoner_measurement.plugins.command.if_command.IfCommand¶
- class stoner_measurement.plugins.command.if_command.IfCommand(parent=None, condition: str = 'True')[source]¶
Bases:
CommandPlugin,SequencePluginRun nested sequence steps only when a Python expression is truthy.
Use this command as a branch in the sequence tree when only some nested actions should run for a point, segment, or step. The expression is evaluated against the live sequence namespace, so conditions can reference any plugin instance or variable already available to the generated script.
On General, enter Condition, a Python expression such as
counter.value > 0. A blank condition is treated asTrue. Place the steps to run beneath this command in the sequence tree. The expression is evaluated each time execution reaches the branch; an empty branch does nothing. Callingexecute()directly does nothing: the generated sequence supplies the conditional block. This command has no outputs.- Variables:
condition (str) – Runtime condition; defaults to “True”.
instance_name (str) – Inherited Python identifier for this instance in the Script tab and QtConsole.
comment (str) – Inherited optional note displayed beside this step.
sequence_engine (SequenceEngine | None) – Inherited owning engine and its live namespace; None while detached.
- Keyword Parameters:
parent (QObject | None) – Optional Qt parent object.
condition (str) – Initial condition; defaults to “True”.
Examples
With an instance named
if_commandin the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:if_command.condition = "counter.value > 0"
- execute() None[source]¶
No-op leaf execution.
IfCommandis intended to be used as a sequence container. If it is accidentally run as a leaf command it has no side effects.