playnano.gui.main module

Start the playNano GUI (playnano play).

playnano.gui.main.ICON_SIZES: tuple[int, ...] = (16, 32, 48, 64, 128, 256, 512)

Pixel sizes of the bundled application icon PNGs. The 16 and 32 px icons are simplified, pixel-aligned versions of the logo; larger sizes use the full mark.

playnano.gui.main.WINDOWS_APP_ID = 'playnano.gui'

Windows taskbar identity for the GUI process (see _set_windows_app_id).

playnano.gui.main.gui_entry(afm_stack, output_dir=None, output_name='', steps_with_kwargs=None, scale_bar_nm=100, zmin='auto', zmax='auto', cmap='afm_brown', fps=5.0)[source]

Open the playNano window for a stack and run it until it is closed.

Called by playnano play (see playnano.cli.actions.play_pipeline_mode()). It creates the Qt application, applies the dark stylesheet and shows a MainWindow.

Parameters:
  • afm_stack (AFMImageStack) – The stack to show.

  • output_dir (str, optional) – Folder for exports. If None, ./output. Default is None.

  • output_name (str, optional) – Start of the exported file names. If empty, the name of the file the stack was loaded from. Default is "".

  • steps_with_kwargs (list of tuple, optional) – Processing steps, as (name, parameters), run when F is pressed. If None or empty, F runs a built-in default pipeline. Default is None.

  • scale_bar_nm (int, optional) – Scale bar length, in nm; 0 opens the window with the scale bar off. Default is 100.

  • zmin (float or str, optional) – Initial colour scale limits: a number, "auto" (1st and 99th percentiles) or None (data minimum or maximum). Default is "auto".

  • zmax (float or str, optional) – Initial colour scale limits: a number, "auto" (1st and 99th percentiles) or None (data minimum or maximum). Default is "auto".

  • cmap (str, optional) – Colormap the window opens with. Names not in the window’s list are replaced by "afm_brown", with a warning. Default is "afm_brown".

  • fps (float, optional) – Initial playback rate, in frames per second; also used for animated exports. Default is 5.0.

Raises:

SystemExit – Always, when the window is closed, with Qt’s exit status. The function never returns, so it cannot be used from a notebook.

playnano.gui.main.load_app_icon() → QIcon[source]

Build the playNano application icon from the bundled PNG files.

Each size is added separately so Qt picks the hand-tuned bitmap for small sizes (title bar, taskbar) instead of downscaling a large image.

Returns:

The icon. It is empty (QIcon.isNull()) if no icon files were found, in which case a warning is logged.

Return type:

PySide6.QtGui.QIcon