Package schrodinger :: Package application :: Package matsci :: Module reordergui :: Class StructureListWidget
[hide private]
[frames] | no frames]

Class StructureListWidget

PyQt4.QtGui.QListWidget --+    
                          |    
 ui.qt.swidgets.SListWidget --+
                              |
                             StructureListWidget

A QListWidget that interacts with a structure picture to select atoms. Clicking on a row will send a signal that an atom has been clicked on. Atoms (rows) can be marked as Mapped or Unmapped, which will result in changing the background color of the row.

There is 1 row in in the ListWidget for each atom in the structure, in the same order as atoms are in the structure. Note that row indexes start at 0 but atom indexes start at 1, so we often have to add/subtract 1 to translate between the two.

Instance Methods [hide private]
 
__init__(self, master)
Create a StructureListWidget instance
 
setStructure(self, struct)
Set the structure object for this widget and fill the widget
 
fill(self)
Fill the items in the ListWidget using the current structure
 
selectAtom(self, index)
Select the item that corresponds to the atom index
 
itemSelected(self, row)
React to the user selecting an item in the ListWidget
(str, int)
parseAtomText(self, text)
Parse the given text into an element and atom index
QListWidgetItem
markAtomMapped(self, index, guess=False)
Mark the row for the given atom index as mapped
QListWidgetItem
markAtomUnmapped(self, index)
Mark the row for the given atom index as unmapped

Inherited from ui.qt.swidgets.SListWidget: allItems, removeItem, removeItemByText, rowByText, selectedText, setTextSelected

Class Variables [hide private]
  atom_clicked = QtCore.pyqtSignal(int)
Method Details [hide private]

__init__(self, master)
(Constructor)

 

Create a StructureListWidget instance

Parameters:
  • master (ReorderAtomFrame) - The mapping property of the master is used by some subclasses
Overrides: ui.qt.swidgets.SListWidget.__init__

setStructure(self, struct)

 

Set the structure object for this widget and fill the widget

Parameters:

selectAtom(self, index)

 

Select the item that corresponds to the atom index

Parameters:
  • index (int) - The index of atom whose item should be selected

itemSelected(self, row)

 

React to the user selecting an item in the ListWidget

Parameters:
  • row (int) - The row of the item selected

parseAtomText(self, text)

 

Parse the given text into an element and atom index

Parameters:
  • text (str) - String describing the atom such as C 13, H 1, etc. Also accepts strings for mapped atoms such as "C 13 - C 12"
Returns: (str, int)
The element and atom index specified by text

markAtomMapped(self, index, guess=False)

 

Mark the row for the given atom index as mapped

Parameters:
  • index (int) - Atom to mark
  • guess (bool) - True if this mark results from a guess, False if not. The background color used depends on this parameter.
Returns: QListWidgetItem
The list widget item for the affected atom

markAtomUnmapped(self, index)

 

Mark the row for the given atom index as unmapped

Parameters:
  • index (int) - Atom to mark
Returns: QListWidgetItem
The list widget item for the affected atom