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.
ItemUpdated
An item’s data was updated in place.
ItemRemoved
An item was removed from the plot.
ActiveItemChanged
The selected item changed (via legend click or PlotWidget::set_active_item).
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.
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.
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.
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.
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.
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).
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.
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).
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.
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: ItemHandleMarkerDragStarted
A draggable marker’s drag began this frame (silx beginDrag). The drag
lifecycle is MarkerDragStarted → MarkerMoved×N → MarkerDragFinished;
the first Self::MarkerMoved arrives on the same frame. Read the
position with PlotWidget::marker_position.
Fields
handle: ItemHandleMarkerDragFinished
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: ItemHandleCurveClicked
A curve was clicked (silx curveClicked). handle identifies the
curve; index/x/y locate the nearest picked vertex; button is the
mouse button used.
ImageClicked
An image was clicked (silx imageClicked). col/row are the picked
pixel column and row.
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.
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.
Trait Implementations§
impl StructuralPartialEq for PlotEvent
Auto Trait Implementations§
impl Freeze for PlotEvent
impl RefUnwindSafe for PlotEvent
impl Send for PlotEvent
impl Sync for PlotEvent
impl Unpin for PlotEvent
impl UnsafeUnpin for PlotEvent
impl UnwindSafe for PlotEvent
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
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>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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)
fn as_any(&self) -> &(dyn Any + 'static)
&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)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.