Skip to main content

PlotEvent

Enum PlotEvent 

Source
pub enum PlotEvent {
Show 21 variants ItemAdded { handle: ItemHandle, kind: PlotItemKind, }, ItemUpdated { handle: ItemHandle, kind: PlotItemKind, }, ItemRemoved { handle: ItemHandle, kind: PlotItemKind, }, ActiveItemChanged { previous: Option<ItemHandle>, current: Option<ItemHandle>, }, LimitsChanged { x: (f64, f64), y: (f64, f64), y2: Option<(f64, f64)>, }, RoiAdded { index: usize, }, RoiChanged { index: usize, }, RoiCreated { index: usize, }, DrawingProgress { mode: DrawMode, points: Vec<(f64, f64)>, }, DrawingFinished { mode: DrawMode, params: DrawParams, }, RoiAboutToBeRemoved { index: usize, }, RoisCleared, CurrentRoiChanged { previous: Option<usize>, current: Option<usize>, }, RoiInteractionModeChanged { index: usize, mode: RoiInteractionMode, }, MarkerMoved { handle: ItemHandle, }, MarkerDragStarted { handle: ItemHandle, }, MarkerDragFinished { handle: ItemHandle, }, CurveClicked { handle: ItemHandle, index: usize, x: f64, y: f64, button: MouseButton, }, ImageClicked { handle: ItemHandle, col: u32, row: u32, button: MouseButton, }, ItemClicked { handle: ItemHandle, button: MouseButton, }, ItemHovered { handle: ItemHandle, kind: PlotItemKind, label: Option<String>, x: f64, y: f64, xpixel: f32, ypixel: f32, draggable: bool, },
}
Expand description

High-level events queued by PlotWidget for application code to drain.

Variants§

§

ItemAdded

An item was added to the plot.

Fields

§handle: ItemHandle
§

ItemUpdated

An item’s data was updated in place.

Fields

§handle: ItemHandle
§

ItemRemoved

An item was removed from the plot.

Fields

§handle: ItemHandle
§

ActiveItemChanged

The selected item changed (via legend click or PlotWidget::set_active_item).

Fields

§previous: Option<ItemHandle>
§

LimitsChanged

The display limits changed (pan, zoom, or programmatic update), carrying the new ranges (silx limitsChanged, PlotEvents.py:176-184): x and y are the left axes’ (min, max), y2 the right axis’ (min, max) or None when no right axis is in use.

Fields

§x: (f64, f64)
§y: (f64, f64)
§y2: Option<(f64, f64)>
§

RoiAdded

A ROI was added to the collection at index (silx sigRoiAdded), whether programmatically (PlotWidget::add_roi / PlotWidget::add_managed_roi) or by an on-plot interactive draw. For an interactive draw a Self::RoiCreated is emitted on the same frame, after this (silx emits sigRoiAdded then sigInteractiveRoiFinalized). Distinct from Self::RoiChanged, which signals only a geometry change to an existing ROI.

Fields

§index: usize
§

RoiChanged

An ROI edge drag or whole-ROI body drag moved the ROI at index (silx sigRoiChanged). A pure geometry change — adds emit Self::RoiAdded instead.

Fields

§index: usize
§

RoiCreated

A new ROI was created at index by an on-plot draw in PlotInteractionMode::RoiCreate (silx sigInteractiveRoiFinalized: the interactive draw gesture finished). Read its geometry with plot().rois[index].roi. siplot builds the ROI only on draw-finish (no mid-draw ROI object), so silx’s separate sigInteractiveRoiCreated (mid-gesture) collapses into this finish event.

Fields

§index: usize
§

DrawingProgress

The in-progress draw preview advanced this frame in PlotInteractionMode::RoiCreate (silx drawingProgress): points are the current rubber-band’s data-space vertices for the given mode.

Fields

§points: Vec<(f64, f64)>
§

DrawingFinished

