schrodinger.application.models.gui.delegates.value_delegates module

Value delegates for Model Hub table views.

Combines constraint/inheritance behavior (ValueDelegateMixin) with concrete framework delegates (type-specific editing/rendering) and a routing delegate that dispatches to the correct sub-delegate based on InputType.

Also contains custom Qt data roles and the ButtonType/ButtonRow API for button layout within value cells.

ValueDelegateMixin must be used alongside DelegateBase — it relies on methods from that class (_paintText, _getContentsRect, getButtonState, etc.).

class schrodinger.application.models.gui.delegates.value_delegates.ValueState

Bases: Enum

Visual state of a value cell.

CUSTOM = 1
INHERITED = 2
UNSPECIFIED = 3
class schrodinger.application.models.gui.delegates.value_delegates.IconButtonSpec(icon: Icon, info_text: str = '')

Bases: object

Specification for an icon button: icon identity and tooltip text.

icon: Icon
info_text: str = ''
__init__(icon: Icon, info_text: str = '') None
class schrodinger.application.models.gui.delegates.value_delegates.ButtonType

Bases: Enum

Identifies each button in a value cell.

INHERITANCE = 1
RESET = 2
CONSTRAINT = 3
class schrodinger.application.models.gui.delegates.value_delegates.ButtonRow(type_to_rect: dict[schrodinger.application.models.gui.delegates.value_delegates.ButtonType, PyQt6.QtCore.QRect] = <factory>, constraint: schrodinger.application.models.datamodels.definition.ChildConstraint | None = None)

Bases: object

Container for icon buttons that are currently displayed in a value cell.

type_to_rect: dict[ButtonType, PyQt6.QtCore.QRect]
constraint: ChildConstraint | None = None
hasButton(btn_type: ButtonType) bool
width() int

Total width occupied by all visible buttons.

__init__(type_to_rect: dict[schrodinger.application.models.gui.delegates.value_delegates.ButtonType, PyQt6.QtCore.QRect] = <factory>, constraint: schrodinger.application.models.datamodels.definition.ChildConstraint | None = None) None
class schrodinger.application.models.gui.delegates.value_delegates.ValueDelegateMixin

Bases: object

Pure mixin that adds constraint/inheritance behavior to framework delegates.

Layers value-state rendering (CUSTOM/INHERITED/UNSPECIFIED), reset buttons, inheritance arrows, and constraint icons/menus on top of any concrete delegate that inherits from DelegateBase.

Must appear before the concrete delegate in the MRO:

class TextValueDelegate(ValueDelegateMixin, TextDelegate):
    pass

Item Model Interface:

The delegate expects the item model to provide:

  • Qt.DisplayRole: Value string for display

  • Qt.EditRole: Accepts new value strings via setData

  • Qt.ItemIsEditable flag: Set when the cell is editable (not locked)

  • ValueStateRole: ValueState enum (CUSTOM, INHERITED, UNSPECIFIED)

  • ChildConstraintRole: ChildConstraint enum value

createEditor(parent: QWidget, option: QStyleOptionViewItem, index: QModelIndex) PyQt6.QtWidgets.QWidget | None

Auto-promote UNSPECIFIED to OVERRIDABLE when editing begins.

getButtonState(index: QModelIndex, key) State
helpEvent(event: QHelpEvent, view: QAbstractItemView, option: QStyleOptionViewItem, index: QModelIndex) bool

Show tooltips for buttons on hover, then fall back to super.

class schrodinger.application.models.gui.delegates.value_delegates.TextValueDelegate(parent: QObject = None, draw_separator: bool = True)

Bases: ValueDelegateMixin, TextDelegate

class schrodinger.application.models.gui.delegates.value_delegates.IntValueDelegate(parent: QObject = None, draw_separator: bool = True)

Bases: ValueDelegateMixin, IntDelegate

class schrodinger.application.models.gui.delegates.value_delegates.FloatValueDelegate(parent: QObject = None, draw_separator: bool = True)

Bases: ValueDelegateMixin, FloatDelegate

class schrodinger.application.models.gui.delegates.value_delegates.BoolValueDelegate(parent: PyQt6.QtCore.QObject | None = None, **kwargs)

Bases: ValueDelegateMixin, BoolDelegate

class schrodinger.application.models.gui.delegates.value_delegates.FileValueDelegate(parent: PyQt6.QtCore.QObject | None = None)

Bases: ValueDelegateMixin, DelegateBase

Delegate for file-based value inputs (FILE, STRUCTURE).

Shows filename only (elided left), with full path as tooltip. Click opens a file dialog to select a file.

__init__(parent: PyQt6.QtCore.QObject | None = None)
setFileNameMapping(mapping: dict[str, str]) None

Set the mapping from stored file IDs to original filenames.

Parameters:

mapping – A dictionary mapping file IDs to filenames.

editorEvent(event: QEvent, model: QAbstractItemModel, option: QStyleOptionViewItem, index: QModelIndex) bool

Open file dialog on click.