Package schrodinger :: Package ui :: Package qt :: Module propertyselector :: Class PropertySelector
[hide private]
[frames] | no frames]

Class PropertySelector

Known Subclasses:


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__.


Class Attributes
----------------
None

Instance Attributes
-------------------

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.

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)

Instance Methods [hide private]
 
__init__(self, parent, proplist=None, multi=False, presort=True, show_family_menu=True, show_family_name=True, show_alpha_toggle=False, show_filter_field=False, show_aux_listbox=False, move_to_aux=False)
PropertySelector requires <parent> argument, which should be a Qt Widget into which this frame should be added.
 
setupUi(self, Form)
 
updateButtonStates(self)
Enable or disable buttons as needed.
 
sortAlphabetically(self, proplist)
 
sortByInitialOrder(self, proplist)
 
alphabetizeNames(self)
Alternate order the displayed list items, either alphabetically or in the native order depending on the value of self.alpha_toggle.
 
checkUserNames(self)
Assigns PropertyName.user_name attributes, for all members in self.proplist.
 
filteringChanged(self, ignored)
Called when value of the family pull-down menu is changed.
 
filterProperties(self, props)
Limit the specified list items to those items that match the self.filter_field filter regex and family option menu.
 
createFamilies(self)
Create a dictionary of families.
 
setProperties(self, proplist, selected_indexes=None)
Set the listbox items to the structure.PropertyName.user_name attributes for the PropertyName instances in proplist.
 
displayProperties(self, display_list, selected_list=None)
Adjust the display state and selection states to specified lists of PropertyName objects.
 
getSelected(self)
Return a list of selected PropertyName objects.
 
selectAll(self)
Select all properties in the listbox.
 
deselectAll(self)
Clear property selection
 
setEnabled(self, enabled)
Enable/disable the PropertySelector widget
 
getListboxSelection(self)
 
getAuxListboxSelection(self)
 
moveAuxSelectedDown(self)
Reorders the displayed list items in self.aux_listbox such that the selected item moves down one rung in the listbox.
 
moveAuxSelectedUp(self)
Reorders the displayed list items in self.aux_listbox such that the selected item moves up one rung in the listbox.
 
addToAuxListbox(self)
Adds items selected in self.listbox to self.aux_listbox.
 
delFromAuxListbox(self)
Removes selected item from self.aux_listbox.
 
showAuxProperties(self, proplist, selected_indexes=None)
Display the auxilary listbox items to the structure.PropertyName.user_name attributes for the PropertyName instances in proplist.
Method Details [hide private]

__init__(self, parent, proplist=None, multi=False, presort=True, show_family_menu=True, show_family_name=True, show_alpha_toggle=False, show_filter_field=False, show_aux_listbox=False, move_to_aux=False)
(Constructor)

 

PropertySelector requires <parent> argument, which should be a Qt
Widget into which this frame should be added.

Other keyword options:

proplist (list)
    List of structure.PropertyName instances.  The order of items
    in the list is the default order of items in the list box.

multi (boolean)
    True allows selecting multiple properties.  Default is False,
    single item selection.

show_family_menu (boolean)
    True add property family menu to control visible list items.
    Default is True.

show_family_name (boolean)
    True displays the family/owner in parentheses after each name.
    Default is True.

show_alpha_toggle (boolean)
    True displays the alphabetize checkbox toggle.  Default is
    False.

show_filter_field (boolean)
    True displays the string filter controls.  Default is False.

show_aux_listbox (boolean)
    True displays the auxilary listbox, add and remove buttons,
    and decrement/increment buttons.  self.getSelected() returns
    all the items in the auxilary list box, in the order they
    appear.

presort (boolean)
    True orders the properties alphabetically by
    PropertyName.userName() values.

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)

updateButtonStates(self)

 

Enable or disable buttons as needed. Called when selection in the tables changes.

checkUserNames(self)

 

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).

createFamilies(self)

 

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

setProperties(self, proplist, selected_indexes=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_indexes (list)
    List of indexes of <proplist> that should be selected.

displayProperties(self, display_list, selected_list=None)

 

Adjust the display state and selection states to specified
lists of PropertyName objects.
Use only when selection or display state changes.
Use setProperties() to use different properties.

display_list (list)
    A list of PropertyName objects to display.

selected_list (list)
    A list of PropertyName objects to select.

showAuxProperties(self, proplist, selected_indexes=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_indexes (list)
    List of indexes of <proplist> that should be selected.