schrodinger.ui.qt.filter_dialog_dir.filter_widgets module¶
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.NumericOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.Enum
- BETWEEN = 'numeric_between'¶
- LESS = 'numeric_less'¶
- GREATER = 'numeric_greater'¶
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.TextOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.Enum
- CONTAINS = 'text_contains'¶
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BoolOperator(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
enum.Enum
- TRUE = 'bool_true'¶
- FALSE = 'bool_false'¶
- schrodinger.ui.qt.filter_dialog_dir.filter_widgets.adjust_min_max_values(min_val, max_val, decimals)¶
This function returns adjusted min/max values based on the number of decimal places that are displayed in widgets.
- Parameters
min_val (float, int or None) – original minimum value
max_val (float, int or None) – original maximum value
decimals (int) – number of decimal points to display in min/max spin boxes or the double slider (default value is 2)
- Returns
tuple that contains new minimum and maximum values
- Return type
tuple
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BaseCriterion(parent, prop, checked, removable)¶
Bases:
PyQt6.QtCore.QObject
Base class representing single property criterion and its widgets. Criterion widgets would include property checkbox, criterion type combo box, criterion limiter widget and a gear button. Subclasses should define criterion limiter widget since it changes with property type: dual slider or two spin boxes for numeric types, line edit for string type and none for boolean type.
- Variables
CRITERION_CHOICES – criterion choices that would be shown in the criterion type combo box, such as ‘between (inclusive)’ etc. This variable should be defined in subclasses.
criterionChanged – this signal is emitted when either property checkbox state is changed or new criterion type is selected.
removeCriterion – this signal is emitted when user clicks ‘Remove’ item in the gear menu.
- CRITERION_CHOICES = None¶
- criterionChanged¶
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.
- removeCriterion¶
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.
- __init__(parent, prop, checked, removable)¶
Initializer
- Parameters
parent (QtWidgets.QWidget) – parent widget
prop (str) – name of property used in this criterion
checked (bool) – indicates whether this criterion is ‘checked’.
removable (bool) – indicates whether this criterion can be removed from the filter widget.
- createWidgets()¶
Creates widgets used in this criterion. Here we create criterion type combo box and gear button. Limiter widget should be defined in subclasses.
- classmethod dataName2ViewName(prop)¶
Get a display/view/user name from a data name of a CT property.
- reset()¶
Reset criterion. Additional reset functionality should be implemented in subclasses.
- getLimits()¶
- setLimits(values)¶
- valueMatches(value)¶
Return True if the given value matches the criteria; False otherwise.
- Parameters
value (float, int, or str) – Value to test
- criterionTypeChanged()¶
This function is called when criterion type is changed. This function should be redefined in subclasses if any action should be taken.
- widgets()¶
Returns a list of widgets for this criterion.
- Returns
list of widgets
- Return type
list
- isChecked()¶
Returns True if this criterion is toggled on and False otherwise.
- Returns
check state of this criterion
- Return type
bool
- setChecked(checked: bool)¶
Set the property check box to either checked or unchecked.
- property prop_type¶
- setEnabled(enabled: bool)¶
Set all child widgets enabled/disabled.
- isEnabled() bool ¶
Return whether or not the child widgets are enabled/disabled.
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.NumericCriterion(parent, prop, checked, min_val, max_val, decimals=2, use_dual_slider=True, removable=True)¶
Bases:
schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BaseCriterion
Numeric type (float or int) property criterion that uses two spin box widgets or a dual slider.
- CRITERION_CHOICES = {'between (inclusive)': NumericOperator.BETWEEN, 'greater than': NumericOperator.GREATER, 'less than': NumericOperator.LESS}¶
- __init__(parent, prop, checked, min_val, max_val, decimals=2, use_dual_slider=True, removable=True)¶
Initializer
- Parameters
parent (QtWidgets.QWidget) – parent object
prop (str) – property name
min_val (int or float) – minimum value
max_val (int or float) – maximum value
decimals (int) – number of decimal points to display in min/max spin boxes or the double slider (default value is 2)
use_dual_slider (bool) – indicates whether dual slider widget should be used when ‘between (inclusive)’ type is selected.
removable (bool) – this argument indicates whether it should be possible to remove criterion from the widget.
- createWidgets()¶
See base class for documentation.
- reset()¶
Reset criterion. Additional reset functionality should be implemented in subclasses.
- getLimits()¶
Returns tuple that contains minimum and maximum values. When type is ‘less than’ minimum value is None. When type is ‘greater than’ maximum value is None. Will return None if a non-standard numeric operator is selected.
- Returns
minimum and maximum values or None
- Return type
tuple or None
- setLimits(values)¶
Set minimum and maximum values for this criterion.
- Parameters
values (tuple) – tuple that contains minimum and maximum values
- criterionTypeChanged()¶
This function is called when selection is changed in type combo box. Depending on criterion type it shows appropriate widgets.
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.StringCriterion(parent, prop, checked, removable)¶
Bases:
schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BaseCriterion
String property criterion. Renders as an entry field. Asterisk (*) means match anything. For example, “*” matches all values, and “1*0” will match 10, 1000, 150, etc. Question mark (?) matches any single character.
- CRITERION_CHOICES = {'contains': TextOperator.CONTAINS}¶
- createWidgets()¶
Creates widgets used in this criterion. Here we create criterion type combo box and gear button. Limiter widget should be defined in subclasses.
- reset()¶
Reset criterion. Additional reset functionality should be implemented in subclasses.
- getLimits()¶
Returns text of ‘contains’ text box.
- Returns
criterion text
- Return type
str
- setLimits(value)¶
Sets text that should be shown in ‘contains’ text box.
- Parameters
value (str) – criterion text
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BoolCriterion(parent, prop, checked, removable)¶
Bases:
schrodinger.ui.qt.filter_dialog_dir.filter_widgets.BaseCriterion
Bool property criterion. It does not have a limiter widget. Instead, limits is just either True or False depending on current selection in criterion choices combo box widget.
- CRITERION_CHOICES = {'has value False': BoolOperator.FALSE, 'has value True': BoolOperator.TRUE}¶
- reset()¶
Reset criterion. Additional reset functionality should be implemented in subclasses.
- getLimits()¶
Returns True or False depending on whether ‘has value True’ or ‘has value False’ option is selected in type combo box.
- Returns
boolean value for this criterion
- Return type
bool
- setLimits(value)¶
Sets boolean value for this criterion. This value is used to set selection in type combo box.
- Parameters
value (bool) – boolean value
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.CriteriaLayout¶
Bases:
PyQt6.QtWidgets.QGridLayout
Grid layout that contains widgets for the filter criteria.
- addCriterionRow(criterion)¶
Adds criterion widgets to the layout.
- Parameters
criterion (BaseCriterion) – criterion object that contains widgets that will be added to this layout.
- class schrodinger.ui.qt.filter_dialog_dir.filter_widgets.FilterWidget(parent=None, use_dual_slider=True, show_matches=True, removable=True, **kwargs)¶
Bases:
PyQt6.QtWidgets.QWidget
Filter widget that is used in filter dialogs.
- criteriaChanged¶
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.
- __init__(parent=None, use_dual_slider=True, show_matches=True, removable=True, **kwargs)¶
Class initializer.
- Parameters
parent (QWidget) – parent widget of this dialog.
use_dual_slider (bool) – indicates whether dual slider widget should be shown for ‘between (inclusive)’ type.
show_matches (bool) – determines whether label showing number of matches should be shown. We need to hide it when using filter dialog and no structures are available yet. For example, Custom R-group Enumeration GUI.
removable (bool) – indicates whether criteria should be ‘removable’.
- setup()¶
Instantiate tab widget and tabs.
- getCriteria()¶
Returns list of filtering criteria.
- Returns
criteria list
- Return type
list
- addCriterion(prop, limiter=None, checked=True)¶
Adds new criterion to this dialog.
- Parameters
prop (str) – property name
limiter (str or Tuple[int, int] or Tuple[float, float] or bool or None) – ‘limiter’ for this criterion, which is a filter string for str types, a range of values for int/real types and True or False value for boolean types.
checked (bool) – this argument indicates whether this criterion should be toggled on or off.
- removeCriterion(criterion_to_delete)¶
Removes given criterion from filter dialog.
- Parameters
criterion_to_delete (BaseCriterion) – criterion object
- updateFilterObj()¶
Updates filter object using current criteria settings.
- updateWidget(filter_obj, props_for_ligs)¶
Updates filter widget for the given filter object and properties present in the ligands.
- Parameters
filter_obj (Filter) – filter object
props_for_ligs (list(dict(str, object))) – list of property dictionaries that should be used to construct this filter
- addPropertyClicked()¶
Open a property selector dialog, for letting the user select a property to filter by.
- createCriterionForProp(prop, limiter, checked)¶
Create a criterion object for the give property, and initialize the valid range/values based on properties in self.values_by_prop.
- Parameters
prop (str) – property name
limiter (str or bool or tuple or None) – ‘limiter’ for this criterion, which is a filter string for str types, a range of values for int/real types and True or False value for boolean types.
checked (bool) – this argument indicates whether this criterion should be toggled on or off.
- resetAll()¶
Reset all criteria (show all ligands):
- updateMatchLabel()¶
Update the label at the bottom of the dialog box, showing how many ligands match all criteria.