An on-plot draw completed this frame (silx drawingFinished), carrying the resolved DrawParams. In PlotInteractionMode::RoiCreate a Self::RoiCreated is emitted on the same frame (the ROI is built on top of the finished draw, mirroring silx’s RegionOfInterestManager).

Fields

§params: DrawParams
§

RoiAboutToBeRemoved

A single ROI at index is about to be removed, emitted before the removal so a listener can still read the ROI being dropped (silx RegionOfInterestManager.sigRoiAboutToBeRemoved). After this the ROI is gone and indices past it shift down by one.

Fields

§index: usize
§

RoisCleared

All ROIs were cleared in one operation via PlotWidget::clear_rois (re-read rois()). A single-ROI removal emits Self::RoiAboutToBeRemoved instead — RoisCleared means the whole collection was emptied.

§

CurrentRoiChanged

The current/highlighted ROI changed, by a manager selection or PlotWidget::set_current_roi (silx sigCurrentRoiChanged). Carries the previously- and newly-current ROI indices (either may be None).

Fields

§previous: Option<usize>
§current: Option<usize>
§

RoiInteractionModeChanged

A ROI’s handle-editing interaction mode changed, via the right-click interaction-mode submenu or PlotWidget::set_roi_interaction_mode (silx InteractionModeMixIn.sigInteractionModeChanged). Carries the ROI index and its new RoiInteractionMode.

Fields

§index: usize
§

MarkerMoved

A draggable marker was moved, either by an on-screen drag or by PlotWidget::set_marker_position (silx markerMoving / markerMoved). handle identifies the moved marker; read its new position with PlotWidget::marker_position.

Fields

§handle: ItemHandle
§

MarkerDragStarted

A draggable marker’s drag began this frame (silx beginDrag). The drag lifecycle is MarkerDragStartedMarkerMoved×N → MarkerDragFinished; the first Self::MarkerMoved arrives on the same frame. Read the position with PlotWidget::marker_position.

Fields

§handle: ItemHandle
§

MarkerDragFinished

A draggable marker’s drag ended this frame, i.e. the button was released (silx endDrag markerMoved). The marker’s final position is already persisted; read it with PlotWidget::marker_position.

Fields

§handle: ItemHandle
§

CurveClicked

A curve was clicked (silx curveClicked). handle identifies the curve; index/x/y locate the nearest picked vertex; button is the mouse button used.

Fields

§handle: ItemHandle
§index: usize
§

ImageClicked

An image was clicked (silx imageClicked). col/row are the picked pixel column and row.

Fields

§handle: ItemHandle
§col: u32
§row: u32
§

ItemClicked

A non-indexed overlay item (marker, scatter, or shape) was clicked (silx markerClicked and the generic item-pick path). Identify its kind with PlotWidget::item_kind.

Fields

§handle: ItemHandle
§

ItemHovered

The cursor hovered over an item with no button held (silx hover signal, prepareHoverSignal). Mirrors silx’s payload: kind is the item type, label its name, x/y the data-space cursor position, xpixel/ypixel the pixel cursor position, and draggable whether the item can be dragged (true only for a draggable marker). silx’s selectable flag is omitted: in siplot every pickable item is set active on click, so the flag would be a constant true carrying no information.

Fields

§handle: ItemHandle
§xpixel: f32
§ypixel: f32
§draggable: bool

Trait Implementations§

Source§

impl Clone for PlotEvent

Source§

fn clone(&self) -> PlotEvent

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PlotEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for PlotEvent

Source§

fn eq(&self, other: &PlotEvent) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PlotEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast for T
where T: Any,

Source§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
Source§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
Source§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
Source§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

Source§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Send + Sync>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SerializableAny for T
where T: 'static + Any + Clone + for<'a> Send + Sync,

Source§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

Source§

fn simd_from(value: T, _simd: S) -> T

Source§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

Source§

fn simd_into(self, simd: S) -> T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,