stoner_measurement.plugins.command.plot_clear.PlotClearCommand

class stoner_measurement.plugins.command.plot_clear.PlotClearCommand(parent=None)[source]

Bases: CommandPlugin

Clear all traces from the main plot window.

Use this command when you want to start a fresh plot at some point in the sequence. A common pattern is to clear the plot just before a new sweep, a new sample, or a new temperature/field branch so that old traces do not remain visible and cause confusion.

This plugin has no settings beyond the standard instance-name field on the configuration tab. The Help/About tab uses this docstring to explain that no trace selection is needed: when the step runs, every currently displayed trace is removed from the main plot window.

Variables:
  • plot_clear (pyqtSignal) – Emitted by execute(). Automatically connected to clear_all() when the plugin is attached to an engine with a plot widget.

  • 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.

Examples

With an instance named plot_clear in the sequence, use the QtConsole to inspect or edit it before running. Substitute your instance name if different; result data reflects completed steps:

plot_clear.instance_name
plot_clear.execute()
config_widget(parent: QWidget | None = None) → QWidget[source]

Return a minimal settings widget for the plot-clear command.

This plugin has no configurable parameters; the widget only displays an informational message.

Keyword Parameters:

parent (QWidget | None) – Optional Qt parent widget.

Returns:

The settings widget for the PlotClear configuration tab.

Return type:

(QWidget)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.command.plot_clear import PlotClearCommand
>>> from qtpy.QtWidgets import QWidget
>>> isinstance(PlotClearCommand().config_widget(), QWidget)
True
execute() → None[source]

Emit plot_clear to clear all traces from the plot window.

Raises:

RuntimeError – If the plugin is not attached to a sequence engine.

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.command.plot_clear import PlotClearCommand
>>> from stoner_measurement.core.sequence_engine import SequenceEngine
>>> engine = SequenceEngine()
>>> cmd = PlotClearCommand()
>>> engine.add_plugin("plot_clear", cmd)
>>> cleared = []
>>> cmd.plot_clear.connect(lambda: cleared.append(True))
>>> cmd.execute()
>>> cleared
[True]
>>> engine.shutdown()
property name: str

Unique identifier for the plot-clear command.

Returns:

"Plot Clear".

Return type:

(str)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.command.plot_clear import PlotClearCommand
>>> PlotClearCommand().name
'Plot Clear'
plot_clear

Signal emitted by execute() — triggers clear_all() on the plot widget.

property sequence_engine: SequenceEngine | None

Active sequence engine, or None when the plugin is detached.

Overrides the class-level attribute from BasePlugin with a full property so that the setter can automatically connect the plot_clear signal to the engine’s plot widget.

Returns:

The owning engine, or None if not attached.

Return type:

(SequenceEngine | None)

Examples

>>> from qtpy.QtWidgets import QApplication
>>> _ = QApplication.instance() or QApplication([])
>>> from stoner_measurement.plugins.command.plot_clear import PlotClearCommand
>>> from stoner_measurement.core.sequence_engine import SequenceEngine
>>> engine = SequenceEngine()
>>> cmd = PlotClearCommand()
>>> cmd.sequence_engine is None
True
>>> engine.add_plugin("plot_clear", cmd)
>>> cmd.sequence_engine is engine
True
>>> engine.shutdown()