Package schrodinger :: Package application :: Package jaguar :: Package gui :: Module input_tab_widgets :: Class SelectedEntriesModel
[hide private]
[frames] | no frames]

Class SelectedEntriesModel

         object --+                    
                  |                    
  sip.simplewrapper --+                
                      |                
            sip.wrapper --+            
                          |            
       PyQt4.QtCore.QObject --+        
                              |        
PyQt4.QtCore.QAbstractItemModel --+    
                                  |    
   PyQt4.QtCore.QAbstractTableModel --+
                                      |
                                     SelectedEntriesModel
Known Subclasses:

The data model for the selected entries table

Nested Classes [hide private]
  COLUMN
Column constants for the selected entries table
Instance Methods [hide private]
 
__init__(self, parent)
x.__init__(...) initializes x; see help(type(x)) for signature
 
projectUpdated(self)
Update the table when the project is updated
 
workspaceChanged(self, what_changed)
If the workspace changed, update data in case the user changed the charge of a molecule.
 
_updateSelectedRows(self, proj)
Update self.selected_rows so it reflects the currently selected project rows and inform the view of the changes.
 
_updateProjData(self, proj)
Update the data in self.all_rows for all selected rows and inform the view of the changes.
 
clearRows(self)
Clear all row data
 
rowCount(self, parent=None)
 
columnCount(self, parent=None)
 
data(self, index, role=0)
 
_displayAndSortData(self, col, proj_row, role)
Return data for the display or sort role
 
_formattingData(self, col, proj_row, role)
Return data for the font or foreground role
 
_toolTipData(self, col, proj_row, role)
Return data for the tool tip role
 
_otherData(self, col, proj_row, role)
Return data for the background or custom roles
Basis
_getBasis(self, proj_row)
Get the basis for the specified row
bool
_hasValidBasis(self, proj_row)
Does the specified row have a valid basis set?
 
headerData(self, section, orientation, role=0)
 
flags(self, index)
bool
setData(self, index, value, role=2)
Set data for the specified index.
list
checkBasisSets(self)
Make sure that all structure have a valid basis set selected
 
setDefaultBasis(self, basis)
Set the default basis set
list
getStructures(self)
Get a list of all structures loaded into the table (i.e.
 
reset(self)
Reset all charge, spin multiplicity, and basis settings
str or NoneType
allStrucsUseSameBasis(self)
If all structures use the same basis set, return the basis set name.
bool
chargedStrucsPresent(self)
Determine if the user has specified any molecular charges

Inherited from PyQt4.QtCore.QAbstractTableModel: dropMimeData, hasChildren, index, parent

Inherited from PyQt4.QtCore.QAbstractItemModel: beginInsertColumns, beginInsertRows, beginMoveColumns, beginMoveRows, beginRemoveColumns, beginRemoveRows, beginResetModel, buddy, canFetchMore, changePersistentIndex, changePersistentIndexList, columnsAboutToBeInserted, columnsAboutToBeMoved, columnsAboutToBeRemoved, columnsInserted, columnsMoved, columnsRemoved, createIndex, dataChanged, decodeData, encodeData, endInsertColumns, endInsertRows, endMoveColumns, endMoveRows, endRemoveColumns, endRemoveRows, endResetModel, fetchMore, hasIndex, headerDataChanged, insertColumn, insertColumns, insertRow, insertRows, itemData, layoutAboutToBeChanged, layoutChanged, match, mimeData, mimeTypes, modelAboutToBeReset, modelReset, persistentIndexList, removeColumn, removeColumns, removeRow, removeRows, resetInternalData, revert, roleNames, rowsAboutToBeInserted, rowsAboutToBeMoved, rowsAboutToBeRemoved, rowsInserted, rowsMoved, rowsRemoved, setHeaderData, setItemData, setRoleNames, setSupportedDragActions, sibling, sort, span, submit, supportedDragActions, supportedDropActions

Inherited from PyQt4.QtCore.QObject: __getattr__, blockSignals, childEvent, children, connect, connectNotify, customEvent, deleteLater, destroyed, disconnect, disconnectNotify, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, emit, event, eventFilter, findChild, findChildren, inherits, installEventFilter, isWidgetType, killTimer, metaObject, moveToThread, objectName, property, pyqtConfigure, receivers, removeEventFilter, sender, senderSignalIndex, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread, timerEvent, tr, trUtf8

Inherited from sip.simplewrapper: __new__

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
PyQt4.QtGui.QBrush ERROR_BACKGROUND_BRUSH = QtGui.QBrush(Qt.red)
The brush used to paint the background of cells containing invalid data

Inherited from PyQt4.QtCore.QObject: staticMetaObject

Instance Variables [hide private]
 
show_tool_tip(...)
A signal indicating that the tool tip for the specified cell should explicitly be shown.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, parent)
(Constructor)

 

x.__init__(...) initializes x; see help(type(x)) for signature

Overrides: object.__init__
(inherited documentation)

workspaceChanged(self, what_changed)

 

