schrodinger.maestro_utils.surface_manager.dropdown_push_button module

class schrodinger.maestro_utils.surface_manager.dropdown_push_button.DropdownPushButton(parent: QWidget = None, display_text_in_button: bool = True)

Bases: QPushButton

A reusable QPushButton subclass that creates and manages a dropdown menu.

This class handles menu creation and item selection

Variables:
  • itemSelected – Signal emitted with the selected item’s text when an item is chosen from the dropdown.

  • currentTextChanged – Signal emitted when the current text is changed.

itemSelected

A pyqtSignal emitted by instances of the class.

currentTextChanged

A pyqtSignal emitted by instances of the class.

__init__(parent: QWidget = None, display_text_in_button: bool = True)

Initialize the DropdownPushButton.

Parameters:
  • parent – Parent widget

  • display_text_in_button – Whether to show selected text in the button

populateDropdown(items: list[str])

Populate the dropdown with a list of items.

Parameters:

items (list[str]) – List of strings to populate in the dropdown

clearSelection()

Clear the current selection in the dropdown.

setCurrentText(text: str)

Set the current text of the button and check the corresponding action in the menu.

Parameters:

text – Text to set as current

setText(text: str) None

Set the button text and emit currentTextChanged signal.

Parameters:

text – Text to set on the button

setActionEnabled(text: str, enabled: bool) None

Enable or disable a specific action in the dropdown menu by its text.

Parameters:
  • text – The text of the action to enable or disable

  • enabled – True to enable the action, False to disable it