jdxi_editor.ui.widgets.combo_box

Submodules

Classes

ComboBox

Custom ComboBox widget with label and value mapping.

SearchableFilterableComboBox

A reusable combo box widget with search, category, and bank filtering.

Package Contents

class jdxi_editor.ui.widgets.combo_box.ComboBox(label: str, options: list[str], values: list[int] | None = None, parent: object | None = None, show_label: bool = True, tooltip: str = '')[source]

Bases: PySide6.QtWidgets.QWidget

Custom ComboBox widget with label and value mapping.

valueChanged
options
values = None
label_widget
combo_box
_on_valueChanged(index: int) None[source]

Emit the corresponding value when the selected index changes.

Parameters:

index – int

setLabelVisible(visible: bool) None[source]

Show or hide the label dynamically.

Parameters:

visible – bool

setValue(value: int) None[source]

Set combo box index based on the value.

Parameters:

value – int

value() int[source]

Get current index

Returns:

int

class jdxi_editor.ui.widgets.combo_box.SearchableFilterableComboBox(label: str, options: List[str], values: List[int] | None = None, categories: List[str] | None = None, category_filter_func: Callable[[str, str], bool] | None = None, banks: List[str] | None = None, bank_filter_func: Callable[[str, str], bool] | None = None, show_label: bool = True, show_search: bool = True, show_category: bool = True, show_bank: bool = False, search_placeholder: str = 'Search...', category_label: str = 'Category:', bank_label: str = 'Bank:', search_label: str = 'Search:', use_analog_style: bool = False, parent: jdxi_editor.ui.common.QWidget | None = None)[source]

Bases: jdxi_editor.ui.common.QWidget

A reusable combo box widget with search, category, and bank filtering.

Maintains proper value mapping when filtered, ensuring MIDI commands are sent correctly regardless of filter state.

Features: - Text search filtering - Category/group filtering - Bank filtering (optional) - Unfilterable mode (show all items) - Proper value mapping for MIDI commands

valueChanged
_full_options
_full_values
_categories = []
_category_filter_func
_banks = []
_bank_filter_func
_filtered_to_original: List[int] = []
_current_search_text = ''
_current_category = ''
_current_bank = ''
category_combo = None
bank_combo = None
search_box: PySide6.QtWidgets.QLineEdit | None = None

add search

add_categories(category_label: str)[source]

add categories

add_banks(bank_label: str) PySide6.QtWidgets.QHBoxLayout[source]

add banks

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

set combo box dimensions

_create_search_row(search_label: str, search_placeholder: str, use_analog_style: bool) PySide6.QtWidgets.QHBoxLayout[source]

create search row

_default_category_filter(option: str, category: str) bool[source]

Default category filter function using substring matching.

Parameters:
  • option – Option string to check

  • category – Category string to match

Returns:

True if option matches category

_default_bank_filter(option: str, bank: str) bool[source]

Default bank filter function using substring matching. Checks if the bank letter appears at the start of the option (e.g., “A01 - Program Name”).

Parameters:
  • option – Option string to check

  • bank – Bank string to match

Returns:

True if option matches bank

_on_search_changed(text: str) None[source]

Handle search text change.

_on_category_changed(category: str) None[source]

Handle category selection change.

_on_bank_changed(bank: str) None[source]

Handle bank selection change.

_populate_combo() None[source]

Populate the combo box based on current filters.

_on_combo_index_changed(filtered_index: int) None[source]

Handle combo box index change.

Emits the original value (not the filtered index) to ensure MIDI commands use the correct value.

Parameters:

filtered_index – Index in the filtered combo box (may be int or str from Qt)

setValue(value: int) None[source]

Set the combo box to digital the option with the given value.

This method finds the original index of the value, then finds its position in the filtered list (if any), and sets the combo box index.

Parameters:

value – The value to set

value() int[source]

Get the currently selected value (original value, not filtered index).

Returns:

The original value corresponding to the selected option

clearFilters() None[source]

Clear all filters and show all items.

setLabelVisible(visible: bool) None[source]

Show or hide the main label.

setEnabled(enabled: bool) None[source]

Enable or disable the widget.

setVisible(visible: bool) None[source]

Show or hide the widget.

setLabel(label: str) None[source]

Set the main label text.

set_options(options: List[str], values: List[int] | None = None, categories: List[str] | None = None, category_filter_func: Callable[[str, str], bool] | None = None) None[source]

Update the combo box with new options, values, and optionally categories.

Parameters:
  • options – New list of option strings

  • values – New list of corresponding integer values (if None, uses indices)

  • categories – New list of category strings for filtering (optional)

  • category_filter_func – New category filter function (optional)

set_value(value: int) None[source]

Alias for setValue for consistency.

property options: List[str]

Get the full options list (for compatibility).

property values: List[int]

Get the full values list (for compatibility).