pyqt_reactive.widgets.shared.button_panel

Reusable button panel with declarative configuration.

Extracted from AbstractManagerWidget to allow any widget to use the same button panel pattern without inheriting from the full manager.

Example

# Declarative configuration BUTTON_CONFIGS = [

(“Refresh”, “refresh”, “Refresh the display”), (“Toggle”, “toggle_layout”, “Toggle layout mode”),

]

# Create panel panel = ButtonPanel(

button_configs=self.BUTTON_CONFIGS, style_generator=self.style_generator, on_action=self.handle_button_action

)

Classes

ButtonPanel(button_configs, on_action[, ...])

Reusable button panel with declarative configuration.

class pyqt_reactive.widgets.shared.button_panel.ButtonPanel(button_configs: List[Tuple[str, str, str]], on_action: Callable[[str], None], style_generator=None, grid_columns: int = 0, parent: QWidget | None = None)[source]

Reusable button panel with declarative configuration.

Uses BUTTON_CONFIGS format: [(label, action_id, tooltip), …] Supports grid layout with configurable columns.

__init__(button_configs: List[Tuple[str, str, str]], on_action: Callable[[str], None], style_generator=None, grid_columns: int = 0, parent: QWidget | None = None)[source]

Initialize button panel.

Parameters:
  • button_configs – List of (label, action_id, tooltip) tuples

  • on_action – Callback function(action_id) when button is clicked

  • style_generator – Optional style generator for button styling

  • grid_columns – Number of columns (0 = single row)

  • parent – Parent widget

set_button_enabled(action_id: str, enabled: bool)[source]

Enable or disable a button by action_id.

set_button_text(action_id: str, text: str)[source]

Update button text by action_id.

get_button(action_id: str) QPushButton | None[source]

Get button widget by action_id.