If the workspace changed, update data in case the user changed the charge of a molecule.

Parameters:
  • what_changed (str) - A flag indicating what changed in the workspace

Note: This function is called before the workspace changes have propagated to the project table. As such, we use a QTimer to wait until after the changes have propagated before updating.

_updateSelectedRows(self, proj)

 

Update self.selected_rows so it reflects the currently selected project rows and inform the view of the changes.

Parameters:

Note: At the end of this function, self.selected_rows will be equal to [self.all_rows[row.entry_id] for row in proj.selected_rows]. This function updates self.selected_rows such that the view is aware of which individual rows are being added and deleted by using beginInsertRow()/endInsertRow() and beginRemoveRow()/endRemoveRow(). This allows the view to properly update its current selection, current selected index, etc. If this function were implemented using beginResetModel()/endResetModel(), the table view would lose its selection and scroll back to the upper-left corner every time the user included a new structure in the workspace.

_updateProjData(self, proj)

 

Update the data in self.all_rows for all selected rows and inform the view of the changes.

Parameters:

rowCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.rowCount

columnCount(self, parent=None)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.columnCount

data(self, index, role=0)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.data

_displayAndSortData(self, col, proj_row, role)

 

Return data for the display or sort role

Parameters:
  • col (int) - The column to display data for
  • proj_row (ProjEntry) - The project row object to display data for
  • role (int) - The role to display data for. Must be Qt.DisplayRole or SORT_ROLE.

_formattingData(self, col, proj_row, role)

 

Return data for the font or foreground role

Parameters:
  • col (int) - The column to display data for
  • proj_row (ProjEntry) - The project row object to display data for
  • role (int) - The role to display data for. Must be Qt.FontRole or Qt.ForegroundRole.

_toolTipData(self, col, proj_row, role)

 

Return data for the tool tip role

Parameters:
  • col (int) - The column to display data for
  • proj_row (ProjEntry) - The project row object to display data for
  • role (int) - The role to display data for. Must be Qt.ToolTipRole. (Note that this argument is ignored, but is present for consistency with the other data functions.)

_otherData(self, col, proj_row, role)

 

Return data for the background or custom roles

Parameters:
  • col (int) - The column to display data for
  • proj_row (ProjEntry) - The project row object to display data for
  • role (int) - The role to display data for. Must be Qt.BackgroundRole or a custom role (i.e. >= Qt.UserRole).

_getBasis(self, proj_row)

 

Get the basis for the specified row

Parameters:
  • proj_row (ProjEntry) - The project row object to get the basis for
Returns: Basis
The basis for the specified row

_hasValidBasis(self, proj_row)

 

Does the specified row have a valid basis set?

Parameters:
  • proj_row (ProjEntry) - The project row object to check the basis for
Returns: bool
True if the basis for the specified row if valid. False otherwise.

headerData(self, section, orientation, role=0)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.headerData

flags(self, index)

 
Overrides: PyQt4.QtCore.QAbstractItemModel.flags

setData(self, index, value, role=2)

 

Set data for the specified index. The spin multiplicity tool tip will be shown if an invalid spin multiplicity is set, or if a charge is set that renders the spin multiplicity invalid. (The tool tip explains that the default spin multiplicity is being used because the user-specifed value is invalid.)

Parameters:
  • index (PyQt4.QtCore.QModelIndex) - The index to modify
  • value (PyQt4.QtCore.QVariant) - The value to set
  • role (int) - The role to set data for. Must be Qt.EditRole or setting will fail.
Returns: bool
True if setting succeeded. False if it failed.
Overrides: PyQt4.QtCore.QAbstractItemModel.setData

checkBasisSets(self)

 

Make sure that all structure have a valid basis set selected

Returns: list
A list of structures with invalid basis sets

setDefaultBasis(self, basis)

 

Set the default basis set

Parameters:
  • basis (str) - The default basis set

getStructures(self)

 

Get a list of all structures loaded into the table (i.e. all structures selected in the project table) and the associated settings.

Returns: list
A list of ProjEntryTuple objects

reset(self)

 

Reset all charge, spin multiplicity, and basis settings

Overrides: PyQt4.QtCore.QAbstractItemModel.reset

allStrucsUseSameBasis(self)

 

If all structures use the same basis set, return the basis set name. Otherwise, return None.

Returns: str or NoneType
The basis set name or None

Note: The basis set returned here is not guaranteed to be the default basis set. The user may have specified identical per-structure basis sets for all structures.

chargedStrucsPresent(self)

 

Determine if the user has specified any molecular charges

Returns: bool
True if the user has specified a molecular charge for any molecule. False otherwise.

Instance Variable Details [hide private]

show_tool_tip(...)

 
A signal indicating that the tool tip for the specified cell should explicitly be shown. This is used to notify the user when an invalid spin multiplicity has been entered. (Note that this signal has nothing to do with tool tips being shown when the user hovers over a cell.) This signal is emitted with the index of the cell to display the tool tip for.