schrodinger.application.msv.gui.delegates module

Qt Delegates for the tree view. Note that Qt cannot assign delegates per row in a tree view, so DispatchDelegate is set as the only delegate for the scrollable columns. It passes method calls to the appropriate delegate class. It also handles data caching using table_speed_up.SpeedUpDelegate. Because of this, delegates other than DispatchDelegate should not call initStyleOption and should access data via option.data[role] rather than index.data(role).

class schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate(*args, **kwargs)

Bases: PyQt5.QtWidgets.QStyledItemDelegate

Base delegate class.

Variables:ANNOTATION_TYPE (enum.Enum or None) – The annotation type associated with this class
Parameters:SAMPLE_DATA (str or None) – Sample data for this class. Used to determine appropriate column widths.
ANNOTATION_TYPE = None
HORIZONTAL_PADDING_SCALE = 1
SAMPLE_DATA = None
VERTICAL_PADDING_SCALE = 1
element_height
heightHint(option, index)

Return the sizeHint’s height for the specified cell.

See QAbstractItemDelegate.sizeHint documentation for argument documentation.

paint(painter, option, index)
sizeHint(option, index)
class schrodinger.application.msv.gui.delegates.AbstractDoubleElementHeightDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate

A delegate for rows that are double the height of a SingleElementHeightDelegate row.

element_height

Return the height of the element, twice the default.

rtype: float return: The height of the element

class schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate

A delegate for rows that are SSA_ELEMENT_HEIGHT pixels high.

element_height

Return the height of the element.

rtype: float return: The height of the element

heightHint(option, index)
sizeHint(option, index)

Return the size hint for the element at the specified index

Note that this is only called if the view resizes rows to fit elements

Parameters:
  • option (QtWidgets.QStyleOptionViewItem) – The option to modify with cached information
  • index (QtCore.QModelIndex) – The index in the model
Return type:

QSizeHint

Returns:

The size hint for the element with height appropriately adjusted

class schrodinger.application.msv.gui.delegates.AlignmentInfoDelegate(parent, data_cache)

Bases: schrodinger.ui.qt.table_speed_up.SpeedUpDelegate, schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate

This is a delegate class that paints alignment info (e.g. identity, similarity, homology and score metrics or name and chain info).

PAINT_ROLES = frozenset([0, 1, 6, 7, 8, 9, 10, <CustomRole.FixedColFontRole: 279>, <CustomRole.RowHeightScale: 282>])
paint(painter, option, index)

Paints the info

Parameters:
  • option (QtWidgets.QStyleOptionViewItem) – The option to modify with cached information
  • index (QtCore.QModelIndex) – The index in the model
setModel(model)
sizeHint(option, index)
class schrodinger.application.msv.gui.delegates.AntibodyCDRDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.StandardDelegate

ANNOTATION_TYPE = 18
class schrodinger.application.msv.gui.delegates.DispatchDelegate(parent, cache, additional_roles=frozenset([]))

Bases: schrodinger.ui.qt.table_speed_up.SpeedUpDelegate

A delegate that acts as one of the above delegates depending on an index’s RowType data. This is needed because Qt doesn’t allow us to set delegates per row in a tree view. (Delegates for a row can only be set based on row number, which means that, e.g., the second row of the table and the second row of all groups in the table will get the same delegate.)

PAINT_ROLES = frozenset([0, <CustomRole.RowType: 257>, <CustomRole.DataRange: 258>, 6, 8, 9, <CustomRole.RowHeightScale: 282>, <CustomRole.Selected: 284>, <CustomRole.SeqresOnly: 285>])
clearCache()

Clear all delegate caching. The view must call this method any time a change in the model will result in a font size or size hint change.

heightHint(option, index)

Return the sizeHint’s height for the specified cell.

See QAbstractItemDelegate.sizeHint documentation for argument documentation.

maxWidthForRowTypes(row_types, option, index)

Determine the column width needed for a column containing all of the specified row types

Parameters:
  • row_types (iterable) – An iterable of all row types (viewconstants.RowType or viewconstants.AnnotationType)
  • option (QtGui.QStyleOptionViewItem) – A style option item for an index from the view
  • index (QtCore.QModelIndex) – A valid index from the view’s model. It does not need to be of any particular row type.
paint(painter, option, index)
sizeHint(option, index)

See Qt documentation for method documentation

Note that return values are cached on a per-row basis (i.e. we assume all columns are the same width) since the view calls sizeHint for all cells whenever it has to re-layout the table. Without caching, a layout takes a very long time even when there are only ~100 sequences.

class schrodinger.application.msv.gui.delegates.DisulfideBondDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate

ANNOTATION_TYPE = 3
class schrodinger.application.msv.gui.delegates.DoubleElementHeightDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractDoubleElementHeightDelegate

ANNOTATION_TYPE = (<ANNOTATION_TYPES.mean_isoelectric_point: 3>, <ANNOTATION_TYPES.window_isoelectric_point: 15>, <ANNOTATION_TYPES.b_factor: 13>, <ANNOTATION_TYPES.consensus_freq: 6>, <ANNOTATION_TYPES.window_hydrophobicity: 14>, <ANNOTATION_TYPES.mean_hydrophobicity: 2>)
class schrodinger.application.msv.gui.delegates.LigandContactsDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate

ANNOTATION_TYPE = 17
class schrodinger.application.msv.gui.delegates.ResidueDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.StandardDelegate

ANNOTATION_TYPE = (<RowType.Sequence: 1>, <ANNOTATION_TYPES.consensus_seq: 5>)
HORIZONTAL_PADDING_SCALE = 1.2
VERTICAL_PADDING_SCALE = 1.2
class schrodinger.application.msv.gui.delegates.ResnumDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate

A delegate to draw the residue number annotation. Numbers are drawn every 5.

ANNOTATION_TYPE = 1
class schrodinger.application.msv.gui.delegates.RulerDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate

A delegate to draw the ruler. Numbers are drawn above the ruler at intervals of 10 with a long tick. Medium ticks are drawn at intervals of 5. Other ticks are very short.

ANNOTATION_TYPE = 1
element_height

Return the height of the element, 1.2x the default.

rtype: float return: The height of the element

class schrodinger.application.msv.gui.delegates.SecondaryStructureDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractSingleElementHeightDelegate

ANNOTATION_TYPE = 16
class schrodinger.application.msv.gui.delegates.SequenceLogoDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractDoubleElementHeightDelegate

This delegate is used to draw scaled residue 1-letter code at each alignment position. The letters need to be drawn from bottom to top, in the order of increasing frequency,

ANNOTATION_TYPE = 7
class schrodinger.application.msv.gui.delegates.StandardDelegate(*args, **kwargs)

Bases: schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate

ANNOTATION_TYPE = (<ANNOTATION_TYPES.rescode: 2>, <ANNOTATION_TYPES.consensus_symbols: 4>, <RowType.Spacer: 2>, <ANNOTATION_TYPES.helix_propensity: 4>, <ANNOTATION_TYPES.beta_strand_propensity: 5>, <ANNOTATION_TYPES.turn_propensity: 6>, <ANNOTATION_TYPES.helix_termination_tendency: 7>, <ANNOTATION_TYPES.exposure_tendency: 8>, <ANNOTATION_TYPES.steric_group: 9>, <ANNOTATION_TYPES.side_chain_chem: 10>)