jdxi_editor.ui.widgets.combo_box ================================ .. py:module:: jdxi_editor.ui.widgets.combo_box Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/jdxi_editor/ui/widgets/combo_box/combo_box/index /autoapi/jdxi_editor/ui/widgets/combo_box/searchable_filterable/index /autoapi/jdxi_editor/ui/widgets/combo_box/synchronizer/index Classes ------- .. autoapisummary:: jdxi_editor.ui.widgets.combo_box.ComboBox jdxi_editor.ui.widgets.combo_box.SearchableFilterableComboBox Package Contents ---------------- .. py:class:: ComboBox(label: str, options: list[str], values: list[int] | None = None, parent: object | None = None, show_label: bool = True, tooltip: str = '') Bases: :py:obj:`PySide6.QtWidgets.QWidget` Custom ComboBox widget with label and value mapping. .. py:attribute:: valueChanged .. py:attribute:: options .. py:attribute:: values :value: None .. py:attribute:: label_widget .. py:attribute:: combo_box .. py:method:: _on_valueChanged(index: int) -> None Emit the corresponding value when the selected index changes. :param index: int .. py:method:: setLabelVisible(visible: bool) -> None Show or hide the label dynamically. :param visible: bool .. py:method:: setValue(value: int) -> None Set combo box index based on the value. :param value: int .. py:method:: value() -> int Get current index :return: int .. py:class:: SearchableFilterableComboBox(label: str, options: List[str], values: Optional[List[int]] = None, categories: Optional[List[str]] = None, category_filter_func: Optional[Callable[[str, str], bool]] = None, banks: Optional[List[str]] = None, bank_filter_func: Optional[Callable[[str, str], bool]] = 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: Optional[jdxi_editor.ui.common.QWidget] = None) Bases: :py:obj:`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 .. py:attribute:: valueChanged .. py:attribute:: _full_options .. py:attribute:: _full_values .. py:attribute:: _categories :value: [] .. py:attribute:: _category_filter_func .. py:attribute:: _banks :value: [] .. py:attribute:: _bank_filter_func .. py:attribute:: _filtered_to_original :type: List[int] :value: [] .. py:attribute:: _current_search_text :value: '' .. py:attribute:: _current_category :value: '' .. py:attribute:: _current_bank :value: '' .. py:attribute:: category_combo :value: None .. py:attribute:: bank_combo :value: None .. py:attribute:: search_box :type: Optional[PySide6.QtWidgets.QLineEdit] :value: None .. py:method:: add_search(search_label: str, search_placeholder: str, use_analog_style: bool) -> Any add search .. py:method:: add_categories(category_label: str) add categories .. py:method:: add_banks(bank_label: str) -> PySide6.QtWidgets.QHBoxLayout add banks .. py:method:: set_combo_dimensions(widget: jdxi_editor.ui.common.QWidget) set combo box dimensions .. py:method:: _create_search_row(search_label: str, search_placeholder: str, use_analog_style: bool) -> PySide6.QtWidgets.QHBoxLayout create search row .. py:method:: _default_category_filter(option: str, category: str) -> bool Default category filter function using substring matching. :param option: Option string to check :param category: Category string to match :return: True if option matches category .. py:method:: _default_bank_filter(option: str, bank: str) -> bool Default bank filter function using substring matching. Checks if the bank letter appears at the start of the option (e.g., "A01 - Program Name"). :param option: Option string to check :param bank: Bank string to match :return: True if option matches bank .. py:method:: _on_search_changed(text: str) -> None Handle search text change. .. py:method:: _on_category_changed(category: str) -> None Handle category selection change. .. py:method:: _on_bank_changed(bank: str) -> None Handle bank selection change. .. py:method:: _populate_combo() -> None Populate the combo box based on current filters. .. py:method:: _on_combo_index_changed(filtered_index: int) -> None Handle combo box index change. Emits the original value (not the filtered index) to ensure MIDI commands use the correct value. :param filtered_index: Index in the filtered combo box (may be int or str from Qt) .. py:method:: setValue(value: int) -> None 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. :param value: The value to set .. py:method:: value() -> int Get the currently selected value (original value, not filtered index). :return: The original value corresponding to the selected option .. py:method:: clearFilters() -> None Clear all filters and show all items. .. py:method:: setLabelVisible(visible: bool) -> None Show or hide the main label. .. py:method:: setEnabled(enabled: bool) -> None Enable or disable the widget. .. py:method:: setVisible(visible: bool) -> None Show or hide the widget. .. py:method:: setLabel(label: str) -> None Set the main label text. .. py:method:: set_options(options: List[str], values: Optional[List[int]] = None, categories: Optional[List[str]] = None, category_filter_func: Optional[Callable[[str, str], bool]] = None) -> None Update the combo box with new options, values, and optionally categories. :param options: New list of option strings :param values: New list of corresponding integer values (if None, uses indices) :param categories: New list of category strings for filtering (optional) :param category_filter_func: New category filter function (optional) .. py:method:: set_value(value: int) -> None Alias for setValue for consistency. .. py:property:: options :type: List[str] Get the full options list (for compatibility). .. py:property:: values :type: List[int] Get the full values list (for compatibility).