jdxi_editor.ui.widgets.editor.base

Editor Base Widget

This module provides the EditorBaseWidget class, which provides a common layout structure for all Editor Windows. Similar to how InstrumentPresetWidget provides common preset/image layout, this widget standardizes the overall editor structure.

Classes:

  • EditorBaseWidget: Base widget that provides common scrollable layout structure for all Editor Windows.

Features:

  • Standard scroll area + container layout

  • Tab widget creation and management

  • Consistent spacing and margins

  • Theme-aware styling (analog vs regular)

  • Flexible content addition (tabs or direct)

Usage Example:

# In an editor’s setup_ui() method:

# Option 1: Using tabs (like AnalogSynthEditor) base_widget = EditorBaseWidget(parent=self, analog=True) base_widget.setup_scrollable_content()

# Add preset widget as first tab base_widget.add_tab_section(“Presets”, self.instrument_preset)

# Add other sections as tabs base_widget.add_tab_section(“Oscillator”, self.oscillator_section) base_widget.add_tab_section(“Filter”, self.filter_section)

# Option 2: Direct content (like DigitalSynthEditor) base_widget = EditorBaseWidget(parent=self) base_widget.setup_scrollable_content()

# Add widgets directly to container base_widget.add_content_section(self.partials_panel) base_widget.add_content_section(self.instrument_preset)

# Then add a tab widget for partials base_widget.add_tab_section(“Partials”, self.partial_tab_widget)

# Option 3: Mixed approach base_widget = EditorBaseWidget(parent=self, analog=True) base_widget.setup_scrollable_content()

# Add some content directly base_widget.add_content_section(header_widget)

# Then add tabs base_widget.add_tab_section(“Section 1”, widget1) base_widget.add_tab_section(“Section 2”, widget2)

Classes

EditorBaseWidget

Base widget that provides common layout structure for all Editor Windows.

Module Contents

class jdxi_editor.ui.widgets.editor.base.EditorBaseWidget(parent: jdxi_editor.ui.common.QWidget | None = None, analog: bool = False)[source]

Bases: jdxi_editor.ui.common.QWidget

Base widget that provides common layout structure for all Editor Windows.

This widget standardizes the scrollable content area and tab structure used across all editors, reducing boilerplate and ensuring consistency.

analog = False[source]
scroll_area: PySide6.QtWidgets.QScrollArea | None = None[source]
container: jdxi_editor.ui.common.QWidget | None = None[source]
container_layout: jdxi_editor.ui.common.QVBoxLayout | None = None[source]
tab_widget: PySide6.QtWidgets.QTabWidget | None = None[source]
main_layout: jdxi_editor.ui.common.QVBoxLayout | None = None[source]
centered_wrapper: jdxi_editor.ui.common.QWidget | None = None[source]
setup_main_layout() jdxi_editor.ui.common.QVBoxLayout[source]

Set up the main vertical layout for the widget.

Returns:

The main layout

setup_scrollable_content(spacing: int = 5, margins: tuple[int, int, int, int] = (5, 5, 5, 5)) tuple[PySide6.QtWidgets.QScrollArea, jdxi_editor.ui.common.QVBoxLayout][source]

Set up the standard scrollable content area.

Creates a scroll area with a container widget and layout, following the common pattern used across all editors. The container is wrapped in an HBoxLayout with stretches on both sides for horizontal centering.

Parameters:
  • spacing – Spacing for the container layout

  • margins – Contents margins (left, top, right, bottom) for container layout

Returns:

Tuple of (scroll_area, container, container_layout)

create_tab_widget() PySide6.QtWidgets.QTabWidget[source]

Create and style a tab widget for organizing content.

Returns:

The created and styled QTabWidget

add_tab_section(title: str, widget: jdxi_editor.ui.common.QWidget) int[source]

Add a widget as a tab section.

Parameters:
  • title – Tab title

  • widget – Widget to add as tab content

Returns:

Index of the added tab

add_content_section(widget: jdxi_editor.ui.common.QWidget) None[source]

Add a widget directly to the container layout (not as a tab).

Parameters:

widget – Widget to add

add_stretch() None[source]

Add stretch to the container layout for spacing.

Useful for vertical centering or pushing content to top.

insert_content_section(index: int, widget: jdxi_editor.ui.common.QWidget) None[source]

Insert a widget at a specific position in the container layout.

Parameters:
  • index – Position to insert at

  • widget – Widget to insert

add_centered_content(widget: jdxi_editor.ui.common.QWidget) None[source]

Add a widget centered horizontally in the container.

This method wraps the widget in a horizontal layout with stretch on both sides, creating a centered appearance. Useful for editors that use centered layouts (like Arpeggiator and Effects editors).

Parameters:

widget – Widget to add centered

get_scroll_area() PySide6.QtWidgets.QScrollArea | None[source]

Get the scroll area widget.

Returns:

The scroll area, or None if not yet created

get_container() jdxi_editor.ui.common.QWidget | None[source]

Get the container widget.

Returns:

The container widget, or None if not yet created

get_container_layout() jdxi_editor.ui.common.QVBoxLayout | None[source]

Get the container layout.

Returns:

The container layout, or None if not yet created

get_tab_widget() PySide6.QtWidgets.QTabWidget | None[source]

Get the tab widget.

Returns:

The tab widget, or None if not yet created