schrodinger.application.jaguar.gui.tabs.sub_tab_widgets.base_widgets module¶
- class schrodinger.application.jaguar.gui.tabs.sub_tab_widgets.base_widgets.SubTabTableView(parent=None)¶
Bases:
schrodinger.application.jaguar.gui.utils.ProjTableLikeView
A table view with a right click menu for removing selected rows. This class may be subclassed to configure delegates.
- Variables
COLUMN (type) – A class containing column constants for the table.
SAMPLE_DATA (dict) – A dictionary of {column number: sample cell contents}. The sample cell contents are used to set column widths appropriately. Note that sample data for columns COLUMN.ID, COLUMN.TITLE, COLUMN.ATOM, and/or COLUMN.ATOMS will be added automatically if not explicitly included. Any other columns that are not included here will be set to their default width.
_DEFAULT_SAMPLE_DATA (dict) – A dictionary of {column name (attribute in the COLUMN class variable): sample cell contents}. The sample cell contents are used to set column widths appropriately. If no column of the specified name is found, the sample data will be ignored. Data found in SAMPLE_DATA takes precedence over data found in _DEFAULT_SAMPLE_DATA. Subclasses should alter SAMPLE_DATA rather than _DEFAULT_SAMPLE_DATA whenever possible (due to increased ease of debugging typos).
MARGIN (int) – The additional width to add to each column included in the sample data
- COLUMN = None¶
- SAMPLE_DATA = {}¶
- MARGIN = 20¶
- setMarkerHighlighting¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(parent=None)¶
- removeSelectedRows()¶
Remove the currently selected rows from the table
- mouseReleaseEvent(event)¶
Create the popup menu when the user right clicks
- setModel(model)¶
After setting the model, resize the columns using the sample data and the header data provided by the model
See Qt documentation for an explanation of arguments
- sizeHintForColumn(col_num)¶
Provide a size hint for the specified column using the sample data. Note that this method does not take header width into account as the header width is already accounted for in
resizeColumnToContents
.See Qt documentation for an explanation of arguments and return value
- selectionChanged(new_sel, old_sel)¶
When the table selection changes, emit the appropriate signals to update marker highlighting.
- Parameters
new_sel (
PyQt5.QtCore.QItemSelection
) – The new table selectionold_sel (
PyQt5.QtCore.QItemSelection
) – The previous table selection
- class schrodinger.application.jaguar.gui.tabs.sub_tab_widgets.base_widgets.SubTabProxyModel(parent=None)¶
Bases:
PyQt6.QtCore.QSortFilterProxyModel
A proxy model that filters out rows related to entry ids that are no longer selected in the project table.
- Variables
COLUMN (type) – A class containing column constants for the table.
- COLUMN = None¶
- __init__(parent=None)¶
- setSourceModel(model)¶
When setting the source model, adopt its COLUMN constants if we don’t have one defined.
See Qt documentation for explanation of arguments.
- setDisplayedEids(eids)¶
Set the entry ids to display in the table. This should correspond to the entry ids currently selected in the project table.
- Parameters
eids (list) – The entry ids to display
- isAcceptableEid(eid)¶
Is the specified entry ID currently included in the Input tab table? i.e., Would this entry ID be acceptable to display in the sub-tab table?
- Parameters
eid (str) – The entry id
- Returns
True if the entry ID is acceptable. False otherwise.
- Return type
bool
- filterAcceptsRow(source_row, source_parent=None)¶
Accept a row only if the entry id is in
self._displayed_eids
or if the entry id is blankSee Qt documentation for an explanation of the arguments and return value
- lessThan(left, right)¶
Compare two indices for sorting. Assume that the ATOM column contains atom names. Assume that the ATOMS column contains either:
a string of atom names separated by commas and white space
a list or tuple of atom names
Atom names are then sorted numerically. All other columns are sorted using Python’s less than operator (which allows tuples to be sorted as expected).
See Qt documentation for an explanation of arguments and return value
- class schrodinger.application.jaguar.gui.tabs.sub_tab_widgets.base_widgets.SubTabRow(entry_id=None, title=None)¶
Bases:
object
An object representing a single row of the table. This class is intended to be subclassed for each sub-tab. The default implementation includes entry id and structure title.
- __init__(entry_id=None, title=None)¶
- copy()¶
Create a new row object that is a copy of this row
This method must be implemented in subclasses for use with models that have the appendFromModel method.
- Return type
PerAtomBasisRow
- Returns
The row item that is a copy of this row
- getAtomNums()¶
Get a list of all atom numbers associated with this row (i.e. all atom to be marked by workspace markers). The default implementation checks for an
atom_num
oratom_nums
attribute. Subclasses must redefine this function if neither of these attributes exist.- Returns
A list of atom numbers (relative to the entry, not the workspace structure)
- Return type
list
- getAtoms()¶
Get a list of all atoms associated with this row (i.e. all atom to be marked by workspace markers).
- Returns
A list of
schrodinger.structure._StructureAtom
objects- Return type
list
- getStructure()¶
Get the structure this row refers to
- Returns
The structure
- Return type
- class schrodinger.application.jaguar.gui.tabs.sub_tab_widgets.base_widgets.SubTabModel(parent=None)¶
Bases:
PyQt6.QtCore.QAbstractTableModel
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 addJaguarMarkerForRow and removeJaguarMarkerForRow if more than one marker per row is required.
- Variables
COLUMN (type) –
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.
UNEDITABLE (iterable) – A list of all column numbers that should be flagged as uneditable
ROW_CLASS (type) – The
SubTabRow
subclass that represents a row of dataMARKER_SETTINGS (dict) – The settings for the workspace markers. This dictionary will be passed to
schrodinger.maestro.markers._BaseMarker. applySettings
ERROR_BACKGROUND_BRUSH (
PyQt5.QtGui.QBrush
) – The brush used to paint the background of cells where the user has entered invalid data.addJaguarMarker (
PyQt5.QtCore.pyqtSignal
) –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)
removeJaguarMarker (
PyQt5.QtCore.pyqtSignal
) –A signal emitted when a workspace marker should be removed. Emitted with:
The list of atoms to remove the marker for (list)
- COLUMN = None¶
- UNEDITABLE = ()¶
- MARKER_SETTINGS = {}¶
- ERROR_BACKGROUND_BRUSH = <PyQt6.QtGui.QBrush object>¶
- addJaguarMarker¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- removeJaguarMarker¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- __init__(parent=None)¶
- reset()¶
- appendFromModel(model)¶
Append the rows of model to this model
- Parameters
model (subclass of
SubTabModel
) – The model to copy data from, should be the same subclass as this object
- columnCount(self, parent: QModelIndex = QModelIndex()) int ¶
- rowCount(self, parent: QModelIndex = QModelIndex()) int ¶
- updateEntryTitles(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}
- getStructEidMap()¶
- addRow(*args, **kwargs)¶
Add a row to the table. All arguments are passed to
ROW_CLASS
initialization.- Returns
The row number of the new row
- Return type
int
- removeRow(self, row: int, parent: QModelIndex = QModelIndex()) bool ¶
- removeRows(self, row: int, count: int, parent: QModelIndex = QModelIndex()) bool ¶
- addJaguarMarkerForRow(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
- removeJaguarMarkerForRow(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(eid)¶
Get all rows that refer to the specified entry ID
- Parameters
eid (str) – The entry id
- Returns
A list of
ROW_CLASS
objects- Return type
list
- headerData(self, section: int, orientation: Qt.Orientation, role: int = Qt.DisplayRole) Any ¶
- flags(index)¶
Flag columns in
UNEDITABLE
as uneditable.See Qt documentation for an explanation of arguments and return value
- data(self, index: QModelIndex, role: int = Qt.DisplayRole) Any ¶
- setData(index, value, role=ItemDataRole.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.
- clearDataForEid(eid)¶
Clear all data related to the specified entry ID
- Parameters
eid (str) – The entry id