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.AbstractBarHeightDelegate(*args, **kwargs)

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

A BarHeightDelegate is responsible for displaying array-like model data as a series of scaled bars

getBarCoordinates(option)

Returns the coordinates for the bar to be drawn in the element at the specified index

Parameters:option – The option to modify with cached information. Note that

this object must have a “data” attribute as added by table_speed_up.SpeedUpDelegate. :type option: QtWidgets.QStyleOptionViewItem

Returns:The top left and bottom right coordinates of the bar
Return type:tuple(QtCore.QPointF)
getScaledValue(option)

Return the value scaled for the height of the bar

The value will be 0 if the data is None or if the range is None or 0.

Parameters:option – The option to modify with cached information. Note that

this object must have a “data” attribute as added by table_speed_up.SpeedUpDelegate. :type option: QtWidgets.QStyleOptionViewItem

Raises:ValueError – In the event that the data at the specified index is non-numeric and not None
Returns:The value scaled appropriately to the full height of the bar
Return type:float
class schrodinger.application.msv.gui.delegates.AbstractBaseRowDelegate

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, <CustomRole.BackgroundSelectionBrush: 260>, 6, 7, 8, 9, 10, <CustomRole.FixedColFontRole: 282>, <CustomRole.RowHeightScale: 285>])
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

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

ANNOTATION_TYPE = 18
class schrodinger.application.msv.gui.delegates.BarHeightDelegate(*args, **kwargs)

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

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

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

Delegate used for bar charts that represent positive and negative values. Positive values are drawn above the midpoint of the bar and negative values below.

ANNOTATION_TYPE = (<ANNOTATION_TYPES.window_hydrophobicity: 14>, <ANNOTATION_TYPES.mean_hydrophobicity: 2>)
getBarCoordinates(option)
class schrodinger.application.msv.gui.delegates.ColorBlockRowDelegate

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

ANNOTATION_TYPE = (<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>)
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, 1, <CustomRole.DataRange: 258>, <CustomRole.BackgroundSelectionBrush: 260>, 6, 7, 8, 9, 10, <CustomRole.RowType: 257>, <CustomRole.SecondaryStructure: 270>, <CustomRole.SeqresOnly: 288>, <CustomRole.RowHeightScale: 285>, <CustomRole.Selected: 287>])
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.LigandContactsDelegate

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.TextCachingDelegateMixin, 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.SpaceRowDelegate

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

A simple delegate to manage rows of empty space

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

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

ANNOTATION_TYPE = (<ANNOTATION_TYPES.rescode: 2>, <ANNOTATION_TYPES.consensus_symbols: 4>)
class schrodinger.application.msv.gui.delegates.TextCachingDelegateMixin(*args, **kwargs)

Bases: object

A mixin for a delegate that wishes to cache text using QStaticTexts. Note that QPainter::drawStaticText is roughly 10x faster than QPainter::drawText.

clearCache()

Clear the cache. This must be called whenever the font size changes.