Package schrodinger :: Package application :: Package bioluminate :: Module protein_report_widget :: Class DataModel
[hide private]
[frames] | no frames]

Class DataModel

PyQt4.QtCore.QAbstractTableModel --+
                                   |
                                  DataModel

Class for storing the table information.

Instance Methods [hide private]
 
__init__(self, master)
Create a DataModel instance
int
rowCount(self, parent=QtCore.QModelIndex())
Returns number of rows
int
columnCount(self, parent=QtCore.QModelIndex())
Returns number of columns
 
setData(self, data_list, headers)
Sets the internal data list to the specified list.
 
data(self, index, role=Qt.DisplayRole)
Given a cell index, returns the data that should be displayed in that cell.
 
headerData(self, section, orientation, role)
Returns the string that should be displayed in the specified header cell.
 
sort(self, Ncol, order)
Sort table by given column number.
Method Details [hide private]

rowCount(self, parent=QtCore.QModelIndex())

 

Returns number of rows

Parameters:
  • parent (QtCore.QModelIndex) - unused
Returns: int
Number of rows

columnCount(self, parent=QtCore.QModelIndex())

 

Returns number of columns

Parameters:
  • parent (QtCore.QModelIndex) - unused
Returns: int
Number of rows

setData(self, data_list, headers)

 

Sets the internal data list to the specified list. NOTE: Will use the actual list passed to it (without making a copy)

Parameters:
  • data_list (list) - the list of data for the model. Uses the actual list, not a copy
  • headers (list of str) - The column headers

data(self, index, role=Qt.DisplayRole)

 

Given a cell index, returns the data that should be displayed in that cell. Used by the view.

Parameters:
  • index (QtCore.QModelIndex) - index of the cell to return data for
  • role (Qt.ItemDataRole) - The data role to return
Returns:
the requested data for the requested index

headerData(self, section, orientation, role)

 

Returns the string that should be displayed in the specified header cell. Used by the View.

Parameters:
  • section (int) - the row or column index requested
  • orientation (Qt.Orientation (Qt.Horizontal or Qt.Vertical)) - Whether this is for the horizontal or vertical header
  • role (Qt.ItemDataRole) - The data role to return - Qt.DisplayRole to return the text of the header.
Returns:
the requested data for the requested header item

sort(self, Ncol, order)

 

Sort table by given column number. The first column will be sorted based on the first chain:residue number rather than a simple alphabetical sort. Note that this method changes the actual model._data property.

Parameters:
  • Ncol (int) - The column index to sort
  • order (Qt.SortOrder (Qt.AscendingOrder or Qt.DescendingOrder)) - The order in which to sort the column