Package schrodinger :: Package application :: Package jaguar :: Package gui :: Package tabs :: Package sub_tab_widgets :: Module base_widgets :: Class SubTabModel
[hide private]
[frames] | no frames]

Class SubTabModel

PyQt4.QtCore.QAbstractTableModel --+
                                   |
                                  SubTabModel

A table model for storing sub-tab data. This class is not intended to be instantiated directly and should be subclassed. Subclasses must redefine COLUMN, UNEDITABLE, ROW_CLASS, MARKER_SETTINGS, and _displayAndSortData. Subclasses may also need to redefine addMarkerForRow and removeMarkerForRow if more than one marker per row is required.

Nested Classes [hide private]
type ROW_CLASS
The SubTabRow subclass that represents a row of data
Instance Methods [hide private]
 
__init__(self, parent=None)
 
reset(self)
 
columnCount(self, parent=None)
 
rowCount(self, parent=None)
 
updateEntryTitles(self, eids_to_titles)
Update the entry titles in case they have changed in the project table
int
addRow(self, *args, **kwargs)
Add a row to the table.
 
removeRows(self, row, count, parent=None)
 
addMarkerForRow(self, row)
Add a workspace marker for the given row.
 
removeMarkerForRow(self, row)
Remove the workspace marker for the given row.
list
rowsForEid(self, eid)
Get all rows that refer to the specified entry ID
 
headerData(self, section, orientation, role=Qt.DisplayRole)
 
flags(self, index)
Flag columns in UNEDITABLE as uneditable.
 
data(self, index, role=Qt.DisplayRole)
object
_displayAndSortData(self, col, row_data, role)
Retrieve data for the display and sort roles
object
_backgroundData(self, col, row_data)
Retrieve data for the background role
object
_toolTipData(self, col, row_data)
Retrieve data for the tool tip role
object
_otherDataSubTab(self, col, row_data, role)
Retrieve data for custom roles that are defined for all sub tabs.
object
_otherData(self, col, row_data, role)
Retrieve data for custom roles that are defined for the current sub-tab.
 
setData(self, index, value, role=Qt.EditRole)
Set data for the specified index and role.
object
_setData(self, col, row_data, value, role, row_num)
Set data for the specified index and role.
 
clearDataForEid(self, eid)
Clear all data related to the specified entry ID
Class Variables [hide private]
type COLUMN = None
A class containing column constants for the table.
iterable UNEDITABLE = ()
A list of all column numbers that should be flagged as uneditable
dict MARKER_SETTINGS = {}
The settings for the workspace markers.
PyQt4.QtGui.QBrush ERROR_BACKGROUND_BRUSH = QtGui.QBrush(Qt.red)
The brush used to paint the background of cells where the user has entered invalid data.
Instance Variables [hide private]
PyQt4.QtCore.pyqtSignal addMarker = QtCore.pyqtSignal(list, dict)
A signal emitted when a workspace marker should be added.
PyQt4.QtCore.pyqtSignal removeMarker = QtCore.pyqtSignal(list)
A signal emitted when a workspace marker should be removed.
Method Details [hide private]

updateEntryTitles(self, eids_to_titles)

 

Update the entry titles in case they have changed in the project table

Parameters:
  • eids_to_titles (dict) - A dictionary of {entry id: title}

addRow(self, *args, **kwargs)

 

Add a row to the table. All arguments are passed to ROW_CLASS initialization.

Returns: int
The row number of the new row

addMarkerForRow(self, row)

 

Add a workspace marker for the given row. Subclasses must override this class if they require more than one workspace marker per row. Note that any given set of atom(s) may only have one marker per sub-tab. The sub-tab is responsible for ensuring that a marker is not added to a set of atom(s) that already has a marker.

Parameters:
  • row (SubTabRow) - The row to add the marker for

removeMarkerForRow(self, row)

 

Remove the workspace marker for the given row. Subclasses must override this class if they create more than one workspace marker per row.

Parameters:
  • row (SubTabRow) - The row to remove the marker for

rowsForEid(self, eid)

 

Get all rows that refer to the specified entry ID

Parameters:
  • eid (str) - The entry id
Returns: list
A list of ROW_CLASS objects

flags(self, index)

 

Flag columns in UNEDITABLE as uneditable.

See Qt documentation for an explanation of arguments and return value

_displayAndSortData(self, col, row_data, role)

 

Retrieve data for the display and sort roles

Parameters:
  • col (int) - The column to return data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to retrieve data from
  • role (int) - The role to retrieve data for
Returns: object
The requested data

_backgroundData(self, col, row_data)

 

Retrieve data for the background role

Parameters:
  • col (int) - The column to return data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to retrieve data from
Returns: object
The requested data

_toolTipData(self, col, row_data)

 

Retrieve data for the tool tip role

Parameters:
  • col (int) - The column to return data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to retrieve data from
Returns: object
The requested data

_otherDataSubTab(self, col, row_data, role)

 

Retrieve data for custom roles that are defined for all sub tabs. Note that sub-classes should redefine _otherDataSubTab rather than this method.

Parameters:
  • col (int) - The column to return data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to retrieve data from
  • role (int) - The role to retrieve data for
Returns: object
The requested data

_otherData(self, col, row_data, role)

 

Retrieve data for custom roles that are defined for the current sub-tab. Note that sub-classes should redefine this method rather than _otherDataSubTab.

Parameters:
  • col (int) - The column to return data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to retrieve data from
  • role (int) - The role to retrieve data for
Returns: object
The requested data

setData(self, index, value, role=Qt.EditRole)

 

Set data for the specified index and role. Whenever possible, sub- classes should redefine _setData rather than this method.

See Qt documentation for an explanation of arguments and return value.

_setData(self, col, row_data, value, role, row_num)

 

Set data for the specified index and role. Note that sub-classes should redefine this method rather than setData whenever possible.

Parameters:
  • col (int) - The column to set data for
  • row_data (ROW_CLASS) - The ROW_CLASS instance to modify
  • value - The value to set
  • value - object
  • role (int) - The role to set data for
  • row_num (int) - The row number
Returns: object
False if setting failed. All other values are considered successes.

clearDataForEid(self, eid)

 

Clear all data related to the specified entry ID

Parameters:
  • eid (str) - The entry id

Class Variable Details [hide private]

COLUMN

A class containing column constants for the table. This class must contain:
  • NUM_COLS: The number of columns in the table (int)
  • HEADERS: A list of column headers (list)
  • ID: The entry id column number (int)
  • TITLE: The entry title column number (int)

and should contain additional integer constants for all other columns.

Type:
type
Value:
None

MARKER_SETTINGS

The settings for the workspace markers. This dictionary will be passed to schrodinger.maestro.markers._BaseMarker. applySettings
Type:
dict
Value:
{}

Instance Variable Details [hide private]

addMarker

A signal emitted when a workspace marker should be added. Emitted with:
  • The list of atoms to add the marker for (list)
  • The marker settings (dict)
Type:
PyQt4.QtCore.pyqtSignal
Value:
QtCore.pyqtSignal(list, dict)

removeMarker

A signal emitted when a workspace marker should be removed. Emitted with:
  • The list of atoms to remove the marker for (list)
Type:
PyQt4.QtCore.pyqtSignal
Value:
QtCore.pyqtSignal(list)