schrodinger.ui.qt.recent_completer module

class schrodinger.ui.qt.recent_completer.StringListModelInterface(prefkey=None, suggestion_limit=20)

Bases: object

Interface for Qt classes that can use a QStringListModel.

You add to the QStringListModel by calling addSuggestion. If a prefkey is passed to the init, then these suggestions will be stored in Maestro, and reloaded next time the widget is created

MODEL_CLASS

alias of PyQt6.QtCore.QStringListModel

__init__(prefkey=None, suggestion_limit=20)
Parameters
  • prefkey (str or None) – if defined, a unique string that defines where this object’s suggestions can be saved to and loaded from persistently

  • suggestion_limit – the maximum number of suggestions that this object will store; must be a nonnegative integer or None

property suggestion_limit
Returns

the maximum number of completion suggestions that this object will remember; if None, there is no limit.

Return type

int or None

setSuggestions(suggestions)

Replace the current set of completion suggestions with the supplied values.

Parameters

suggestions – a new list of completion suggestions to set on this object

Rtype suggestions

list(str)

addSuggestion(new_suggestion)

Add a new completion suggestion to this object. If it already exists in this object, put it to the top of the list to indicate that it the most recent suggestion.

Parameters

new_suggestion (str) – a new completion suggestion

setModelStringList(suggestions)

Replace the contents of the model with the new list of suggestions.

Parameters

suggestions (list[str]) – The new model contents.

class schrodinger.ui.qt.recent_completer.RecentCombo

Bases: PyQt6.QtWidgets.QComboBox, schrodinger.ui.qt.recent_completer.StringListModelInterface

A QComboBox which is able to store its past values in Maestro persistent settings. You add to this combobox by using addSuggestion.

When adding a suggestion, the model gets reset in the process, which will clear selection and emit a signal indicating that the selection has changed.

setModelStringList(suggestions)

Replace the contents of the model with the new list of suggestions. This method always clears the combo box selection, which mimics the Qt 5 behavior. (In Qt 6, calling setStringList directly would select the first item due to the behavior change from https://bugreports.qt.io/browse/QTBUG-80998.)

Parameters

suggestions (list[str]) – The new model contents.

class schrodinger.ui.qt.recent_completer.RecentCompleter

Bases: PyQt6.QtWidgets.QCompleter, schrodinger.ui.qt.recent_completer.StringListModelInterface

A QLineEdit completer that can remember a limited number of completion suggestions, and optionally retain completion suggestions persistently.

class schrodinger.ui.qt.recent_completer.PlaceholderRecentCombo

Bases: schrodinger.ui.qt.standard_widgets.combo_boxes.ItalicsPlaceholderComboBox, schrodinger.ui.qt.recent_completer.RecentCombo

A RecentCombo which enables persistent options as well as placeholder text

class schrodinger.ui.qt.recent_completer.SeparatorStringModel

Bases: PyQt6.QtCore.QStringListModel

A QStringList model which supports separator. Subclass needs to add the separator at desired position using ‘setStringList’ method.

data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any
isSeparator(index)

Returns True if the item corresponding to the given index is a separator

flags(index)

The separator row should not be enabled or selectable

class schrodinger.ui.qt.recent_completer.BrowseStringModel

Bases: schrodinger.ui.qt.recent_completer.SeparatorStringModel

A QStringList model which adds a separator and a browse option for comboboxes that need a browse button appended to the end

Variables

BROWSE (str) – Text for browse option.

BROWSE = 'Browse...'
stringList()

Return the string list, not including the separator and browse :return:

setStringList(strings)

When setting a string list, add a separator and browse option

class schrodinger.ui.qt.recent_completer.BrowsePlaceholderRecentCombo(*args, **kwargs)

Bases: schrodinger.ui.qt.recent_completer.PlaceholderRecentCombo

A PlaceholderRecentCombo which always keeps a Browse option at the bottom.

Variables

browseSelected – A signal emitted when the browse option in the combobox is selected.

browseSelected

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

MODEL_CLASS

alias of schrodinger.ui.qt.recent_completer.BrowseStringModel

__init__(*args, **kwargs)
class schrodinger.ui.qt.recent_completer.BrowseAndCreateStringModel

Bases: schrodinger.ui.qt.recent_completer.SeparatorStringModel

A QStringList model which adds a separator, a browse option and a ‘create new’ option for comboboxes. ‘Browse’ and ‘create new’ options are appended to the end of the list.

Variables

BROWSE (str) – Text for browse option.

BROWSE = 'Browse File...'
CREATE_NEW = 'Create New...'
stringList()

Return the string list, not including the separator and browse :return:

setStringList(strings)

When setting a string list, add a separator and browse option

class schrodinger.ui.qt.recent_completer.BrowseAndCreateCombo(*args, **kwargs)

Bases: schrodinger.ui.qt.recent_completer.PlaceholderRecentCombo

A PlaceholderRecentCombo which always keeps a Browse option at the bottom.

Variables

browseSelected – A signal emitted when the browse option in the combobox is selected.

browseSelected

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

createNewSelected

pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL

types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.

MODEL_CLASS

alias of schrodinger.ui.qt.recent_completer.BrowseAndCreateStringModel

__init__(*args, **kwargs)