jdxi_editor.ui.widgets.editor.base ================================== .. py:module:: jdxi_editor.ui.widgets.editor.base .. autoapi-nested-parse:: 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 ------- .. autoapisummary:: jdxi_editor.ui.widgets.editor.base.EditorBaseWidget Module Contents --------------- .. py:class:: EditorBaseWidget(parent: Optional[jdxi_editor.ui.common.QWidget] = None, analog: bool = False) Bases: :py:obj:`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. .. py:attribute:: analog :value: False .. py:attribute:: scroll_area :type: Optional[PySide6.QtWidgets.QScrollArea] :value: None .. py:attribute:: container :type: Optional[jdxi_editor.ui.common.QWidget] :value: None .. py:attribute:: container_layout :type: Optional[jdxi_editor.ui.common.QVBoxLayout] :value: None .. py:attribute:: tab_widget :type: Optional[PySide6.QtWidgets.QTabWidget] :value: None .. py:attribute:: main_layout :type: Optional[jdxi_editor.ui.common.QVBoxLayout] :value: None .. py:attribute:: centered_wrapper :type: Optional[jdxi_editor.ui.common.QWidget] :value: None .. py:method:: setup_main_layout() -> jdxi_editor.ui.common.QVBoxLayout Set up the main vertical layout for the widget. :return: The main layout .. py:method:: 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] 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. :param spacing: Spacing for the container layout :param margins: Contents margins (left, top, right, bottom) for container layout :return: Tuple of (scroll_area, container, container_layout) .. py:method:: create_tab_widget() -> PySide6.QtWidgets.QTabWidget Create and style a tab widget for organizing content. :return: The created and styled QTabWidget .. py:method:: add_tab_section(title: str, widget: jdxi_editor.ui.common.QWidget) -> int Add a widget as a tab section. :param title: Tab title :param widget: Widget to add as tab content :return: Index of the added tab .. py:method:: add_content_section(widget: jdxi_editor.ui.common.QWidget) -> None Add a widget directly to the container layout (not as a tab). :param widget: Widget to add .. py:method:: add_stretch() -> None Add stretch to the container layout for spacing. Useful for vertical centering or pushing content to top. .. py:method:: insert_content_section(index: int, widget: jdxi_editor.ui.common.QWidget) -> None Insert a widget at a specific position in the container layout. :param index: Position to insert at :param widget: Widget to insert .. py:method:: add_centered_content(widget: jdxi_editor.ui.common.QWidget) -> None 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). :param widget: Widget to add centered .. py:method:: get_scroll_area() -> Optional[PySide6.QtWidgets.QScrollArea] Get the scroll area widget. :return: The scroll area, or None if not yet created .. py:method:: get_container() -> Optional[jdxi_editor.ui.common.QWidget] Get the container widget. :return: The container widget, or None if not yet created .. py:method:: get_container_layout() -> Optional[jdxi_editor.ui.common.QVBoxLayout] Get the container layout. :return: The container layout, or None if not yet created .. py:method:: get_tab_widget() -> Optional[PySide6.QtWidgets.QTabWidget] Get the tab widget. :return: The tab widget, or None if not yet created