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

Class InputEntriesModel

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

The data model for the input entries table

Nested Classes [hide private]
  COLUMN
Column constants for the selected entries table
  ROW_CLASS
A class for accessing data about a project table row and the associated structure
Instance Methods [hide private]
 
basisChanged(...)
 
__init__(self, parent)
x.__init__(...) initializes x; see help(type(x)) for signature
 
setPerAtomBasisModel(self, per_atom_basis_model)
Connect this model to the per-atom basis set model from the Basis Set sub-tab.
 
perAtomBasisChanged(self, eid)
Respond to the user changing a per-atom basis set for the specified entry ID.
 
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.
 
_updateCurTableRows(self, proj)
Update self.cur_table_rows so it reflects the currently selected or included 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)
 
copyChargeMultBasisFromModel(self, copy_model)
Copy the charge, spin and basis set information from the given model to this model.
 
_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
str or NoneType
_toolTipData(self, col, proj_row, role)
Return data for the tool tip role
str
_basisToolTipData(self, proj_row)
Return data for the basis column tool tip
str
_singleBasisToolTip(self, proj_row)
Return the basis column tool tip for a structure without per-atom basis sets
str
_perAtomToolTip(self, proj_row, per_atom)
Return the basis column tool tip for a structure with per-atom basis sets
 
_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
Basis or str
_getDisplayBasis(self, proj_row, per_atom_name='Custom')
Get the basis set for the specified row.
dict or NoneType
_getPerAtomBasis(self, proj_row, name=False)
Get the per-atom 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
getCommonBasis(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
 
entryTitles(self)
Get a dictionary of {entry id: entry title} for all selected entries
 
entryIds(self)
Get a set of entry ids for all selected entries
Basis or str
getBasisForEid(self, eid, per_atom_name)
Get the basis set for the specified entry id.
 
setSource(self, source)
Specify the row source, i.e., included entries or selected entries
UseFrom
source(self)
Return the row source, i.e., included entries or selected entries
 
usingSelected(self)
Return True if the tab is set to use selected entries.

Inherited from Qt.QtCore.QAbstractTableModel: setRoleNames, setSupportedDragActions

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, 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 = gui_utils.ERROR_BACKGROUND_BRUSH
The brush used to paint the background of cells containing invalid data
  ERROR_PRE = '<span style=\'color:red\'>'
  ERROR_POST = '</span>'

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)

setPerAtomBasisModel(self, per_atom_basis_model)

 

Connect this model to the per-atom basis set model from the Basis Set sub-tab.

Parameters:

perAtomBasisChanged(self, eid)

 

Respond to the user changing a per-atom basis set for the specified entry ID. A per-atom basis set change could change the validity of the current basis set for the structure, so we emit dataChanged. This triggers the view to re-color the background of the cell.

Parameters:
  • eid (str) - The entry ID

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.

_updateCurTableRows(self, proj)

 

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

Parameters:

Note: At the end of this function, self.cur_table_rows will be equal to [self.all_rows[row.entry_id] for row in proj.selected_rows] (or proj.included_rows). This function updates self.cur_table_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/selected a new structure.

_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

copyChargeMultBasisFromModel(self, copy_model)

 

Copy the charge, spin and basis set information from the given model to this model.

Parameters:
Raises:
  • RuntimeError - If the rows in the model are not in the same order

_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.)
Returns: str or NoneType
If a tool tip is to be displayed, return the tool tip data. Otherwise, return None.

_basisToolTipData(self, proj_row)

 

Return data for the basis column tool tip

Parameters:
  • proj_row (ProjEntry) - The project row object
Returns: str
The tool tip text

_singleBasisToolTip(self, proj_row)

 

Return the basis column tool tip for a structure without per-atom basis sets

Parameters:
  • proj_row (ProjEntry) - The project row object
Returns: str
The tool tip text

_perAtomToolTip(self, proj_row, per_atom)

 

Return the basis column tool tip for a structure with per-atom basis sets

Parameters:
  • proj_row (ProjEntry) - The project row object
  • per_atom (dict) - The per-atom basis sets
Returns: str
The tool tip text

_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

_getDisplayBasis(self, proj_row, per_atom_name='Custom')

 

Get the basis set for the specified row. If there are per-atom basis sets for the specified row, return per_atom_name instead.

Parameters:
  • proj_row (ProjEntry) - The project row object to get the basis for
  • per_atom_name (str) - The basis set name to return if there are per-atom basis sets
Returns: Basis or str
The basis for the specified row or "Custom"

_getPerAtomBasis(self, proj_row, name=False)

 

Get the per-atom basis for the specified row

Parameters:
  • proj_row (ProjEntry) - The project row object
  • name (bool) - If True, the return dictionary keys will be atom names. If False, the keys will be atom numbers.
Returns: dict or NoneType
The per-atom basis sets for the specified row, or None if no per-atom basis set model has been specified

_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 - 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

getCommonBasis(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.

getBasisForEid(self, eid, per_atom_name)

 

Get the basis set for the specified entry id. If there are per-atom basis sets specified for the structure, the per_atom_name will be returned.

Parameters:
  • eid (str) - The entry id
  • per_atom_name (str) - The name to return if per-atom basis sets are specified
Returns: Basis or str
The basis set name, or per_atom_name if per-atom basis sets are specified

setSource(self, source)

 

Specify the row source, i.e., included entries or selected entries

Parameters:
  • source (UseFrom or schrodinger.ui.qt.input_selector.InputSelector class constant that maps to a UseFrom enum) - The row source

source(self)

 

Return the row source, i.e., included entries or selected entries

Returns: UseFrom
The row source

usingSelected(self)

 

Return True if the tab is set to use selected entries. False if the tab is set to use included entries.


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.