schrodinger.ui.propertyselector module

A PropertySelector Frame class for viewing and selecting properties.

Pass the widget a list of properties (via the constructor or the setProperties() method), and then extract properties selected by the user with the getSelected() method.

PropertySelector will display properties without the type (e.g., i_, s_) or owner/family (e.g., mmod_, sd_) tags, for readability. The list of properties displayed can be limited to a single family.

The listbox component can be set to multiple or single selection with the boolean “multi” initialization option.

Copyright Schrodinger, LLC. All rights reserved.

class schrodinger.ui.propertyselector.PropertySelector(*args, **kwargs)

Bases: schrodinger.ui.widget.tkinterwidget.Frame

Class for selecting properties, with features to organize by family/owner, filter by name, and/or sort items in the list. The PropertySelector displays a list of property user names, specified as structure.PropertyName objects.

Duplicate user names are distinguished by creating a PropertyName.user_name attribute to with a unique numerical id suffix. e.g. foo, foo-1, foo-2. The name checking is done once, at __init__.

None

displayed_proplist (list)
List of PropertyNames currently displayed in the (primary) listbox, in the order they appear in the list. This is typically a subset of self.proplist.
propfamilies (dict)
Family name keys for a list of structure.PropertyName instances in that roup.
displayed_aux_proplist (list)
List of PropertyNames currently displayed in the auxilary listbox, in the order they appear in the list. This is typically a subset of self.proplist.
selected_not_displayed_proplist (list)
List of PropertyNames for item not currently displayed due to family menu or field regex filtering.
move_to_aux (bool)
If True, items will be moved from main table to auxilary table when they are selected. If false, they will be duplicated in both tables if selected (default False)
addToAuxListbox()

Adds items selected in self.listbox to self.aux_listbox.

alphabetizeNames()

Alternate order the displayed list items, either alphabetically or in the native order depending on the value of self.alpha_var.

checkUserNames()

Assigns PropertyName.user_name attributes, for all members in self.proplist. The user_names are unique within the PropertySelector instance.

The user_name strings are typically just the PropertyName.userName(), but may be modified with a numerical suffix to make them unique, or decorated with the family name (which does not garuntee uniqeness, but may make the items easier for the end user to visually group).

clear()

Clear property selection

createFamilies()

Create a dictionary of families. PropertyName.family keys for a list of PropertyNames in that family.

decrementAuxSelected()

Reorders the displayed list items in self.aux_listbox such that the selected item moves down one rung in the listbox.

delFromAuxListbox()

Removes selected item from self.aux_listbox.

filterNames()

Limit the displayed list items to those items that match the self.filter_field filter regex.

getAllAuxListbox()

Returns a list of all the displayed property names in the self.aux_listbox.

getSelected()

Return a list of PropertyName objects selected from the listbox.

incrementAuxSelected()

Reorders the displayed list items in self.aux_listbox such that the selected item moves up one rung in the listbox.

selectAll()

Select all properties in the listbox.

setProperties(proplist, selected=None)

Set the listbox items to the structure.PropertyName.user_name attributes for the PropertyName instances in proplist.

proplist (list)
A list of structure.PropertyName objects.
selected (list)
List of structure.PropertyName instances in proplist that should be selected.
setState(state='normal')

Enable/disable the PropertySelector widget. If the widget has no property list, it is disabled. Otherwise, the ‘state’ can be set to stk.NORMAL or stk.DISABLED.

showAuxProperties(proplist, selected=None)

Display the auxilary listbox items to the structure.PropertyName.user_name attributes for the PropertyName instances in proplist.

proplist (list)
List of structure.PropertyName instances.
selected (list)
List of structure.PropertyName instances in proplist that should be selected.
showFamily(family)

Place only the properties of the specified family/owner in the listbox. ‘family’ is the family/owner string for a property (e.g., ‘qp’ for the property ‘i_qp_#amide’).

showProperties(proplist, selected=None)

Place the PropertyName.userName in the listbox. The items appear in the input list order.

If aux table is present and move_to_aux is set; do not include properties that are in the aux table.

proplist (list)
List of structure.PropertyName instances.
selected (list)
List of structure.PropertyName instances in proplist that should be selected (used when there is no aux table).
class schrodinger.ui.propertyselector.PropertySelectorMenu(parent, command=None, proplist=None)

Bases: schrodinger.ui.widget.pmwwidget.ComboBox

Pull-down menu style property selected Used by VSW GUI

getSelected()

Return PropertyName object for the selected property, or None.

ignoreEvent(ignored)
select(property)

Select the specified property. <property> must be a data name string or a PropertyName object.

setProperties(proplist)

Change the list of properties. ‘proplist’ must be a list of PropertyName objects (from the ‘structure.py’ module) or data names