pynaviz.qt.widget_menu#

Action and context classes

This module provides custom Qt widgets to create interactive menus for plots. Each menu allows the user to configure plot-specific behavior using GUI components such as dropdowns, spin boxes, and list views. The widgets are dynamically constructed based on metadata and plotting context.

Main Classes: - DropdownDialog: Dynamically generates a dialog with labeled input widgets. - MenuWidget: UI component to attach interactive actions and selections to a plot.

Functions

widget_factory(parameters)

Constructs a QWidget (QComboBox or QDoubleSpinBox) with specified parameters.

Classes

DropdownDialog(title, widgets, func[, ...])

A popup dialog that dynamically creates widgets from metadata and applies a callback.

MenuWidget(metadata, plot[, interval_sets, ...])

Menu bar widget that allows all possible actions

class pynaviz.qt.widget_menu.DropdownDialog(title, widgets, func, ok_cancel_button=False, parent=None)[source]#

Bases: QDialog

A popup dialog that dynamically creates widgets from metadata and applies a callback.

Parameters:
  • title (str) – Title of the dialog window.

  • widgets (OrderedDict[str, dict]) – Keys are labels; values are widget parameter dictionaries.

  • func (Callable) – Function to call when selections are made.

  • ok_cancel_button (bool, optional) – Whether to display OK/Cancel buttons (default is False).

  • parent (QWidget, optional) – Parent widget.

accept()[source]#

Override accept to call plot update before closing.

Return type:

None

get_selections()[source]#

Extracts current selections from the widgets.

Returns:

List of selected values from each widget.

Return type:

list

item_changed()[source]#

Callback triggered when a widget value changes.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("DropdownDialog" inherits "QDialog": )#
update_plot()[source]#

Calls the provided function with current widget values.

Return type:

None

class pynaviz.qt.widget_menu.MenuWidget(metadata, plot, interval_sets=None, tsdframes=None)[source]#

Bases: QWidget

Menu bar widget that allows all possible actions

Parameters:
  • metadata (dict or pd.DataFrame or None) – Metadata associated with the plot.

  • plot (_BasePlot) – The plot instance this menu is attached to.

  • interval_sets (dict, optional) – Dictionary of interval sets that can be added to the plot. Specific to Tsd, TsdFrame and TsGroup plots.

  • tsdframes (dict, optional) – TsdFrame object for overlaying on TsdTensor plot or VideoWidget plot.

jump_next()[source]#

Jump to the next timestamp or start

Return type:

None

jump_previous()[source]#

Jump to the previous timestamp or start

Return type:

None

show_action_menu()[source]#

Displays the action menu below the button.

Return type:

None

show_overlay_menu(popup_name)[source]#

Opens the TsdFrame overlay selection dialog.

Return type:

None

show_select_iset_menu()[source]#

Opens the interval set selection dialog.

Return type:

None

show_select_menu()[source]#

Opens the channel list selection dialog.

Return type:

None

staticMetaObject = PySide6.QtCore.QMetaObject("MenuWidget" inherits "QWidget": )#
pynaviz.qt.widget_menu.widget_factory(parameters)[source]#

Constructs a QWidget (QComboBox or QDoubleSpinBox) with specified parameters.

Parameters:

parameters (dict) – Dictionary containing widget configuration.

Returns:

The configured widget instance.

Return type:

QWidget