playNano.gui.widgets package

Submodules

playNano.gui.widgets.controls module

Defines ViewerWidget, a Qt widget for viewing AFM height map stacks.

The data is viewed as a resizable image with optional timestamp, scale-bar and “RAW” label overlays. Playback controls allow video playback of a image stack.

Classes

ViewerWidget

QWidget subclass that renders one frame of AFM data and draws annotations.

class playNano.gui.widgets.controls.PlaybackControls(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Widget containing playback controls; play button, slider, and FPS control.

playNano.gui.widgets.viewer module

GUI widget for viewing AFM video data.

class playNano.gui.widgets.viewer.ViewerWidget(*args: Any, **kwargs: Any)[source]

Bases: QWidget

Displays AFM height maps as a resizable image with optional overlays.

display_frame(arr: ndarray)[source]

Load and show a new RGB frame.

Parameters:

arr (np.ndarray) – 3D uint8 array of shape (H, W, 3) containing the RGB image data.

Return type:

None

paintEvent(event)[source]

Create custom paint handler: draws background, frame, and overlays.

Parameters:

event (QPaintEvent) – The Qt paint event.

Notes

  • Fills the widget rectangle with the background color.

  • Centers and draws the scaled pixmap, if any.

  • Optionally overlays timestamp, “RAW” label, and scale bar.

Return type:

None

resizeEvent(event: PySide6.QtGui.QResizeEvent)[source]

Handle widget resize: recompute scaled pixmap size.

Parameters:

event (QResizeEvent) – The Qt resize event.

Return type:

None

set_annotation_font(font: PySide6.QtGui.QFont)[source]

Override the font used for drawing text overlays.

Parameters:

font (QFont) – A Qt font object.

Return type:

None

set_annotations(timestamp: float | None, draw_ts: bool, draw_scale: bool, draw_raw_label: bool, pixel_size_nm: float | None, scale_bar_nm: int | None)[source]

Update which overlays to draw on each frame.

Parameters:
  • timestamp (float or None) – The time (in seconds) to display, or None.

  • draw_ts (bool) – Whether to show the timestamp.

  • draw_scale (bool) – Whether to show a scale bar.

  • draw_raw_label (bool) – Whether to draw a “RAW” label.

  • pixel_size_nm (float or None) – Nanometers per pixel (needed to size the scale bar).

  • scale_bar_nm (int or None) – Physical length (nm) of the scale bar to draw.

Return type:

None

set_background_color(rgb: tuple[int, int, int])[source]

Change the widget’s background fill color.

Parameters:

rgb (tuple of int) – (R, G, B) values in the range [0…255].

Return type:

None

Module contents

Public package initialization.