schrodinger.ui.qt.multi_combo_box module¶
- class schrodinger.ui.qt.multi_combo_box.MacMultiComboBoxStyle¶
- Bases: - PyQt6.QtWidgets.QProxyStyle- subControlRect(control, option, subControl, widget)¶
- On Mac, add extra width to the popup for the checkbox. 
 
- class schrodinger.ui.qt.multi_combo_box.MultiComboBox(parent=None, include_all_and_none=False, delimiter=', ')¶
- Bases: - PyQt6.QtWidgets.QComboBox- A combo box that allows multiple items to be selected. Check marks are put next to each selected item. - Variables
- selectionChanged ( - PyQt5.QtCore.pyqtSignal) – A signal emitted whenever an item is selected or deselected.
 - selectionChanged¶
- A - pyqtSignalemitted by instances of the class.
 - popupClosed¶
- A - pyqtSignalemitted by instances of the class.
 - __init__(parent=None, include_all_and_none=False, delimiter=', ')¶
- Parameters
- parent ( - PyQt5.QtWidgets.QWidget) – The Qt parent widget
- include_all_and_none (bool) – Whether “All” and “None” options should be added to the top of the item list. 
- delimiter (str) – The delimiter to use when listing all selected items 
 
 
 - showPopup(self)¶
 - eventFilter(self, a0: Optional[QObject], a1: Optional[QEvent]) bool¶
 - addOneItem(text, checkable=True)¶
- Add item with the given text to the combo menu, and return the the QStandardItem object for it. 
 - addItems(self, texts: Iterable[Optional[str]])¶
 - addAllAndNone()¶
- Append “All” and “None” options to the item list 
 - setDelimiter(delimiter)¶
- Change the delimiter used when listing all selected items - Parameters
- delimiter (str) – The delimeter to use 
 
 - selectAllItems()¶
- Select all listed items 
 - clearSelection()¶
- Deselect all listed items 
 - setAllItemsSelected(selected=True)¶
- Select or deselect all listed items - Parameters
- selected (bool) – Whether to select or deselect 
 
 - setItemSelected(item, selected=True)¶
- Set the selection status of the specified item - Parameters
- item (str) – The item to modify 
- selected (bool) – Whether to select or deselect 
 
- Raises
- ValueError – If the specified item does not exist or if it’s “All” or “None” 
 
 - setIndexSelected(index, selected=True)¶
- Set the selection status of the specified index - Parameters
- index (int) – The index of the item to modify 
- selected (bool) – Whether to select or deselect 
 
- Raises
- ValueError – IF the specified index corresponds to “All” or “None” 
 
 - isIndexSelected(index)¶
- Parameters
- index (int) – The index of the item to check. 
- Returns
- Whether the item is selected/checked. 
- Return type
- bool 
 
 - setIndexEnabled(index, enable)¶
- Set the enable state of the specified index. - Parameters
- index (int) – The index of the item to modify 
- enable (bool) – Whether to enable or not. 
 
 
 - isIndexEnabled(index)¶
- Return the enabled status for the given index. - Parameters
- index (int) – The index of the item to check. 
- Returns
- Whether the item is enabled. 
- Return type
- bool 
 
 - setSelectedItems(items)¶
- Select the specified items. All other items will be deselected. - Parameters
- items (list) – The list of items to select (as strings) 
- Raises
- ValueError – If any specified item does not exist 
 
 - setSelectedIndexes(indexes)¶
- Select the specified indexes. All other items will be deselected. - Parameters
- indexes (list) – The list of indexes to select (as ints) 
 
 - getSelectedItems()¶
- Return a list of all selected items - Returns
- All selected items (as strings) 
- Return type
- list 
 
 - items()¶
- Return a list of all item texts except “All” and “None” - Returns
- All items texts except “All” and “None” 
- Return type
- list 
 
 - getSelectedIndexes()¶
- Return a list of all selected indexes - Returns
- All selected indexes (as ints) 
- Return type
- list 
 
 - getSelectedStandardItems()¶
- Return a list of QStandardItem objects for all items that are checked on (selected) in this combo menu. 
 - getAllStandardItems()¶
- Return a list of QStandardItem objects for all items in this combo. 
 - currentText(self) str¶
 - paintEvent(event)¶
- See Qt documentation for method documentation - Note
- The C++ paintEvent() and initStyleOption() methods won’t call a Python implementation of currentText() or initStyleOption(), presumably due to a bug in PyQt. To get around this, we reimplement the paintEvent() method in Python and force it to call the Python currentText() method 
 
 - clear(keep_all_and_none=True)¶
- Clear all items from the combo box - Parameters
- keep_all_and_none (bool) – If True, the “All” and “None” items added via - addAllAndNonewill be kept
 
 - removeItem(self, index: int)¶
 - addAndSelectItem(text)¶
- Add a new item with the specified text and select it - Parameters
- text (str) – The text of the item to add 
 
 - af2SettingsGetValue()¶
- This function adds support for the settings mixin. It allows to save checked item states in case this combo box is included in a settings panel. - Returns
- List of selected rows. 
- Return type
- list 
 
 - af2SettingsSetValue(indexes)¶
- This function adds support for the settings mixin. It allows to set combo box check states when this table is included in a settings panel. - Parameters
- indexes (list) – List of rows to check.