schrodinger.ui.qt.network_visualizer module

network_visualizer.py

Description: This package is meant to visualize network-connection data. A good example of the type of data this is meant to visualize is at: http://networkx.lanl.gov/index.html While this module will allow for import of networkx files, it will not be written in such a way as to be limited to those files.

The main visualizer widget expected to be used is:

class NetworkViewer(QWidget)

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.ui.qt.network_visualizer.calculateArrow(end_point, arrow_end_point, mag=4, skew=4)

Calculate how to draw an arrow at the end_point of a line, this requires the line’s other endpoint so that we know the angle at which the arrow is to be drawn.

Returns

a QPolygonF containing the arrow

Parameters

mag (int) – controls the magnitude of the arrow head smaller value smaller smaller head

class schrodinger.ui.qt.network_visualizer.NetworkNode(model, network)

Bases: PyQt5.QtWidgets.QGraphicsRectItem

This is an abstract class for the Node’s of the graph, you can subclass from this class to render the data “val”, whatever it may be.

model_scale = 1200
default_size_factor = 50
__init__(model, network)
Parameters
  • model – the model node corresponding to this view node

  • network (NetworkViewer) – the graph view to which this node view belongs

getEdges()

Retrieve all the edges connected to this node.

syncModel()
scalePosToModel(pos)
scalePosFromModel(pos)
contextMenuEvent(e)

This is triggered when right clicking on a node

hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
mousePressEvent(e)

Accept mouse events so that selection doesnt get lost (QTBUG-10138)

Without this fix, when context menu is up, mouse events get propagated to the parent and it behaves as if you did not click on a node. This causes th

mouseMoveEvent(e)

Move the item and tell the network to redraw connection lines

mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
centerPos()
paint(self, QPainter, QStyleOptionGraphicsItem, widget: QWidget = None)
class CacheMode

Bases: int

DeviceCoordinateCache = 2
class GraphicsItemChange

Bases: int

class GraphicsItemFlag

Bases: int

class GraphicsItemFlags

Bases: sip.simplewrapper

QGraphicsItem.GraphicsItemFlags(Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag]) QGraphicsItem.GraphicsItemFlags(QGraphicsItem.GraphicsItemFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ItemAcceptsInputMethod = 4096
ItemChildAddedChange = 6
ItemChildRemovedChange = 7
ItemClipsChildrenToShape = 16
ItemClipsToShape = 8
ItemContainsChildrenInShape = 524288
ItemCoordinateCache = 1
ItemCursorChange = 17
ItemCursorHasChanged = 18
ItemDoesntPropagateOpacityToChildren = 128
ItemEnabledChange = 3
ItemEnabledHasChanged = 13
ItemFlagsChange = 21
ItemFlagsHaveChanged = 22
ItemHasNoContents = 1024
ItemIgnoresParentOpacity = 64
ItemIgnoresTransformations = 32
ItemIsFocusable = 4
ItemIsMovable = 1
ItemIsPanel = 16384
ItemIsSelectable = 2
ItemMatrixChange = 1
ItemNegativeZStacksBehindParent = 8192
ItemOpacityChange = 25
ItemOpacityHasChanged = 26
ItemParentChange = 5
ItemParentHasChanged = 15
ItemPositionChange = 0
ItemPositionHasChanged = 9
ItemRotationChange = 28
ItemRotationHasChanged = 29
ItemScaleChange = 30
ItemScaleHasChanged = 31
ItemSceneChange = 11
ItemSceneHasChanged = 16
ItemScenePositionHasChanged = 27
ItemSelectedChange = 4
ItemSelectedHasChanged = 14
ItemSendsGeometryChanges = 2048
ItemSendsScenePositionChanges = 65536
ItemStacksBehindParent = 256
ItemToolTipChange = 19
ItemToolTipHasChanged = 20
ItemTransformChange = 8
ItemTransformHasChanged = 10
ItemTransformOriginPointChange = 32
ItemTransformOriginPointHasChanged = 33
ItemUsesExtendedStyleOption = 512
ItemVisibleChange = 2
ItemVisibleHasChanged = 12
ItemZValueChange = 23
ItemZValueHasChanged = 24
NoCache = 0
NonModal = 0
PanelModal = 1
class PanelModality

Bases: int

SceneModal = 2
Type = 1
UserType = 65536
acceptDrops(self) → bool
acceptHoverEvents(self) → bool
acceptTouchEvents(self) → bool
acceptedMouseButtons(self) → Qt.MouseButtons
advance(self, int)
boundingRect(self) → QRectF
boundingRegion(self, QTransform) → QRegion
boundingRegionGranularity(self) → float
brush(self) → QBrush
cacheMode(self) → QGraphicsItem.CacheMode
childItems(self) → List[QGraphicsItem]
childrenBoundingRect(self) → QRectF
clearFocus(self)
clipPath(self) → QPainterPath
collidesWithItem(self, QGraphicsItem, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidesWithPath(self, QPainterPath, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidingItems(self, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → List[QGraphicsItem]
commonAncestorItem(self, QGraphicsItem) → QGraphicsItem
contains(self, Union[QPointF, QPoint]) → bool
cursor(self) → QCursor
data(self, int) → Any
deviceTransform(self, QTransform) → QTransform
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
effectiveOpacity(self) → float
ensureVisible(self, rect: QRectF = QRectF(), xMargin: int = 50, yMargin: int = 50)

ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)

filtersChildEvents(self) → bool
flags(self) → QGraphicsItem.GraphicsItemFlags
focusInEvent(self, QFocusEvent)
focusItem(self) → QGraphicsItem
focusOutEvent(self, QFocusEvent)
focusProxy(self) → QGraphicsItem
grabKeyboard(self)
grabMouse(self)
graphicsEffect(self) → QGraphicsEffect
group(self) → QGraphicsItemGroup
hasCursor(self) → bool
hasFocus(self) → bool
hide(self)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
installSceneEventFilter(self, QGraphicsItem)
isActive(self) → bool
isAncestorOf(self, QGraphicsItem) → bool
isBlockedByModalPanel(self) → Tuple[bool, QGraphicsItem]
isClipped(self) → bool
isEnabled(self) → bool
isObscured(self, rect: QRectF = QRectF()) → bool

isObscured(self, float, float, float, float) -> bool

isObscuredBy(self, QGraphicsItem) → bool
isPanel(self) → bool
isSelected(self) → bool
isUnderMouse(self) → bool
isVisible(self) → bool
isVisibleTo(self, QGraphicsItem) → bool
isWidget(self) → bool
isWindow(self) → bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) → Any
itemTransform(self, QGraphicsItem) → Tuple[QTransform, bool]
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mapFromItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapFromItem(self, QGraphicsItem, float, float) -> QPointF mapFromItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapFromParent(self, Union[QPointF, QPoint]) → QPointF

mapFromParent(self, QRectF) -> QPolygonF mapFromParent(self, QPolygonF) -> QPolygonF mapFromParent(self, QPainterPath) -> QPainterPath mapFromParent(self, float, float) -> QPointF mapFromParent(self, float, float, float, float) -> QPolygonF

mapFromScene(self, Union[QPointF, QPoint]) → QPointF

mapFromScene(self, QRectF) -> QPolygonF mapFromScene(self, QPolygonF) -> QPolygonF mapFromScene(self, QPainterPath) -> QPainterPath mapFromScene(self, float, float) -> QPointF mapFromScene(self, float, float, float, float) -> QPolygonF

mapRectFromItem(self, QGraphicsItem, QRectF) → QRectF

mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectFromParent(self, QRectF) → QRectF

mapRectFromParent(self, float, float, float, float) -> QRectF

mapRectFromScene(self, QRectF) → QRectF

mapRectFromScene(self, float, float, float, float) -> QRectF

mapRectToItem(self, QGraphicsItem, QRectF) → QRectF

mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectToParent(self, QRectF) → QRectF

mapRectToParent(self, float, float, float, float) -> QRectF

mapRectToScene(self, QRectF) → QRectF

mapRectToScene(self, float, float, float, float) -> QRectF

mapToItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapToItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapToItem(self, QGraphicsItem, float, float) -> QPointF mapToItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapToParent(self, Union[QPointF, QPoint]) → QPointF

mapToParent(self, QRectF) -> QPolygonF mapToParent(self, QPolygonF) -> QPolygonF mapToParent(self, QPainterPath) -> QPainterPath mapToParent(self, float, float) -> QPointF mapToParent(self, float, float, float, float) -> QPolygonF

mapToScene(self, Union[QPointF, QPoint]) → QPointF

mapToScene(self, QRectF) -> QPolygonF mapToScene(self, QPolygonF) -> QPolygonF mapToScene(self, QPainterPath) -> QPainterPath mapToScene(self, float, float) -> QPointF mapToScene(self, float, float, float, float) -> QPolygonF

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
NetworkNode.moveBy(self, float, float)
opacity(self) → float
opaqueArea(self) → QPainterPath
panel(self) → QGraphicsItem
panelModality(self) → QGraphicsItem.PanelModality
parentItem(self) → QGraphicsItem
parentObject(self) → QGraphicsObject
parentWidget(self) → QGraphicsWidget
pen(self) → QPen
pos(self) → QPointF
prepareGeometryChange(self)
rect(self) → QRectF
removeSceneEventFilter(self, QGraphicsItem)
resetTransform(self)
rotation(self) → float
scale(self) → float
scene(self) → QGraphicsScene
sceneBoundingRect(self) → QRectF
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
scenePos(self) → QPointF
sceneTransform(self) → QTransform
NetworkNode.scroll(self, float, float, rect: QRectF = QRectF())
setAcceptDrops(self, bool)
setAcceptHoverEvents(self, bool)
setAcceptTouchEvents(self, bool)
setAcceptedMouseButtons(self, Union[Qt.MouseButtons, Qt.MouseButton])
setActive(self, bool)
setBoundingRegionGranularity(self, float)
setBrush(self, Union[QBrush, QColor, Qt.GlobalColor, QGradient])
setCacheMode(self, QGraphicsItem.CacheMode, logicalCacheSize: QSize = QSize())
setCursor(self, Union[QCursor, Qt.CursorShape])
setData(self, int, Any)
setEnabled(self, bool)
setFiltersChildEvents(self, bool)
setFlag(self, QGraphicsItem.GraphicsItemFlag, enabled: bool = True)
setFlags(self, Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag])
setFocus(self, focusReason: Qt.FocusReason = Qt.OtherFocusReason)
setFocusProxy(self, QGraphicsItem)
setGraphicsEffect(self, QGraphicsEffect)
setGroup(self, QGraphicsItemGroup)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setOpacity(self, float)
setPanelModality(self, QGraphicsItem.PanelModality)
setParentItem(self, QGraphicsItem)
setPen(self, Union[QPen, QColor, Qt.GlobalColor, QGradient])
setPos(self, Union[QPointF, QPoint])

setPos(self, float, float)

setRect(self, QRectF)

setRect(self, float, float, float, float)

setRotation(self, float)
setScale(self, float)
setSelected(self, bool)
setToolTip(self, str)
setTransform(self, QTransform, combine: bool = False)
setTransformOriginPoint(self, Union[QPointF, QPoint])

setTransformOriginPoint(self, float, float)

setTransformations(self, Iterable[QGraphicsTransform])
setVisible(self, bool)
setX(self, float)
setY(self, float)
setZValue(self, float)
shape(self) → QPainterPath
show(self)
stackBefore(self, QGraphicsItem)
toGraphicsObject(self) → QGraphicsObject
toolTip(self) → str
topLevelItem(self) → QGraphicsItem
topLevelWidget(self) → QGraphicsWidget
transform(self) → QTransform
transformOriginPoint(self) → QPointF
transformations(self) → List[QGraphicsTransform]
type(self) → int
ungrabKeyboard(self)
ungrabMouse(self)
unsetCursor(self)
update(self, rect: QRectF = QRectF())

update(self, float, float, float, float)

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
window(self) → QGraphicsWidget
x(self) → float
y(self) → float
zValue(self) → float
class schrodinger.ui.qt.network_visualizer.TextNetworkNode(model, network, text_attr=None)

Bases: schrodinger.ui.qt.network_visualizer.NetworkNode

Network node that optionally displays the string representation of a node attribute as text.

text_y_pos = 150
text_size = 100
text_offset = 5
__init__(model, network, text_attr=None)
Parameters
  • model – the model node corresponding to this view node

  • network (NetworkViewer) – the graph view to which this node view belongs

  • text_attr (str or NoneType) – the name of the model node attribute which will be used as the source of the text for this view node (optional)

syncModel()
class CacheMode

Bases: int

DeviceCoordinateCache = 2
class GraphicsItemChange

Bases: int

class GraphicsItemFlag

Bases: int

class GraphicsItemFlags

Bases: sip.simplewrapper

QGraphicsItem.GraphicsItemFlags(Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag]) QGraphicsItem.GraphicsItemFlags(QGraphicsItem.GraphicsItemFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ItemAcceptsInputMethod = 4096
ItemChildAddedChange = 6
ItemChildRemovedChange = 7
ItemClipsChildrenToShape = 16
ItemClipsToShape = 8
ItemContainsChildrenInShape = 524288
ItemCoordinateCache = 1
ItemCursorChange = 17
ItemCursorHasChanged = 18
ItemDoesntPropagateOpacityToChildren = 128
ItemEnabledChange = 3
ItemEnabledHasChanged = 13
ItemFlagsChange = 21
ItemFlagsHaveChanged = 22
ItemHasNoContents = 1024
ItemIgnoresParentOpacity = 64
ItemIgnoresTransformations = 32
ItemIsFocusable = 4
ItemIsMovable = 1
ItemIsPanel = 16384
ItemIsSelectable = 2
ItemMatrixChange = 1
ItemNegativeZStacksBehindParent = 8192
ItemOpacityChange = 25
ItemOpacityHasChanged = 26
ItemParentChange = 5
ItemParentHasChanged = 15
ItemPositionChange = 0
ItemPositionHasChanged = 9
ItemRotationChange = 28
ItemRotationHasChanged = 29
ItemScaleChange = 30
ItemScaleHasChanged = 31
ItemSceneChange = 11
ItemSceneHasChanged = 16
ItemScenePositionHasChanged = 27
ItemSelectedChange = 4
ItemSelectedHasChanged = 14
ItemSendsGeometryChanges = 2048
ItemSendsScenePositionChanges = 65536
ItemStacksBehindParent = 256
ItemToolTipChange = 19
ItemToolTipHasChanged = 20
ItemTransformChange = 8
ItemTransformHasChanged = 10
ItemTransformOriginPointChange = 32
ItemTransformOriginPointHasChanged = 33
ItemUsesExtendedStyleOption = 512
ItemVisibleChange = 2
ItemVisibleHasChanged = 12
ItemZValueChange = 23
ItemZValueHasChanged = 24
NoCache = 0
NonModal = 0
PanelModal = 1
class PanelModality

Bases: int

SceneModal = 2
Type = 1
UserType = 65536
acceptDrops(self) → bool
acceptHoverEvents(self) → bool
acceptTouchEvents(self) → bool
acceptedMouseButtons(self) → Qt.MouseButtons
advance(self, int)
boundingRect(self) → QRectF
boundingRegion(self, QTransform) → QRegion
boundingRegionGranularity(self) → float
brush(self) → QBrush
cacheMode(self) → QGraphicsItem.CacheMode
centerPos()
childItems(self) → List[QGraphicsItem]
childrenBoundingRect(self) → QRectF
clearFocus(self)
clipPath(self) → QPainterPath
collidesWithItem(self, QGraphicsItem, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidesWithPath(self, QPainterPath, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidingItems(self, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → List[QGraphicsItem]
commonAncestorItem(self, QGraphicsItem) → QGraphicsItem
contains(self, Union[QPointF, QPoint]) → bool
contextMenuEvent(e)

This is triggered when right clicking on a node

cursor(self) → QCursor
data(self, int) → Any
default_size_factor = 50
deviceTransform(self, QTransform) → QTransform
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
effectiveOpacity(self) → float
ensureVisible(self, rect: QRectF = QRectF(), xMargin: int = 50, yMargin: int = 50)

ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)

filtersChildEvents(self) → bool
flags(self) → QGraphicsItem.GraphicsItemFlags
focusInEvent(self, QFocusEvent)
focusItem(self) → QGraphicsItem
focusOutEvent(self, QFocusEvent)
focusProxy(self) → QGraphicsItem
getEdges()

Retrieve all the edges connected to this node.

grabKeyboard(self)
grabMouse(self)
graphicsEffect(self) → QGraphicsEffect
group(self) → QGraphicsItemGroup
hasCursor(self) → bool
hasFocus(self) → bool
hide(self)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
installSceneEventFilter(self, QGraphicsItem)
isActive(self) → bool
isAncestorOf(self, QGraphicsItem) → bool
isBlockedByModalPanel(self) → Tuple[bool, QGraphicsItem]
isClipped(self) → bool
isEnabled(self) → bool
isObscured(self, rect: QRectF = QRectF()) → bool

isObscured(self, float, float, float, float) -> bool

isObscuredBy(self, QGraphicsItem) → bool
isPanel(self) → bool
isSelected(self) → bool
isUnderMouse(self) → bool
isVisible(self) → bool
isVisibleTo(self, QGraphicsItem) → bool
isWidget(self) → bool
isWindow(self) → bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) → Any
itemTransform(self, QGraphicsItem) → Tuple[QTransform, bool]
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mapFromItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapFromItem(self, QGraphicsItem, float, float) -> QPointF mapFromItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapFromParent(self, Union[QPointF, QPoint]) → QPointF

mapFromParent(self, QRectF) -> QPolygonF mapFromParent(self, QPolygonF) -> QPolygonF mapFromParent(self, QPainterPath) -> QPainterPath mapFromParent(self, float, float) -> QPointF mapFromParent(self, float, float, float, float) -> QPolygonF

mapFromScene(self, Union[QPointF, QPoint]) → QPointF

mapFromScene(self, QRectF) -> QPolygonF mapFromScene(self, QPolygonF) -> QPolygonF mapFromScene(self, QPainterPath) -> QPainterPath mapFromScene(self, float, float) -> QPointF mapFromScene(self, float, float, float, float) -> QPolygonF

mapRectFromItem(self, QGraphicsItem, QRectF) → QRectF

mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectFromParent(self, QRectF) → QRectF

mapRectFromParent(self, float, float, float, float) -> QRectF

mapRectFromScene(self, QRectF) → QRectF

mapRectFromScene(self, float, float, float, float) -> QRectF

mapRectToItem(self, QGraphicsItem, QRectF) → QRectF

mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectToParent(self, QRectF) → QRectF

mapRectToParent(self, float, float, float, float) -> QRectF

mapRectToScene(self, QRectF) → QRectF

mapRectToScene(self, float, float, float, float) -> QRectF

mapToItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapToItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapToItem(self, QGraphicsItem, float, float) -> QPointF mapToItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapToParent(self, Union[QPointF, QPoint]) → QPointF

mapToParent(self, QRectF) -> QPolygonF mapToParent(self, QPolygonF) -> QPolygonF mapToParent(self, QPainterPath) -> QPainterPath mapToParent(self, float, float) -> QPointF mapToParent(self, float, float, float, float) -> QPolygonF

mapToScene(self, Union[QPointF, QPoint]) → QPointF

mapToScene(self, QRectF) -> QPolygonF mapToScene(self, QPolygonF) -> QPolygonF mapToScene(self, QPainterPath) -> QPainterPath mapToScene(self, float, float) -> QPointF mapToScene(self, float, float, float, float) -> QPolygonF

model_scale = 1200
mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
mouseMoveEvent(e)

Move the item and tell the network to redraw connection lines

mousePressEvent(e)

Accept mouse events so that selection doesnt get lost (QTBUG-10138)

Without this fix, when context menu is up, mouse events get propagated to the parent and it behaves as if you did not click on a node. This causes th

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
TextNetworkNode.moveBy(self, float, float)
opacity(self) → float
opaqueArea(self) → QPainterPath
paint(self, QPainter, QStyleOptionGraphicsItem, widget: QWidget = None)
panel(self) → QGraphicsItem
panelModality(self) → QGraphicsItem.PanelModality
parentItem(self) → QGraphicsItem
parentObject(self) → QGraphicsObject
parentWidget(self) → QGraphicsWidget
pen(self) → QPen
pos(self) → QPointF
prepareGeometryChange(self)
rect(self) → QRectF
removeSceneEventFilter(self, QGraphicsItem)
resetTransform(self)
rotation(self) → float
scale(self) → float
scalePosFromModel(pos)
scalePosToModel(pos)
scene(self) → QGraphicsScene
sceneBoundingRect(self) → QRectF
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
scenePos(self) → QPointF
sceneTransform(self) → QTransform
TextNetworkNode.scroll(self, float, float, rect: QRectF = QRectF())
setAcceptDrops(self, bool)
setAcceptHoverEvents(self, bool)
setAcceptTouchEvents(self, bool)
setAcceptedMouseButtons(self, Union[Qt.MouseButtons, Qt.MouseButton])
setActive(self, bool)
setBoundingRegionGranularity(self, float)
setBrush(self, Union[QBrush, QColor, Qt.GlobalColor, QGradient])
setCacheMode(self, QGraphicsItem.CacheMode, logicalCacheSize: QSize = QSize())
setCursor(self, Union[QCursor, Qt.CursorShape])
setData(self, int, Any)
setEnabled(self, bool)
setFiltersChildEvents(self, bool)
setFlag(self, QGraphicsItem.GraphicsItemFlag, enabled: bool = True)
setFlags(self, Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag])
setFocus(self, focusReason: Qt.FocusReason = Qt.OtherFocusReason)
setFocusProxy(self, QGraphicsItem)
setGraphicsEffect(self, QGraphicsEffect)
setGroup(self, QGraphicsItemGroup)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setOpacity(self, float)
setPanelModality(self, QGraphicsItem.PanelModality)
setParentItem(self, QGraphicsItem)
setPen(self, Union[QPen, QColor, Qt.GlobalColor, QGradient])
setPos(self, Union[QPointF, QPoint])

setPos(self, float, float)

setRect(self, QRectF)

setRect(self, float, float, float, float)

setRotation(self, float)
setScale(self, float)
setSelected(self, bool)
setToolTip(self, str)
setTransform(self, QTransform, combine: bool = False)
setTransformOriginPoint(self, Union[QPointF, QPoint])

setTransformOriginPoint(self, float, float)

setTransformations(self, Iterable[QGraphicsTransform])
setVisible(self, bool)
setX(self, float)
setY(self, float)
setZValue(self, float)
shape(self) → QPainterPath
show(self)
stackBefore(self, QGraphicsItem)
toGraphicsObject(self) → QGraphicsObject
toolTip(self) → str
topLevelItem(self) → QGraphicsItem
topLevelWidget(self) → QGraphicsWidget
transform(self) → QTransform
transformOriginPoint(self) → QPointF
transformations(self) → List[QGraphicsTransform]
type(self) → int
ungrabKeyboard(self)
ungrabMouse(self)
unsetCursor(self)
update(self, rect: QRectF = QRectF())

update(self, float, float, float, float)

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
window(self) → QGraphicsWidget
x(self) → float
y(self) → float
zValue(self) → float
class schrodinger.ui.qt.network_visualizer.PosTextNetworkNode(model, network, text_attr=None)

Bases: schrodinger.ui.qt.network_visualizer.TextNetworkNode

text_size = 50
syncModel()
mouseMoveEvent(e)

Move the item and tell the network to redraw connection lines

class CacheMode

Bases: int

DeviceCoordinateCache = 2
class GraphicsItemChange

Bases: int

class GraphicsItemFlag

Bases: int

class GraphicsItemFlags

Bases: sip.simplewrapper

QGraphicsItem.GraphicsItemFlags(Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag]) QGraphicsItem.GraphicsItemFlags(QGraphicsItem.GraphicsItemFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ItemAcceptsInputMethod = 4096
ItemChildAddedChange = 6
ItemChildRemovedChange = 7
ItemClipsChildrenToShape = 16
ItemClipsToShape = 8
ItemContainsChildrenInShape = 524288
ItemCoordinateCache = 1
ItemCursorChange = 17
ItemCursorHasChanged = 18
ItemDoesntPropagateOpacityToChildren = 128
ItemEnabledChange = 3
ItemEnabledHasChanged = 13
ItemFlagsChange = 21
ItemFlagsHaveChanged = 22
ItemHasNoContents = 1024
ItemIgnoresParentOpacity = 64
ItemIgnoresTransformations = 32
ItemIsFocusable = 4
ItemIsMovable = 1
ItemIsPanel = 16384
ItemIsSelectable = 2
ItemMatrixChange = 1
ItemNegativeZStacksBehindParent = 8192
ItemOpacityChange = 25
ItemOpacityHasChanged = 26
ItemParentChange = 5
ItemParentHasChanged = 15
ItemPositionChange = 0
ItemPositionHasChanged = 9
ItemRotationChange = 28
ItemRotationHasChanged = 29
ItemScaleChange = 30
ItemScaleHasChanged = 31
ItemSceneChange = 11
ItemSceneHasChanged = 16
ItemScenePositionHasChanged = 27
ItemSelectedChange = 4
ItemSelectedHasChanged = 14
ItemSendsGeometryChanges = 2048
ItemSendsScenePositionChanges = 65536
ItemStacksBehindParent = 256
ItemToolTipChange = 19
ItemToolTipHasChanged = 20
ItemTransformChange = 8
ItemTransformHasChanged = 10
ItemTransformOriginPointChange = 32
ItemTransformOriginPointHasChanged = 33
ItemUsesExtendedStyleOption = 512
ItemVisibleChange = 2
ItemVisibleHasChanged = 12
ItemZValueChange = 23
ItemZValueHasChanged = 24
NoCache = 0
NonModal = 0
PanelModal = 1
class PanelModality

Bases: int

SceneModal = 2
Type = 1
UserType = 65536
__init__(model, network, text_attr=None)
Parameters
  • model – the model node corresponding to this view node

  • network (NetworkViewer) – the graph view to which this node view belongs

  • text_attr (str or NoneType) – the name of the model node attribute which will be used as the source of the text for this view node (optional)

acceptDrops(self) → bool
acceptHoverEvents(self) → bool
acceptTouchEvents(self) → bool
acceptedMouseButtons(self) → Qt.MouseButtons
advance(self, int)
boundingRect(self) → QRectF
boundingRegion(self, QTransform) → QRegion
boundingRegionGranularity(self) → float
brush(self) → QBrush
cacheMode(self) → QGraphicsItem.CacheMode
centerPos()
childItems(self) → List[QGraphicsItem]
childrenBoundingRect(self) → QRectF
clearFocus(self)
clipPath(self) → QPainterPath
collidesWithItem(self, QGraphicsItem, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidesWithPath(self, QPainterPath, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidingItems(self, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → List[QGraphicsItem]
commonAncestorItem(self, QGraphicsItem) → QGraphicsItem
contains(self, Union[QPointF, QPoint]) → bool
contextMenuEvent(e)

This is triggered when right clicking on a node

cursor(self) → QCursor
data(self, int) → Any
default_size_factor = 50
deviceTransform(self, QTransform) → QTransform
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
effectiveOpacity(self) → float
ensureVisible(self, rect: QRectF = QRectF(), xMargin: int = 50, yMargin: int = 50)

ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)

filtersChildEvents(self) → bool
flags(self) → QGraphicsItem.GraphicsItemFlags
focusInEvent(self, QFocusEvent)
focusItem(self) → QGraphicsItem
focusOutEvent(self, QFocusEvent)
focusProxy(self) → QGraphicsItem
getEdges()

Retrieve all the edges connected to this node.

grabKeyboard(self)
grabMouse(self)
graphicsEffect(self) → QGraphicsEffect
group(self) → QGraphicsItemGroup
hasCursor(self) → bool
hasFocus(self) → bool
hide(self)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
installSceneEventFilter(self, QGraphicsItem)
isActive(self) → bool
isAncestorOf(self, QGraphicsItem) → bool
isBlockedByModalPanel(self) → Tuple[bool, QGraphicsItem]
isClipped(self) → bool
isEnabled(self) → bool
isObscured(self, rect: QRectF = QRectF()) → bool

isObscured(self, float, float, float, float) -> bool

isObscuredBy(self, QGraphicsItem) → bool
isPanel(self) → bool
isSelected(self) → bool
isUnderMouse(self) → bool
isVisible(self) → bool
isVisibleTo(self, QGraphicsItem) → bool
isWidget(self) → bool
isWindow(self) → bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) → Any
itemTransform(self, QGraphicsItem) → Tuple[QTransform, bool]
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mapFromItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapFromItem(self, QGraphicsItem, float, float) -> QPointF mapFromItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapFromParent(self, Union[QPointF, QPoint]) → QPointF

mapFromParent(self, QRectF) -> QPolygonF mapFromParent(self, QPolygonF) -> QPolygonF mapFromParent(self, QPainterPath) -> QPainterPath mapFromParent(self, float, float) -> QPointF mapFromParent(self, float, float, float, float) -> QPolygonF

mapFromScene(self, Union[QPointF, QPoint]) → QPointF

mapFromScene(self, QRectF) -> QPolygonF mapFromScene(self, QPolygonF) -> QPolygonF mapFromScene(self, QPainterPath) -> QPainterPath mapFromScene(self, float, float) -> QPointF mapFromScene(self, float, float, float, float) -> QPolygonF

mapRectFromItem(self, QGraphicsItem, QRectF) → QRectF

mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectFromParent(self, QRectF) → QRectF

mapRectFromParent(self, float, float, float, float) -> QRectF

mapRectFromScene(self, QRectF) → QRectF

mapRectFromScene(self, float, float, float, float) -> QRectF

mapRectToItem(self, QGraphicsItem, QRectF) → QRectF

mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectToParent(self, QRectF) → QRectF

mapRectToParent(self, float, float, float, float) -> QRectF

mapRectToScene(self, QRectF) → QRectF

mapRectToScene(self, float, float, float, float) -> QRectF

mapToItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapToItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapToItem(self, QGraphicsItem, float, float) -> QPointF mapToItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapToParent(self, Union[QPointF, QPoint]) → QPointF

mapToParent(self, QRectF) -> QPolygonF mapToParent(self, QPolygonF) -> QPolygonF mapToParent(self, QPainterPath) -> QPainterPath mapToParent(self, float, float) -> QPointF mapToParent(self, float, float, float, float) -> QPolygonF

mapToScene(self, Union[QPointF, QPoint]) → QPointF

mapToScene(self, QRectF) -> QPolygonF mapToScene(self, QPolygonF) -> QPolygonF mapToScene(self, QPainterPath) -> QPainterPath mapToScene(self, float, float) -> QPointF mapToScene(self, float, float, float, float) -> QPolygonF

model_scale = 1200
mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
mousePressEvent(e)

Accept mouse events so that selection doesnt get lost (QTBUG-10138)

Without this fix, when context menu is up, mouse events get propagated to the parent and it behaves as if you did not click on a node. This causes th

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
PosTextNetworkNode.moveBy(self, float, float)
opacity(self) → float
opaqueArea(self) → QPainterPath
paint(self, QPainter, QStyleOptionGraphicsItem, widget: QWidget = None)
panel(self) → QGraphicsItem
panelModality(self) → QGraphicsItem.PanelModality
parentItem(self) → QGraphicsItem
parentObject(self) → QGraphicsObject
parentWidget(self) → QGraphicsWidget
pen(self) → QPen
pos(self) → QPointF
prepareGeometryChange(self)
rect(self) → QRectF
removeSceneEventFilter(self, QGraphicsItem)
resetTransform(self)
rotation(self) → float
scale(self) → float
scalePosFromModel(pos)
scalePosToModel(pos)
scene(self) → QGraphicsScene
sceneBoundingRect(self) → QRectF
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
scenePos(self) → QPointF
sceneTransform(self) → QTransform
PosTextNetworkNode.scroll(self, float, float, rect: QRectF = QRectF())
setAcceptDrops(self, bool)
setAcceptHoverEvents(self, bool)
setAcceptTouchEvents(self, bool)
setAcceptedMouseButtons(self, Union[Qt.MouseButtons, Qt.MouseButton])
setActive(self, bool)
setBoundingRegionGranularity(self, float)
setBrush(self, Union[QBrush, QColor, Qt.GlobalColor, QGradient])
setCacheMode(self, QGraphicsItem.CacheMode, logicalCacheSize: QSize = QSize())
setCursor(self, Union[QCursor, Qt.CursorShape])
setData(self, int, Any)
setEnabled(self, bool)
setFiltersChildEvents(self, bool)
setFlag(self, QGraphicsItem.GraphicsItemFlag, enabled: bool = True)
setFlags(self, Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag])
setFocus(self, focusReason: Qt.FocusReason = Qt.OtherFocusReason)
setFocusProxy(self, QGraphicsItem)
setGraphicsEffect(self, QGraphicsEffect)
setGroup(self, QGraphicsItemGroup)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setOpacity(self, float)
setPanelModality(self, QGraphicsItem.PanelModality)
setParentItem(self, QGraphicsItem)
setPen(self, Union[QPen, QColor, Qt.GlobalColor, QGradient])
setPos(self, Union[QPointF, QPoint])

setPos(self, float, float)

setRect(self, QRectF)

setRect(self, float, float, float, float)

setRotation(self, float)
setScale(self, float)
setSelected(self, bool)
setToolTip(self, str)
setTransform(self, QTransform, combine: bool = False)
setTransformOriginPoint(self, Union[QPointF, QPoint])

setTransformOriginPoint(self, float, float)

setTransformations(self, Iterable[QGraphicsTransform])
setVisible(self, bool)
setX(self, float)
setY(self, float)
setZValue(self, float)
shape(self) → QPainterPath
show(self)
stackBefore(self, QGraphicsItem)
text_offset = 5
text_y_pos = 150
toGraphicsObject(self) → QGraphicsObject
toolTip(self) → str
topLevelItem(self) → QGraphicsItem
topLevelWidget(self) → QGraphicsWidget
transform(self) → QTransform
transformOriginPoint(self) → QPointF
transformations(self) → List[QGraphicsTransform]
type(self) → int
ungrabKeyboard(self)
ungrabMouse(self)
unsetCursor(self)
update(self, rect: QRectF = QRectF())

update(self, float, float, float, float)

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
window(self) → QGraphicsWidget
x(self) → float
y(self) → float
zValue(self) → float
class schrodinger.ui.qt.network_visualizer.SmilesNetworkNode(x, y, val, allow_movement, text='')

Bases: schrodinger.ui.qt.network_visualizer.TextNetworkNode

This renders the input variable ‘val’ as a 2D-Structure, assuming it’s a smiles that can be converted to a 2d structure.

text_y_pos = 10000
text_size = 60
__init__(x, y, val, allow_movement, text='')
Parameters
  • model – the model node corresponding to this view node

  • network (NetworkViewer) – the graph view to which this node view belongs

  • text_attr (str or NoneType) – the name of the model node attribute which will be used as the source of the text for this view node (optional)

class CacheMode

Bases: int

DeviceCoordinateCache = 2
class GraphicsItemChange

Bases: int

class GraphicsItemFlag

Bases: int

class GraphicsItemFlags

Bases: sip.simplewrapper

QGraphicsItem.GraphicsItemFlags(Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag]) QGraphicsItem.GraphicsItemFlags(QGraphicsItem.GraphicsItemFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ItemAcceptsInputMethod = 4096
ItemChildAddedChange = 6
ItemChildRemovedChange = 7
ItemClipsChildrenToShape = 16
ItemClipsToShape = 8
ItemContainsChildrenInShape = 524288
ItemCoordinateCache = 1
ItemCursorChange = 17
ItemCursorHasChanged = 18
ItemDoesntPropagateOpacityToChildren = 128
ItemEnabledChange = 3
ItemEnabledHasChanged = 13
ItemFlagsChange = 21
ItemFlagsHaveChanged = 22
ItemHasNoContents = 1024
ItemIgnoresParentOpacity = 64
ItemIgnoresTransformations = 32
ItemIsFocusable = 4
ItemIsMovable = 1
ItemIsPanel = 16384
ItemIsSelectable = 2
ItemMatrixChange = 1
ItemNegativeZStacksBehindParent = 8192
ItemOpacityChange = 25
ItemOpacityHasChanged = 26
ItemParentChange = 5
ItemParentHasChanged = 15
ItemPositionChange = 0
ItemPositionHasChanged = 9
ItemRotationChange = 28
ItemRotationHasChanged = 29
ItemScaleChange = 30
ItemScaleHasChanged = 31
ItemSceneChange = 11
ItemSceneHasChanged = 16
ItemScenePositionHasChanged = 27
ItemSelectedChange = 4
ItemSelectedHasChanged = 14
ItemSendsGeometryChanges = 2048
ItemSendsScenePositionChanges = 65536
ItemStacksBehindParent = 256
ItemToolTipChange = 19
ItemToolTipHasChanged = 20
ItemTransformChange = 8
ItemTransformHasChanged = 10
ItemTransformOriginPointChange = 32
ItemTransformOriginPointHasChanged = 33
ItemUsesExtendedStyleOption = 512
ItemVisibleChange = 2
ItemVisibleHasChanged = 12
ItemZValueChange = 23
ItemZValueHasChanged = 24
NoCache = 0
NonModal = 0
PanelModal = 1
class PanelModality

Bases: int

SceneModal = 2
Type = 1
UserType = 65536
acceptDrops(self) → bool
acceptHoverEvents(self) → bool
acceptTouchEvents(self) → bool
acceptedMouseButtons(self) → Qt.MouseButtons
advance(self, int)
boundingRect(self) → QRectF
boundingRegion(self, QTransform) → QRegion
boundingRegionGranularity(self) → float
brush(self) → QBrush
cacheMode(self) → QGraphicsItem.CacheMode
centerPos()
childItems(self) → List[QGraphicsItem]
childrenBoundingRect(self) → QRectF
clearFocus(self)
clipPath(self) → QPainterPath
collidesWithItem(self, QGraphicsItem, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidesWithPath(self, QPainterPath, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidingItems(self, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → List[QGraphicsItem]
commonAncestorItem(self, QGraphicsItem) → QGraphicsItem
contains(self, Union[QPointF, QPoint]) → bool
contextMenuEvent(e)

This is triggered when right clicking on a node

cursor(self) → QCursor
data(self, int) → Any
default_size_factor = 50
deviceTransform(self, QTransform) → QTransform
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
effectiveOpacity(self) → float
ensureVisible(self, rect: QRectF = QRectF(), xMargin: int = 50, yMargin: int = 50)

ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)

filtersChildEvents(self) → bool
flags(self) → QGraphicsItem.GraphicsItemFlags
focusInEvent(self, QFocusEvent)
focusItem(self) → QGraphicsItem
focusOutEvent(self, QFocusEvent)
focusProxy(self) → QGraphicsItem
getEdges()

Retrieve all the edges connected to this node.

grabKeyboard(self)
grabMouse(self)
graphicsEffect(self) → QGraphicsEffect
group(self) → QGraphicsItemGroup
hasCursor(self) → bool
hasFocus(self) → bool
hide(self)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
installSceneEventFilter(self, QGraphicsItem)
isActive(self) → bool
isAncestorOf(self, QGraphicsItem) → bool
isBlockedByModalPanel(self) → Tuple[bool, QGraphicsItem]
isClipped(self) → bool
isEnabled(self) → bool
isObscured(self, rect: QRectF = QRectF()) → bool

isObscured(self, float, float, float, float) -> bool

isObscuredBy(self, QGraphicsItem) → bool
isPanel(self) → bool
isSelected(self) → bool
isUnderMouse(self) → bool
isVisible(self) → bool
isVisibleTo(self, QGraphicsItem) → bool
isWidget(self) → bool
isWindow(self) → bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) → Any
itemTransform(self, QGraphicsItem) → Tuple[QTransform, bool]
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mapFromItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapFromItem(self, QGraphicsItem, float, float) -> QPointF mapFromItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapFromParent(self, Union[QPointF, QPoint]) → QPointF

mapFromParent(self, QRectF) -> QPolygonF mapFromParent(self, QPolygonF) -> QPolygonF mapFromParent(self, QPainterPath) -> QPainterPath mapFromParent(self, float, float) -> QPointF mapFromParent(self, float, float, float, float) -> QPolygonF

mapFromScene(self, Union[QPointF, QPoint]) → QPointF

mapFromScene(self, QRectF) -> QPolygonF mapFromScene(self, QPolygonF) -> QPolygonF mapFromScene(self, QPainterPath) -> QPainterPath mapFromScene(self, float, float) -> QPointF mapFromScene(self, float, float, float, float) -> QPolygonF

mapRectFromItem(self, QGraphicsItem, QRectF) → QRectF

mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectFromParent(self, QRectF) → QRectF

mapRectFromParent(self, float, float, float, float) -> QRectF

mapRectFromScene(self, QRectF) → QRectF

mapRectFromScene(self, float, float, float, float) -> QRectF

mapRectToItem(self, QGraphicsItem, QRectF) → QRectF

mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectToParent(self, QRectF) → QRectF

mapRectToParent(self, float, float, float, float) -> QRectF

mapRectToScene(self, QRectF) → QRectF

mapRectToScene(self, float, float, float, float) -> QRectF

mapToItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapToItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapToItem(self, QGraphicsItem, float, float) -> QPointF mapToItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapToParent(self, Union[QPointF, QPoint]) → QPointF

mapToParent(self, QRectF) -> QPolygonF mapToParent(self, QPolygonF) -> QPolygonF mapToParent(self, QPainterPath) -> QPainterPath mapToParent(self, float, float) -> QPointF mapToParent(self, float, float, float, float) -> QPolygonF

mapToScene(self, Union[QPointF, QPoint]) → QPointF

mapToScene(self, QRectF) -> QPolygonF mapToScene(self, QPolygonF) -> QPolygonF mapToScene(self, QPainterPath) -> QPainterPath mapToScene(self, float, float) -> QPointF mapToScene(self, float, float, float, float) -> QPolygonF

model_scale = 1200
mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
mouseMoveEvent(e)

Move the item and tell the network to redraw connection lines

mousePressEvent(e)

Accept mouse events so that selection doesnt get lost (QTBUG-10138)

Without this fix, when context menu is up, mouse events get propagated to the parent and it behaves as if you did not click on a node. This causes th

mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
SmilesNetworkNode.moveBy(self, float, float)
opacity(self) → float
opaqueArea(self) → QPainterPath
paint(self, QPainter, QStyleOptionGraphicsItem, widget: QWidget = None)
panel(self) → QGraphicsItem
panelModality(self) → QGraphicsItem.PanelModality
parentItem(self) → QGraphicsItem
parentObject(self) → QGraphicsObject
parentWidget(self) → QGraphicsWidget
pen(self) → QPen
pos(self) → QPointF
prepareGeometryChange(self)
rect(self) → QRectF
removeSceneEventFilter(self, QGraphicsItem)
resetTransform(self)
rotation(self) → float
scale(self) → float
scalePosFromModel(pos)
scalePosToModel(pos)
scene(self) → QGraphicsScene
sceneBoundingRect(self) → QRectF
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
scenePos(self) → QPointF
sceneTransform(self) → QTransform
SmilesNetworkNode.scroll(self, float, float, rect: QRectF = QRectF())
setAcceptDrops(self, bool)
setAcceptHoverEvents(self, bool)
setAcceptTouchEvents(self, bool)
setAcceptedMouseButtons(self, Union[Qt.MouseButtons, Qt.MouseButton])
setActive(self, bool)
setBoundingRegionGranularity(self, float)
setBrush(self, Union[QBrush, QColor, Qt.GlobalColor, QGradient])
setCacheMode(self, QGraphicsItem.CacheMode, logicalCacheSize: QSize = QSize())
setCursor(self, Union[QCursor, Qt.CursorShape])
setData(self, int, Any)
setEnabled(self, bool)
setFiltersChildEvents(self, bool)
setFlag(self, QGraphicsItem.GraphicsItemFlag, enabled: bool = True)
setFlags(self, Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag])
setFocus(self, focusReason: Qt.FocusReason = Qt.OtherFocusReason)
setFocusProxy(self, QGraphicsItem)
setGraphicsEffect(self, QGraphicsEffect)
setGroup(self, QGraphicsItemGroup)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setOpacity(self, float)
setPanelModality(self, QGraphicsItem.PanelModality)
setParentItem(self, QGraphicsItem)
setPen(self, Union[QPen, QColor, Qt.GlobalColor, QGradient])
setPos(self, Union[QPointF, QPoint])

setPos(self, float, float)

setRect(self, QRectF)

setRect(self, float, float, float, float)

setRotation(self, float)
setScale(self, float)
setSelected(self, bool)
setToolTip(self, str)
setTransform(self, QTransform, combine: bool = False)
setTransformOriginPoint(self, Union[QPointF, QPoint])

setTransformOriginPoint(self, float, float)

setTransformations(self, Iterable[QGraphicsTransform])
setVisible(self, bool)
setX(self, float)
setY(self, float)
setZValue(self, float)
shape(self) → QPainterPath
show(self)
stackBefore(self, QGraphicsItem)
syncModel()
text_offset = 5
toGraphicsObject(self) → QGraphicsObject
toolTip(self) → str
topLevelItem(self) → QGraphicsItem
topLevelWidget(self) → QGraphicsWidget
transform(self) → QTransform
transformOriginPoint(self) → QPointF
transformations(self) → List[QGraphicsTransform]
type(self) → int
ungrabKeyboard(self)
ungrabMouse(self)
unsetCursor(self)
update(self, rect: QRectF = QRectF())

update(self, float, float, float, float)

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
window(self) → QGraphicsWidget
x(self) → float
y(self) → float
zValue(self) → float
class schrodinger.ui.qt.network_visualizer.NetworkEdge(node1, node2, network, dotted=False, opacity=1.0, label=None)

Bases: PyQt5.QtWidgets.QGraphicsPathItem

Right now this is just like a regular line, but will allow for extension to avoid connection/node intersections if so desired in the future.

__init__(node1, node2, network, dotted=False, opacity=1.0, label=None)

Initialize self. See help(type(self)) for accurate signature.

property model_edge
Returns

the model edge corresponding with this view edge

Return type

Edge

getOtherNode(node)
syncModel()
setLabel(text, html=False)

Show text along edge :param text: label text :type text: str

setArrowhead(enable, head_node=None)
showBadEdge(is_bad)

Mark this edge as ‘bad’. It will be shown with red color.

Parameters

is_bad (bool) – True or False to indicate whether this edge is ‘bad’.

mouseDoubleClickEvent(self, QGraphicsSceneMouseEvent)
hoverEnterEvent(self, QGraphicsSceneHoverEvent)
hoverLeaveEvent(self, QGraphicsSceneHoverEvent)
contextMenuEvent(e)

This is triggered when right clicking on an edge

boundingRect(self) → QRectF
paint(self, QPainter, QStyleOptionGraphicsItem, widget: QWidget = None)
recalculateShape()

This function recalculates the shape (line, perhaps with arrow) to draw for the connection between two nodes.

nodeIntersectionPoint(node)
class CacheMode

Bases: int

DeviceCoordinateCache = 2
class GraphicsItemChange

Bases: int

class GraphicsItemFlag

Bases: int

class GraphicsItemFlags

Bases: sip.simplewrapper

QGraphicsItem.GraphicsItemFlags(Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag]) QGraphicsItem.GraphicsItemFlags(QGraphicsItem.GraphicsItemFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

ItemAcceptsInputMethod = 4096
ItemChildAddedChange = 6
ItemChildRemovedChange = 7
ItemClipsChildrenToShape = 16
ItemClipsToShape = 8
ItemContainsChildrenInShape = 524288
ItemCoordinateCache = 1
ItemCursorChange = 17
ItemCursorHasChanged = 18
ItemDoesntPropagateOpacityToChildren = 128
ItemEnabledChange = 3
ItemEnabledHasChanged = 13
ItemFlagsChange = 21
ItemFlagsHaveChanged = 22
ItemHasNoContents = 1024
ItemIgnoresParentOpacity = 64
ItemIgnoresTransformations = 32
ItemIsFocusable = 4
ItemIsMovable = 1
ItemIsPanel = 16384
ItemIsSelectable = 2
ItemMatrixChange = 1
ItemNegativeZStacksBehindParent = 8192
ItemOpacityChange = 25
ItemOpacityHasChanged = 26
ItemParentChange = 5
ItemParentHasChanged = 15
ItemPositionChange = 0
ItemPositionHasChanged = 9
ItemRotationChange = 28
ItemRotationHasChanged = 29
ItemScaleChange = 30
ItemScaleHasChanged = 31
ItemSceneChange = 11
ItemSceneHasChanged = 16
ItemScenePositionHasChanged = 27
ItemSelectedChange = 4
ItemSelectedHasChanged = 14
ItemSendsGeometryChanges = 2048
ItemSendsScenePositionChanges = 65536
ItemStacksBehindParent = 256
ItemToolTipChange = 19
ItemToolTipHasChanged = 20
ItemTransformChange = 8
ItemTransformHasChanged = 10
ItemTransformOriginPointChange = 32
ItemTransformOriginPointHasChanged = 33
ItemUsesExtendedStyleOption = 512
ItemVisibleChange = 2
ItemVisibleHasChanged = 12
ItemZValueChange = 23
ItemZValueHasChanged = 24
NoCache = 0
NonModal = 0
PanelModal = 1
class PanelModality

Bases: int

SceneModal = 2
Type = 1
UserType = 65536
acceptDrops(self) → bool
acceptHoverEvents(self) → bool
acceptTouchEvents(self) → bool
acceptedMouseButtons(self) → Qt.MouseButtons
advance(self, int)
boundingRegion(self, QTransform) → QRegion
boundingRegionGranularity(self) → float
brush(self) → QBrush
cacheMode(self) → QGraphicsItem.CacheMode
childItems(self) → List[QGraphicsItem]
childrenBoundingRect(self) → QRectF
clearFocus(self)
clipPath(self) → QPainterPath
collidesWithItem(self, QGraphicsItem, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidesWithPath(self, QPainterPath, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → bool
collidingItems(self, mode: Qt.ItemSelectionMode = Qt.IntersectsItemShape) → List[QGraphicsItem]
commonAncestorItem(self, QGraphicsItem) → QGraphicsItem
contains(self, Union[QPointF, QPoint]) → bool
cursor(self) → QCursor
data(self, int) → Any
deviceTransform(self, QTransform) → QTransform
dragEnterEvent(self, QGraphicsSceneDragDropEvent)
dragLeaveEvent(self, QGraphicsSceneDragDropEvent)
dragMoveEvent(self, QGraphicsSceneDragDropEvent)
dropEvent(self, QGraphicsSceneDragDropEvent)
effectiveOpacity(self) → float
ensureVisible(self, rect: QRectF = QRectF(), xMargin: int = 50, yMargin: int = 50)

ensureVisible(self, float, float, float, float, xMargin: int = 50, yMargin: int = 50)

filtersChildEvents(self) → bool
flags(self) → QGraphicsItem.GraphicsItemFlags
focusInEvent(self, QFocusEvent)
focusItem(self) → QGraphicsItem
focusOutEvent(self, QFocusEvent)
focusProxy(self) → QGraphicsItem
grabKeyboard(self)
grabMouse(self)
graphicsEffect(self) → QGraphicsEffect
group(self) → QGraphicsItemGroup
hasCursor(self) → bool
hasFocus(self) → bool
hide(self)
hoverMoveEvent(self, QGraphicsSceneHoverEvent)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
installSceneEventFilter(self, QGraphicsItem)
isActive(self) → bool
isAncestorOf(self, QGraphicsItem) → bool
isBlockedByModalPanel(self) → Tuple[bool, QGraphicsItem]
isClipped(self) → bool
isEnabled(self) → bool
isObscured(self, rect: QRectF = QRectF()) → bool

isObscured(self, float, float, float, float) -> bool

isObscuredBy(self, QGraphicsItem) → bool
isPanel(self) → bool
isSelected(self) → bool
isUnderMouse(self) → bool
isVisible(self) → bool
isVisibleTo(self, QGraphicsItem) → bool
isWidget(self) → bool
isWindow(self) → bool
itemChange(self, QGraphicsItem.GraphicsItemChange, Any) → Any
itemTransform(self, QGraphicsItem) → Tuple[QTransform, bool]
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
mapFromItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapFromItem(self, QGraphicsItem, QRectF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapFromItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapFromItem(self, QGraphicsItem, float, float) -> QPointF mapFromItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapFromParent(self, Union[QPointF, QPoint]) → QPointF

mapFromParent(self, QRectF) -> QPolygonF mapFromParent(self, QPolygonF) -> QPolygonF mapFromParent(self, QPainterPath) -> QPainterPath mapFromParent(self, float, float) -> QPointF mapFromParent(self, float, float, float, float) -> QPolygonF

mapFromScene(self, Union[QPointF, QPoint]) → QPointF

mapFromScene(self, QRectF) -> QPolygonF mapFromScene(self, QPolygonF) -> QPolygonF mapFromScene(self, QPainterPath) -> QPainterPath mapFromScene(self, float, float) -> QPointF mapFromScene(self, float, float, float, float) -> QPolygonF

mapRectFromItem(self, QGraphicsItem, QRectF) → QRectF

mapRectFromItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectFromParent(self, QRectF) → QRectF

mapRectFromParent(self, float, float, float, float) -> QRectF

mapRectFromScene(self, QRectF) → QRectF

mapRectFromScene(self, float, float, float, float) -> QRectF

mapRectToItem(self, QGraphicsItem, QRectF) → QRectF

mapRectToItem(self, QGraphicsItem, float, float, float, float) -> QRectF

mapRectToParent(self, QRectF) → QRectF

mapRectToParent(self, float, float, float, float) -> QRectF

mapRectToScene(self, QRectF) → QRectF

mapRectToScene(self, float, float, float, float) -> QRectF

mapToItem(self, QGraphicsItem, Union[QPointF, QPoint]) → QPointF

mapToItem(self, QGraphicsItem, QRectF) -> QPolygonF mapToItem(self, QGraphicsItem, QPolygonF) -> QPolygonF mapToItem(self, QGraphicsItem, QPainterPath) -> QPainterPath mapToItem(self, QGraphicsItem, float, float) -> QPointF mapToItem(self, QGraphicsItem, float, float, float, float) -> QPolygonF

mapToParent(self, Union[QPointF, QPoint]) → QPointF

mapToParent(self, QRectF) -> QPolygonF mapToParent(self, QPolygonF) -> QPolygonF mapToParent(self, QPainterPath) -> QPainterPath mapToParent(self, float, float) -> QPointF mapToParent(self, float, float, float, float) -> QPolygonF

mapToScene(self, Union[QPointF, QPoint]) → QPointF

mapToScene(self, QRectF) -> QPolygonF mapToScene(self, QPolygonF) -> QPolygonF mapToScene(self, QPainterPath) -> QPainterPath mapToScene(self, float, float) -> QPointF mapToScene(self, float, float, float, float) -> QPolygonF

mouseMoveEvent(self, QGraphicsSceneMouseEvent)
mousePressEvent(self, QGraphicsSceneMouseEvent)
mouseReleaseEvent(self, QGraphicsSceneMouseEvent)
NetworkEdge.moveBy(self, float, float)
opacity(self) → float
opaqueArea(self) → QPainterPath
panel(self) → QGraphicsItem
panelModality(self) → QGraphicsItem.PanelModality
parentItem(self) → QGraphicsItem
parentObject(self) → QGraphicsObject
parentWidget(self) → QGraphicsWidget
path(self) → QPainterPath
pen(self) → QPen
pos(self) → QPointF
prepareGeometryChange(self)
removeSceneEventFilter(self, QGraphicsItem)
resetTransform(self)
rotation(self) → float
scale(self) → float
scene(self) → QGraphicsScene
sceneBoundingRect(self) → QRectF
sceneEvent(self, QEvent) → bool
sceneEventFilter(self, QGraphicsItem, QEvent) → bool
scenePos(self) → QPointF
sceneTransform(self) → QTransform
NetworkEdge.scroll(self, float, float, rect: QRectF = QRectF())
setAcceptDrops(self, bool)
setAcceptHoverEvents(self, bool)
setAcceptTouchEvents(self, bool)
setAcceptedMouseButtons(self, Union[Qt.MouseButtons, Qt.MouseButton])
setActive(self, bool)
setBoundingRegionGranularity(self, float)
setBrush(self, Union[QBrush, QColor, Qt.GlobalColor, QGradient])
setCacheMode(self, QGraphicsItem.CacheMode, logicalCacheSize: QSize = QSize())
setCursor(self, Union[QCursor, Qt.CursorShape])
setData(self, int, Any)
setEnabled(self, bool)
setFiltersChildEvents(self, bool)
setFlag(self, QGraphicsItem.GraphicsItemFlag, enabled: bool = True)
setFlags(self, Union[QGraphicsItem.GraphicsItemFlags, QGraphicsItem.GraphicsItemFlag])
setFocus(self, focusReason: Qt.FocusReason = Qt.OtherFocusReason)
setFocusProxy(self, QGraphicsItem)
setGraphicsEffect(self, QGraphicsEffect)
setGroup(self, QGraphicsItemGroup)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setOpacity(self, float)
setPanelModality(self, QGraphicsItem.PanelModality)
setParentItem(self, QGraphicsItem)
setPath(self, QPainterPath)
setPen(self, Union[QPen, QColor, Qt.GlobalColor, QGradient])
setPos(self, Union[QPointF, QPoint])

setPos(self, float, float)

setRotation(self, float)
setScale(self, float)
setSelected(self, bool)
setToolTip(self, str)
setTransform(self, QTransform, combine: bool = False)
setTransformOriginPoint(self, Union[QPointF, QPoint])

setTransformOriginPoint(self, float, float)

setTransformations(self, Iterable[QGraphicsTransform])
setVisible(self, bool)
setX(self, float)
setY(self, float)
setZValue(self, float)
shape(self) → QPainterPath
show(self)
stackBefore(self, QGraphicsItem)
toGraphicsObject(self) → QGraphicsObject
toolTip(self) → str
topLevelItem(self) → QGraphicsItem
topLevelWidget(self) → QGraphicsWidget
transform(self) → QTransform
transformOriginPoint(self) → QPointF
transformations(self) → List[QGraphicsTransform]
type(self) → int
ungrabKeyboard(self)
ungrabMouse(self)
unsetCursor(self)
update(self, rect: QRectF = QRectF())

update(self, float, float, float, float)

updateMicroFocus(self)
wheelEvent(self, QGraphicsSceneWheelEvent)
window(self) → QGraphicsWidget
x(self) → float
y(self) → float
zValue(self) → float
schrodinger.ui.qt.network_visualizer.intersect_line_and_rect(line, rect)

Returns the intersection point of a line and 4 line segments, if it intersects multiple segments, only one intersection will be returned.

class schrodinger.ui.qt.network_visualizer.GraphSignals

Bases: PyQt5.QtCore.QObject

selectionChanged
positionChanged
nodesChanged
nodesAdded
nodesDeleted
edgesChanged
graphChanged
undoPointSet
__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

blockSignals(self, bool) → bool
childEvent(self, QChildEvent)
children(self) → List[QObject]
connectNotify(self, QMetaMethod)
customEvent(self, QEvent)
deleteLater(self)
destroyed

destroyed(self, object: QObject = None) [signal]

disconnect(self)
disconnectNotify(self, QMetaMethod)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

inherits(self, str) → bool
installEventFilter(self, QObject)
isSignalConnected(self, QMetaMethod) → bool
isWidgetType(self) → bool
isWindowType(self) → bool
killTimer(self, int)
metaObject(self) → QMetaObject
moveToThread(self, QThread)
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

parent(self) → QObject
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

receivers(self, PYQT_SIGNAL) → int
removeEventFilter(self, QObject)
sender(self) → QObject
senderSignalIndex(self) → int
setObjectName(self, str)
setParent(self, QObject)
setProperty(self, str, Any) → bool
signalsBlocked(self) → bool
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
thread(self) → QThread
timerEvent(self, QTimerEvent)
tr(self, str, disambiguation: str = None, n: int = - 1) → str
class schrodinger.ui.qt.network_visualizer.Graph(ggraph=None, node_class=None, edge_class=None)

Bases: object

A model class for an undirected graph. This wraps around the NetworkX Graph class and provides QT signals, a easier-to-use API, and access control.

All persistent data should be stored in self._ggraph.

Note that Graph itself cannot be pickled; Graph has Graph.signals, which is a QObject and cannot be pickled. For this reason selection information (which contains references to Graph) is not placed in self._ggraph, so that self._ggraph can be pickled.

__init__(ggraph=None, node_class=None, edge_class=None)

Constructs a new Graph object

Parameters
  • ggraph (networkx.Graph) – The graph underlying this graph.

  • node_class (class) – The class to represent the graph’s nodes (should be subclass of Node)

  • edge_class (class) – The class to represent the graph’s edges (should be subclass of Edge)

property ggraph
update()

Update any derived aspects of the graph after changes.

setEdgeValidator(validator)

Set an edge validator that will be run when adding edges between nodes. :param validator: the validator :type validator: ConnectionValidator

toNetworkX()

Return a copy of the underlying NetworkX graph.

getData(key)

Return the requested item from the graph’s data dictionary. Returns None if the key is not found.

setData(key, value, signal=True)

Set the value of an item in the graph’s data dictionary.

isConnected()

Checks whether the graph is connected, that is, whether every node is connected by some path to every other node.

Returns

Whether the graph is connected rtype: bool

nodeCount()
Returns

the number of nodes in the graph

Return type

int

getIsolates()
Returns

a complete set of nodes in the graph that have degree 0

Return type

set(Node)

getConnectedComponents(nodes=None)

Return a set of nodes for each connected component in the graph.

Parameters

nodes (set(Node) or NoneType) – optionally, a set of nodes to filter the returned components. If provided, this method will only return components for which at least one node is in nodes

Returns

a generater over each connected component in the graph

Return type

typing.Generator[set[Node], None, None]

getNodeConnectedComponent(node)

Return a set of nodes that are part of the same connected component as node.

Parameters

node (Node) – a node

Returns

a set of nodes connected to node through any path of edges

Return type

set(Node)

getNode(node_key)

Retrieve a node via its name. Retrieved nodes are cached, so getting the same Node again will return the same instance. Returns None if no matching Node exists.

Parameters

node_key (object) – a node, gnode, or string that corresponds to the desired node

Returns

a node if found, else None

Return type

Node or NoneType

getNodes(node_keys=None)

Retrieve a set of nodes optionally indicated by a list of keys. If none is provided, return all nodes.

Parameters

node_keys (list(object) or NoneType) – optionally, a list of nodes, gnodes, or strings that correspond to the desired nodes

Returns

a set of nodes

Return type

set(Node)

getNeighbors(node)

Return a set of all nodes connected to a specified node

Parameters

node (Node) – center node

Returns

neighboring nodes

Return type

set of Node

addNodes(nodes, signal=True)

Add a list of nodes to this graph. The nodes argument can either be a list of Node objects or a list of hashable objects that can be used as new gnodes.

Note that any time a new gnode is created for use in this graph, its string representation must be unique among the other nodes in this graph: nodes are keyed in the node_objects dictionary by the string representation of their corresponding gnode.

Parameters
  • nodes (list(object) or list(Node)) – list of gnodes or nodes

  • signal (bool) – whether the addNodes signal should be emitted when done

Returns

a set of added nodes

Return type

set(Node)

addNode(node, signal=True)

Convenience method for adding a single node to the graph. See addNodes() for full documentation.

Parameters
  • node (hashable or Node) – gnode or node

  • signal (bool) – whether the addNodes signal should be emitted when done

Returns

the added node

Return type

Node

removeNodes(nodes, signal=True)

Remove specified nodes from the graph and optionally emit a signal.

Parameters
  • nodes (list(Node)) – a list of nodes to be removed

  • signal (bool) – whether to emit a nodesDeleted signal when done

removeNode(node, signal=True)

Convenience function for removing a single node. See removeNode() for full documentation.

Parameters
  • node (object or Node) – a gnode or node to remove

  • signal (bool) – whether to emit a nodesDeleted signal when done

setMultipleNodePos(pos_dict, signal=True)

Set the positions of nodes from a dictionary.

Parameters

pos_dict (dict {Node : (int, int)}) – A dictionary mapping nodes to (x,y) tuples.

edgeCount()
Returns

the number of edges in the graph

Return type

int

hasEdge(node1, node2)

Return whether there is an edge between the supplied nodes.

Parameters
  • node1 (Node) – a node from this graph

  • node2 (Node) – a node from this graph

Returns

whether there exists an edge between the two supplied nodes

Return type

bool

getGEdge(node0, node1)

Return the underlying gedge object corresponding to two supplied nodes. This can be overwritten in subclasses, but the returned class should define a consistent edge ordering that is independent of the order of the supplied node parameters.

Parameters
  • node0 (Node) – a node

  • node1 (Node) – a node

Returns

the underlying gedge between the two nodes, if it exists

Return type

tuple(networkx.Node) or NoneType

getEdge(node0, node1)

Given two nodes, return the corresponding edge if it exists.

Parameters
  • node0 (Node) – a node

  • node1 (Node) – a node

Returns

the edge connecting the two nodes if it exists

Return type

Edge or NoneType

getEdges(nodes=None)

Return all edges connected to a node or set of nodes. If no node is specified, all the edges in the graph are returned.

Parameters

nodes (iterable(Node), Node, or None) – optionally a node or iterable of nodes

Returns

a set of edges connected to at least one of the supplied nodes, or a set of all edges if nodes is not specified

Return type

set(Edge)

addEdges(edge_tuples, signal=True)

Add edges to graph.

Parameters
  • edge_tuples (list(tuple(Node, Node, dict)) or list(tuple(Node, Node, None))) – list of tuples indicating the edges to add, containing two gnodes or nodes and an edge attribute dictionary (or None)

  • signal (bool) – whether edgesChanged signal should be emitted when done

addEdge(node1, node2, signal=True, data=None)

Convenience function to add a single edge to the graph given two nodes. The order of the nodes does not matter.

Parameters
  • node1 (object or Node) – a gnode or node connected by the edge

  • node2 (object or Node) – a gnode or node connected by the edge

  • signal (bool) – whether edgesChanged signal should be emitted when done

removeEdges(edges, signal=True)

Removes specified edges from the graph.

Parameters
  • edges (list(Edge)) – a list of edges

  • signal (bool) – whether edgesChanged signal should be emitted when done

removeEdge(edge, signal=True)

Convenience function to remove a single edge from the graph.

Parameters
  • edge (Edge) – an edge

  • signal (bool) – whether edgesChanged signal should be emitted when done

getEdgeApproval(node1, node2)

Test whether a new edge can be added between two nodes. Doesn’t actually add an edge, just returns whether it is allowable to add.

selectedNodes()

Return the currently selected nodes.

Return type

set of Nodes

selectedEdges()
Returns

the set of selected edges

Return type

set(Edge)

setSelectedObjs(objs, source=None, signal=True)

Specify the current selection.

Parameters
  • objs (list(Node or Edge)) – a list of objects (nodes or edges) to be selected

  • source (object) – the class instance calling this method (used to avoid infinite recursion when updating selection state)

  • signal (bool) – whether to emit a signal when changing selection state

springLayout(signal=True)

Performs a spring layout on the current graph.

minCrossingSpringLayout(num_iterations=100, fixed_nodes=None, fraction=1.0)

Perform multiple spring layouts and keep the one with the fewest edge intersections, keeping the original positions if the layout could not be improved.

Parameters
  • num_iterations (int) – number of spring layouts to try

  • fixed (iterable of Node) – nodes for which the position should be fixed

  • signal (bool) – whether to emit the positionChanged signal

  • fraction (float) – stop iterating if no reduction in crossings is found within this fraction of num_iterations

hasPositions(accept_partial=False)

Determines whether the nodes in this graph have x-y coordinates.

Parameters

accept_partial (bool) – if set to True, the method will check whether at least one node has coordinates. Otherwise it requires that all nodes have coordinates.

getState()

Get the current state of the Graph

setState(state)

Set the current state of the Graph

setUndoPoint(signal=True)

Store the current state to the undo stack. Also wipes out the redo stack.

undo()

Revert to the last state on the undo stack.

redo()

Undo the undo

clearUndoHistory()

Clears both undo and redo stacks

merge(g)

Merge data from another graph into this graph. Nodes with duplicate names will be considered to be the same ligand.

Parameters

g (Graph) – graph from which data is being merged.

deleteSelectedItems(include_edges=True, include_nodes=True)

Delete selected nodes and/or selected edges.

Parameters
  • include_edges (bool) – whether selected edges should be deleted

  • include_nodes (bool) – whether selected nodes should be deleted

deleteItems(nodes=None, edges=None)

Delete specified nodes and edges from the FEP map.

Parameters
  • nodes (Set[Node]) – nodes to delete

  • edges (Set[Tuple[Node, Node]]) – edges to delete

class schrodinger.ui.qt.network_visualizer.Node(name, graph=None)

Bases: object

Model class for Node. Wraps the NetworkX Graph.node dictionary.

x_key = 'storedX'
y_key = 'storedY'
__init__(name, graph=None)

Construct a Node object. Most of the time, this will be constructed around an existing NetworkX node (i.e. an entry in the networkx.Graph.node dict). If a graph is specified, a node of the same name must exist in the graph, or a ValueError will result.

QT signals will only be emitted if a graph is specified.

Parameters
  • name (hashable) – a unique identifier for this node

  • graph (Graph) – the graph object to which this node belongs

Variables
  • _gnode – the underlying graph node that this node wraps. In this class, we use the node name as the graph node, but any hashable object can be used.

  • _gdata – dictionary that stores data belonging to the underlying graph node.

property gnode

Return the underlying graph node object wrapped by this Node instance (not the data dictionary _gdata).

property name

Return unique string associated with this node. Convert to string for subclasses which do not necessarily use strings as graph nodes.

x()
y()
pos()

Returns the Node’s current position coordinates. Returns None if there are no coordinates.

Return type

tuple (float, float)

setX(x, signal=True)
setY(y, signal=True)
setPos(x, y, signal=True)

Set the node’s position coordinates

Parameters
  • x (float) – x coordinate

  • y (float) – y coordinate

gdata()

Directly access the node data dictionary. Use this object carefully, as directly altering its contents can lead to internal inconsistencies.

This may be wrapped to restrict access.

getData(key)

Return the requested item from the node’s data dictionary. Returns None if the key is not found.

setData(key, value, signal=True)

Set the value of an item in the node’s data dictionary.

property degree
Returns

the degree (number of edges) of the node

Return type

int

class schrodinger.ui.qt.network_visualizer.Edge(gedge, graph)

Bases: object

__init__(gedge, graph)
Parameters
  • gedge (object) – the underlying edge object wrapped by this object

  • graph (Graph) – the graph object to which this edge belongs

property gedge
Returns

the underlying edge object wrapped by this object

Return type

fep.graph.Edge

property graph
Returns

the graph to which this edge belongs

Return type

Graph

property nodes
Returns

the nodes connected by this edge in a consistent order, as determined by the underlying graph edge

Return type

tuple(Node, Node)

data()
Returns

the data dictionary associated with this edge

Return type

dict(str, object)

getData(key)

Return the requested item from the edge’s data dictionary. Returns None if the key is not found.

Parameters

key (str) – the data item key

Returns

the value stored under the specified key in the edge’s data dictionary, or None if it is not found

Return type

object

setData(key, value, signal=True)

Set the specified item in the edge’s data dictionary.

Parameters
  • key (str) – the data item key

  • value (object) – the value to set for the data item

property name
Returns

the name of the edge, a composite of the connected node names

Return type

str

class schrodinger.ui.qt.network_visualizer.ConnectionValidator

Bases: object

Create a subclass of this and assign it using NetworkViewer.setConnectionValidator( ) to do extra work making sure node’s are compatible to connect. val1 and val2 are node1.val and node2.val

__init__()

Initialize self. See help(type(self)) for accurate signature.

validate(node1, node2)
firstNode()
setFirstNode(node)
validateSecondVal(val)
class schrodinger.ui.qt.network_visualizer.AbstractNetworkView

Bases: object

A base class for views on Graph models. Use setModel to replace the model object. Signals from the model are automatically connected to appropriate synchronization slots.

The abstract view does not provide any built-in support for effecting changes back into the model (ex. deleting nodes, changing selection). Any such operations should be implemented in the subclass by making calls directly to the model. These changes will then be automatically synchronized forward to all views.

self.nodes is a dictionary mapping model node objects to view node objects.

self.edges is a dictionary mapping pairs of model node objects to view edge objects. There is no such thing as a edge model object.

Note that all references to the word node and edge in method names refer to view objects. For example, makeNode() will make a view node, addEdge() will add an edge view object to the view.

Variables
  • MODEL_CLASS (Graph or subclass of Graph) – an instance of this class will be created as the default model when setModel

  • _sync_with_model (bool) – whether to automatically synchronize this view (and its subviews) with the model

MODEL_CLASS

alias of Graph

__init__()

Initialize self. See help(type(self)) for accurate signature.

syncAll()

Synchronize the full model and selection state.

syncRecursive()

Synchronize the full model and selection state on this view and all subviews.

setModelSyncEnabled(enable)

Enable or disable automatic synchronization with the model for this view and all subviews.

setModel(model)

Set the model for this view and synchronize to it. Any subviews will have the model set on them as well.

Parameters

model (Graph) – the graph model

getSignalsAndSlots(model)

Get a list of signal/slot pairs for a model. This list will be used when setting a new model to disconnect the old model signals from their slots and connect the new model’s signals to those slots.

Override this method to modify or extend signals/slots in derived classes.

Parameters

model (Graph) – the graph model

addSubview(subview)

Add a subview to this view. A subview is another AbstractNetworkView that should always have the same model as its parent view (this view).

Adding will automatically set its model to the current model. Changing the model on this view will result in all its subviews getting the new model set

Parameters

subview (AbstractNetworkView) – the new subview to add to this view

removeSubview(subview)

Removes the specified subview. The subview is not deleted or altered, and the model remains set.

Parameters

subview

syncModel()
syncNodes()
syncNodesDeleted(nodes)
syncNodesAdded(nodes)
syncNodesChanged(nodes)
syncEdges()
syncSelection(selection, source)
makeNodes(nodes)

Create new view nodes and return a dictionary mapping supplied model nodes to corresponding view nodes. Do not add new view nodes to the view.

By default this method returns an “identity dictionary” that maps nodes to themselves. Subclasses should override this method to implement their own view nodes.

Parameters

nodes (list(Node)) – model nodes

Returns

a dictionary mapping supplied nodes to view nodes

Return type

dict(Node, object)

makeNode(node)

Convenience method for calling makeNodes() with a single node. Rather than returning a dictionary mapping nodes to view nodes, returns the view node corresponding to the supplied node.

Parameters

node (Node) – the model node

Returns

the view node

Return type

object

addNode(viewnode)

A convenience function for calling addNodes() for a single node.

Parameters

viewnode (object) – a view node

removeNode(viewnode)

Convenience method for calling removeNode() for a single node.

Parameters

viewnode (object) – a view node

updateNode(node)

Convenience method for calling updateNodes() for a single node.

Parameters

node (Node) – the model node to update to

getModelNodes(node_keys=None)

Retrieve a set of model nodes optionally indicated by a list of keys. If none is provided, return all nodes.

Parameters

node_keys (list(object) or NoneType) – optionally, a list of nodes, gnodes, or strings that correspond to the desired model nodes

Returns

a set of nodes

Return type

set(Node)

getNode(node)
Parameters

node (Node) – a model node

Returns

corresponding view node, if available

Return type

object or None

makeEdges(edges)

Given a list of model edges, return a dictionary mapping them to corresponding view edges. Does not add view edges to the view.

By default this method returns an identity dictionary, mapping model edges to themselves. Subclasses should override this method if they want to implement their own view edges.

Parameters

edges – a list model nodes

Returns

a dictionary mapping model edges to view edges

Return type

dict(Edge, object)

makeEdge(edge)

Convenience method for calling makeEdges() for a single edge. Rather than return a dictionary mapping model edges to view edges, returns a singe view edge. Does not add a view edge to the view.

Parameters

edge (Edge) – a model edge

Returns

a view edge

Return type

object

addEdge(viewedge)

Convenience method for calling addEdges() for a single edge.

Parameters

viewedge (object) – the view edge to add to the view

removeEdge(viewedge)

Convenience method for calling removeEdges() for a single edge.

Parameters

viewedge (object) – the view edge to remove from the view

updateEdge(edge)

A convenience method for calling updateEdges() for a single edge.

Parameters

edge (Edge) – the model edge corresponding to the view edge to update

getModelEdges(nodes=None)

Return all model edges connected to a model node or set of model nodes. If no node is specified, all the edges in the graph are returned. This method acts like Graph.getEdges(), but it filters for model edges that are available in this view.

Parameters

nodes (list(Node), Node, or None) – optionally a node or list of nodes

Returns

a list of model edges

Return type

list(Edge)

getEdge(edge)

Return the view edge corresponding to the supplied model edge.

Parameters

edge (Edge) – a model edge

Returns

the corresponding view edge if available

Return type

object or None

getEdges(nodes=None)

Return a list of view edges, filtering the list so that the edges are connected to the optionally-supplied node or iterable of nodes.

Parameters

nodes (iterable[Node] or Node or NoneType) – a node or iterable of nodes

Returns

list of view edges

Return type

list[NetworkEdge or NoneType]

addNodes(viewnodes)

Takes view nodes and adds them to the view if that makes sense (eg. add graphics items to scene, add rows to table, etc.) It should not add the view node to self.nodes; that is handled in _addNodes().

Parameters

viewnodes (list(object)) – view nodes to add to the view

removeNodes(viewnodes)

Removes view nodes from the view if that makes sense (eg. remove graphics items from scene, remove table rows, etc.) It should not remove view nodes from self.nodes; that is handled in _removeNodes().

Parameters

viewnodes (list(object)) – a list of view nodes

updateNodes(nodes)

Performs any operations necessary to update the view to the current model state. Note that this method takes model nodes, not view nodes.

Parameters

nodes (list(Node)) – model nodes which must have their views updated

addEdges(viewedges)

Adds view edges to the view. Does not add view edges to self.edges.

Parameters

viewedges (list(object)) – view edges to add to the view

removeEdges(viewedges)

Removes view edges from the view. Does not remove view edges from self.edges.

Parameters

viewedges (list(object)) – view edges to remove from the view

updateEdges(edges)

Performs any operations necessary to update the view to the current model state.

Parameters

edges (list(Edge)) – a list of model edges corresponding to view edges that should be updated

selectItems(selected_view_objects)

Selects view objects in the view. Currently only view nodes will be requested, but may be expanded to allow a combination of nodes and edges to be selected.

Parameters

selected_view_objects (list(object)) – a list of view objects to be selected

class schrodinger.ui.qt.network_visualizer.NetworkViewer(node_class=<class 'schrodinger.ui.qt.network_visualizer.NetworkNode'>, parent=None, model=None)

Bases: schrodinger.ui.qt.network_visualizer.AbstractNetworkView, PyQt5.QtWidgets.QWidget

A network diagram representation of the model.

pickingModeChanged
stopPickingConnection
__init__(node_class=<class 'schrodinger.ui.qt.network_visualizer.NetworkNode'>, parent=None, model=None)

Initialize self. See help(type(self)) for accurate signature.

getSignalsAndSlots(model)

Get a list of signal/slot pairs for a model. This list will be used when setting a new model to disconnect the old model signals from their slots and connect the new model’s signals to those slots.

Override this method to modify or extend signals/slots in derived classes.

Parameters

model (Graph) – the graph model

setModel(model, fit=True)
Parameters

fit (bool) – whether to fit the zoom to the new model

makeNodes(nodes)

Create new view nodes and return a dictionary mapping supplied model nodes to corresponding view nodes. Do not add new view nodes to the view.

By default this method returns an “identity dictionary” that maps nodes to themselves. Subclasses should override this method to implement their own view nodes.

Parameters

nodes (list(Node)) – model nodes

Returns

a dictionary mapping supplied nodes to view nodes

Return type

dict(Node, object)

addNodes(viewnodes)

Takes view nodes and adds them to the view if that makes sense (eg. add graphics items to scene, add rows to table, etc.) It should not add the view node to self.nodes; that is handled in _addNodes().

Parameters

viewnodes (list(object)) – view nodes to add to the view

removeNodes(viewnodes)

Removes view nodes from the view if that makes sense (eg. remove graphics items from scene, remove table rows, etc.) It should not remove view nodes from self.nodes; that is handled in _removeNodes().

Parameters

viewnodes (list(object)) – a list of view nodes

updateNodes(nodes)

Performs any operations necessary to update the view to the current model state. Note that this method takes model nodes, not view nodes.

Parameters

nodes (list(Node)) – model nodes which must have their views updated

makeEdges(edges)

Given a list of model edges, return a dictionary mapping them to corresponding view edges. Does not add view edges to the view.

By default this method returns an identity dictionary, mapping model edges to themselves. Subclasses should override this method if they want to implement their own view edges.

Parameters

edges – a list model nodes

Returns

a dictionary mapping model edges to view edges

Return type

dict(Edge, object)

addEdges(viewedges)

Adds view edges to the view. Does not add view edges to self.edges.

Parameters

viewedges (list(object)) – view edges to add to the view

removeEdges(viewedges)

Removes view edges from the view. Does not remove view edges from self.edges.

Parameters

viewedges (list(object)) – view edges to remove from the view

updateEdges(edges)

Performs any operations necessary to update the view to the current model state.

Parameters

edges (list(Edge)) – a list of model edges corresponding to view edges that should be updated

selectItems(selected_view_objects)

Selects view objects in the view. Currently only view nodes will be requested, but may be expanded to allow a combination of nodes and edges to be selected.

Parameters

selected_view_objects (list(object)) – a list of view objects to be selected

nodeMenu(e, node)

Override this to create a node context menu

edgeMenu(e, edge)

Shows edge context menu. Override this function in derived class.

edgeHovered(edge)

Override this for connection hover behavior

edgeUnhovered(edge)

Override this for connection hover behavior

exploreEdge(edge)

Override this for edge context menu behavior.

nodeHovered(hovered_node)

When a node is hovered, the all nodes with degree of separation greater than 1 are dimmed in order to highlight the immediate neighbors.

nodeUnhovered(hovered_node)

When a node is unhovered, return the dimmed nodes to the normal state.

setNodesOpacity(nodes, opacity)

Change the opacity of a set of nodes and their edges.

Parameters
  • nodes (iterable of NetworkNode) – the nodes to change opacity

  • opacity (float) – opacity value from 0 to 1.

calcItemZoomFactor(item)

Calculates the raw zoom factor necessary for the specified item to fill most of the view

Parameters

item (QtWidgets.QGraphicsItem) – the item to fit in the view

calcFitZoomFactor()

Calculates a raw zoom factor for the view to fit all the items in the scene

zoomItem(item)

Zoom into a specific item with animation. :param item: item to zoom :type item: QGraphicsItem

mouseMoveEvent(e)

If we’re picking and the mouse is moving then update the path of the arrow which is used for picking.

createEdge(vnode1, vnode2)

MVC “controller” function to add a new edge to the graph between node1 and node2. This can be overridden to implement other edge creation functionality.

Parameters
selectedNodes()

Get a list of currently selected view nodes

selectedEdges()

Get a list of currently selected view edges

onSelectionChanged()

This is used to process UI changes in selection and updating the model from the view selection. This is not for synchronizing the view to the model selection. For that, use self.syncSelection().

setPickingMode(state)

Begins picking nodes to add connections, can be connected to a checkbox. If a python checkbox is connected with “toggled(bool)” to this, the checkbox also needs to have a slot to turn the checkbox off which will be connected to the signal: SIGNAL(“stopPickingConnection()”) This is emitted once a connection has been created and the checkbox should be turned off.

deleteSelectedItems()

Process item deletion request. Deletions are done in the model only; the view is not modified here. Changing the model will automatically result in a corresponding update to the view.

onKeyPressed(e)
setAllowMovement(val)

Allow nodes to be moved with click+drag

setNodeDeletion(val)

Enable deletion of nodes

setNetworkNodeDefaultClass(cl)

Set the default view node class for

getFitRect(node_set=None)

Calculate the rectangle that contains the nodes. If a node_set is specified, only those nodes will be considered. Otherwise, all nodes will be used. This function takes into account the size of the nodes.

Parameters

node_set (iterable) – a subset of nodes to fit

expandToNodes()

Expand the scene to fit all nodes

setDefaultScale()

This zooms to fits all nodes and sets the default scale

scaleSmoother(val)

Sets the scale between self.start_scale and self.finish_scale, based on ‘val’, which goes from 0->1 as the animation proceeds.

setRawScale(scale)

Sets the scale using the actual multipliers QT does. We use a QTimeLine to do this as an animation. The “finish_scale” is always set here, whether the timeline is already zooming or not, so that it’ll always zoom as far as the users last scroll desired.

setScale(val)

Accepts any scale value in [0, 100]

DrawChildren = 2
DrawWindowBackground = 1
IgnoreMask = 4
MODEL_CLASS

alias of Graph

class PaintDeviceMetric

Bases: int

PdmDepth = 6
PdmDevicePixelRatio = 11
PdmDevicePixelRatioScaled = 12
PdmDpiX = 7
PdmDpiY = 8
PdmHeight = 2
PdmHeightMM = 4
PdmNumColors = 5
PdmPhysicalDpiX = 9
PdmPhysicalDpiY = 10
PdmWidth = 1
PdmWidthMM = 3
class RenderFlag

Bases: int

class RenderFlags

Bases: sip.simplewrapper

QWidget.RenderFlags(Union[QWidget.RenderFlags, QWidget.RenderFlag]) QWidget.RenderFlags(QWidget.RenderFlags)

__init__(*args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

acceptDrops(self) → bool
accessibleDescription(self) → str
accessibleName(self) → str
actionEvent(self, QActionEvent)
actions(self) → List[QAction]
activateWindow(self)
addAction(self, QAction)
addActions(self, Iterable[QAction])
addEdge(viewedge)

Convenience method for calling addEdges() for a single edge.

Parameters

viewedge (object) – the view edge to add to the view

addNode(viewnode)

A convenience function for calling addNodes() for a single node.

Parameters

viewnode (object) – a view node

addSubview(subview)

Add a subview to this view. A subview is another AbstractNetworkView that should always have the same model as its parent view (this view).

Adding will automatically set its model to the current model. Changing the model on this view will result in all its subviews getting the new model set

Parameters

subview (AbstractNetworkView) – the new subview to add to this view

adjustSize(self)
autoFillBackground(self) → bool
backgroundRole(self) → QPalette.ColorRole
baseSize(self) → QSize
blockSignals(self, bool) → bool
changeEvent(self, QEvent)
childAt(self, QPoint) → QWidget

childAt(self, int, int) -> QWidget

childEvent(self, QChildEvent)
children(self) → List[QObject]
childrenRect(self) → QRect
childrenRegion(self) → QRegion
clearFocus(self)
clearMask(self)
close(self) → bool
closeEvent(self, QCloseEvent)
colorCount(self) → int
connectNotify(self, QMetaMethod)
contentsMargins(self) → QMargins
contentsRect(self) → QRect
contextMenuEvent(self, QContextMenuEvent)
contextMenuPolicy(self) → Qt.ContextMenuPolicy
create(self, window: sip.voidptr = 0, initializeWindow: bool = True, destroyOldWindow: bool = True)
createWindowContainer(QWindow, parent: QWidget = None, flags: Union[Qt.WindowFlags, Qt.WindowType] = 0) → QWidget
cursor(self) → QCursor
customContextMenuRequested

customContextMenuRequested(self, QPoint) [signal]

customEvent(self, QEvent)
deleteLater(self)
depth(self) → int
destroy(self, destroyWindow: bool = True, destroySubWindows: bool = True)
destroyed

destroyed(self, object: QObject = None) [signal]

devType(self) → int
devicePixelRatio(self) → int
devicePixelRatioF(self) → float
devicePixelRatioFScale() → float
disconnect(self)
disconnectNotify(self, QMetaMethod)
dragEnterEvent(self, QDragEnterEvent)
dragLeaveEvent(self, QDragLeaveEvent)
dragMoveEvent(self, QDragMoveEvent)
dropEvent(self, QDropEvent)
dumpObjectInfo(self)
dumpObjectTree(self)
dynamicPropertyNames(self) → List[QByteArray]
effectiveWinId(self) → sip.voidptr
ensurePolished(self)
enterEvent(self, QEvent)
event(self, QEvent) → bool
eventFilter(self, QObject, QEvent) → bool
find(sip.voidptr) → QWidget
findChild(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → QObject

findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject

findChildren(self, type, name: str = '', options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) → List[QObject]

findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegExp, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, type, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] findChildren(self, Tuple, QRegularExpression, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject]

focusInEvent(self, QFocusEvent)
focusNextChild(self) → bool
focusNextPrevChild(self, bool) → bool
focusOutEvent(self, QFocusEvent)
focusPolicy(self) → Qt.FocusPolicy
focusPreviousChild(self) → bool
focusProxy(self) → QWidget
focusWidget(self) → QWidget
font(self) → QFont
fontInfo(self) → QFontInfo
fontMetrics(self) → QFontMetrics
foregroundRole(self) → QPalette.ColorRole
frameGeometry(self) → QRect
frameSize(self) → QSize
geometry(self) → QRect
getContentsMargins(self) → Tuple[int, int, int, int]
getEdge(edge)

Return the view edge corresponding to the supplied model edge.

Parameters

edge (Edge) – a model edge

Returns

the corresponding view edge if available

Return type

object or None

getEdges(nodes=None)

Return a list of view edges, filtering the list so that the edges are connected to the optionally-supplied node or iterable of nodes.

Parameters

nodes (iterable[Node] or Node or NoneType) – a node or iterable of nodes

Returns

list of view edges

Return type

list[NetworkEdge or NoneType]

getModelEdges(nodes=None)

Return all model edges connected to a model node or set of model nodes. If no node is specified, all the edges in the graph are returned. This method acts like Graph.getEdges(), but it filters for model edges that are available in this view.

Parameters

nodes (list(Node), Node, or None) – optionally a node or list of nodes

Returns

a list of model edges

Return type

list(Edge)

getModelNodes(node_keys=None)

Retrieve a set of model nodes optionally indicated by a list of keys. If none is provided, return all nodes.

Parameters

node_keys (list(object) or NoneType) – optionally, a list of nodes, gnodes, or strings that correspond to the desired model nodes

Returns

a set of nodes

Return type

set(Node)

getNode(node)
Parameters

node (Node) – a model node

Returns

corresponding view node, if available

Return type

object or None

grab(self, rectangle: QRect = QRect(QPoint(0, 0), QSize(- 1, - 1))) → QPixmap
grabGesture(self, Qt.GestureType, flags: Union[Qt.GestureFlags, Qt.GestureFlag] = Qt.GestureFlags())
grabKeyboard(self)
grabMouse(self)

grabMouse(self, Union[QCursor, Qt.CursorShape])

grabShortcut(self, Union[QKeySequence, QKeySequence.StandardKey, str, int], context: Qt.ShortcutContext = Qt.WindowShortcut) → int
graphicsEffect(self) → QGraphicsEffect
graphicsProxyWidget(self) → QGraphicsProxyWidget
hasFocus(self) → bool
hasHeightForWidth(self) → bool
hasMouseTracking(self) → bool
hasTabletTracking(self) → bool
height(self) → int
heightForWidth(self, int) → int
heightMM(self) → int
hide(self)
hideEvent(self, QHideEvent)
inherits(self, str) → bool
initPainter(self, QPainter)
inputMethodEvent(self, QInputMethodEvent)
inputMethodHints(self) → Qt.InputMethodHints
inputMethodQuery(self, Qt.InputMethodQuery) → Any
NetworkViewer.insertAction(self, QAction, QAction)
insertActions(self, QAction, Iterable[QAction])
installEventFilter(self, QObject)
isActiveWindow(self) → bool
isAncestorOf(self, QWidget) → bool
isEnabled(self) → bool
isEnabledTo(self, QWidget) → bool
isFullScreen(self) → bool
isHidden(self) → bool
isLeftToRight(self) → bool
isMaximized(self) → bool
isMinimized(self) → bool
isModal(self) → bool
isRightToLeft(self) → bool
isSignalConnected(self, QMetaMethod) → bool
isVisible(self) → bool
isVisibleTo(self, QWidget) → bool
isWidgetType(self) → bool
isWindow(self) → bool
isWindowModified(self) → bool
isWindowType(self) → bool
keyPressEvent(self, QKeyEvent)
keyReleaseEvent(self, QKeyEvent)
keyboardGrabber() → QWidget
killTimer(self, int)
layout(self) → QLayout
layoutDirection(self) → Qt.LayoutDirection
leaveEvent(self, QEvent)
locale(self) → QLocale
logicalDpiX(self) → int
logicalDpiY(self) → int
lower(self)
makeEdge(edge)

Convenience method for calling makeEdges() for a single edge. Rather than return a dictionary mapping model edges to view edges, returns a singe view edge. Does not add a view edge to the view.

Parameters

edge (Edge) – a model edge

Returns

a view edge

Return type

object

makeNode(node)

Convenience method for calling makeNodes() with a single node. Rather than returning a dictionary mapping nodes to view nodes, returns the view node corresponding to the supplied node.

Parameters

node (Node) – the model node

Returns

the view node

Return type

object

mapFrom(self, QWidget, QPoint) → QPoint
mapFromGlobal(self, QPoint) → QPoint
mapFromParent(self, QPoint) → QPoint
mapTo(self, QWidget, QPoint) → QPoint
mapToGlobal(self, QPoint) → QPoint
mapToParent(self, QPoint) → QPoint
mask(self) → QRegion
maximumHeight(self) → int
maximumSize(self) → QSize
maximumWidth(self) → int
metaObject(self) → QMetaObject
metric(self, QPaintDevice.PaintDeviceMetric) → int
minimumHeight(self) → int
minimumSize(self) → QSize
minimumSizeHint(self) → QSize
minimumWidth(self) → int
mouseDoubleClickEvent(self, QMouseEvent)
mouseGrabber() → QWidget
mousePressEvent(self, QMouseEvent)
mouseReleaseEvent(self, QMouseEvent)
move(self, QPoint)

move(self, int, int)

moveEvent(self, QMoveEvent)
moveToThread(self, QThread)
nativeEvent(self, Union[QByteArray, bytes, bytearray], sip.voidptr) → Tuple[bool, int]
nativeParentWidget(self) → QWidget
nextInFocusChain(self) → QWidget
normalGeometry(self) → QRect
objectName(self) → str
objectNameChanged

objectNameChanged(self, str) [signal]

overrideWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])
overrideWindowState(self, Union[Qt.WindowStates, Qt.WindowState])
paintEngine(self) → QPaintEngine
paintEvent(self, QPaintEvent)
paintingActive(self) → bool
palette(self) → QPalette
parent(self) → QObject
parentWidget(self) → QWidget
physicalDpiX(self) → int
physicalDpiY(self) → int
pos(self) → QPoint
previousInFocusChain(self) → QWidget
property(self, str) → Any
pyqtConfigure(...)

Each keyword argument is either the name of a Qt property or a Qt signal. For properties the property is set to the given value which should be of an appropriate type. For signals the signal is connected to the given value which should be a callable.

raise_(self)
receivers(self, PYQT_SIGNAL) → int
rect(self) → QRect
releaseKeyboard(self)
releaseMouse(self)
releaseShortcut(self, int)
removeAction(self, QAction)
removeEdge(viewedge)

Convenience method for calling removeEdges() for a single edge.

Parameters

viewedge (object) – the view edge to remove from the view

removeEventFilter(self, QObject)
removeNode(viewnode)

Convenience method for calling removeNode() for a single node.

Parameters

viewnode (object) – a view node

removeSubview(subview)

Removes the specified subview. The subview is not deleted or altered, and the model remains set.

Parameters

subview

render(self, QPaintDevice, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground | QWidget.DrawChildren))

render(self, QPainter, targetOffset: QPoint = QPoint(), sourceRegion: QRegion = QRegion(), flags: Union[QWidget.RenderFlags, QWidget.RenderFlag] = QWidget.RenderFlags(QWidget.DrawWindowBackground|QWidget.DrawChildren))

repaint(self)

repaint(self, int, int, int, int) repaint(self, QRect) repaint(self, QRegion)

resize(self, QSize)

resize(self, int, int)

resizeEvent(self, QResizeEvent)
restoreGeometry(self, Union[QByteArray, bytes, bytearray]) → bool
saveGeometry(self) → QByteArray
NetworkViewer.scroll(self, int, int)

scroll(self, int, int, QRect)

sender(self) → QObject
senderSignalIndex(self) → int
setAcceptDrops(self, bool)
setAccessibleDescription(self, str)
setAccessibleName(self, str)
setAttribute(self, Qt.WidgetAttribute, on: bool = True)
setAutoFillBackground(self, bool)
setBackgroundRole(self, QPalette.ColorRole)
NetworkViewer.setBaseSize(self, int, int)

setBaseSize(self, QSize)

NetworkViewer.setContentsMargins(self, int, int, int, int)

setContentsMargins(self, QMargins)

setContextMenuPolicy(self, Qt.ContextMenuPolicy)
setCursor(self, Union[QCursor, Qt.CursorShape])
setDisabled(self, bool)
setEnabled(self, bool)
setFixedHeight(self, int)
setFixedSize(self, QSize)

setFixedSize(self, int, int)

setFixedWidth(self, int)
setFocus(self)

setFocus(self, Qt.FocusReason)

setFocusPolicy(self, Qt.FocusPolicy)
setFocusProxy(self, QWidget)
setFont(self, QFont)
setForegroundRole(self, QPalette.ColorRole)
setGeometry(self, QRect)

setGeometry(self, int, int, int, int)

setGraphicsEffect(self, QGraphicsEffect)
setHidden(self, bool)
setInputMethodHints(self, Union[Qt.InputMethodHints, Qt.InputMethodHint])
setLayout(self, QLayout)
setLayoutDirection(self, Qt.LayoutDirection)
setLocale(self, QLocale)
setMask(self, QBitmap)

setMask(self, QRegion)

setMaximumHeight(self, int)
NetworkViewer.setMaximumSize(self, int, int)

setMaximumSize(self, QSize)

setMaximumWidth(self, int)
setMinimumHeight(self, int)
NetworkViewer.setMinimumSize(self, int, int)

setMinimumSize(self, QSize)

setMinimumWidth(self, int)
setModelSyncEnabled(enable)

Enable or disable automatic synchronization with the model for this view and all subviews.

setMouseTracking(self, bool)
setObjectName(self, str)
setPalette(self, QPalette)
setParent(self, QWidget)

setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])

setProperty(self, str, Any) → bool
setShortcutAutoRepeat(self, int, enabled: bool = True)
setShortcutEnabled(self, int, enabled: bool = True)
NetworkViewer.setSizeIncrement(self, int, int)

setSizeIncrement(self, QSize)

setSizePolicy(self, QSizePolicy)

setSizePolicy(self, QSizePolicy.Policy, QSizePolicy.Policy)

setStatusTip(self, str)
setStyle(self, QStyle)
setStyleSheet(self, str)
NetworkViewer.setTabOrder(QWidget, QWidget)
setTabletTracking(self, bool)
setToolTip(self, str)
setToolTipDuration(self, int)
setUpdatesEnabled(self, bool)
setVisible(self, bool)
setWhatsThis(self, str)
setWindowFilePath(self, str)
setWindowFlag(self, Qt.WindowType, on: bool = True)
setWindowFlags(self, Union[Qt.WindowFlags, Qt.WindowType])
setWindowIcon(self, QIcon)
setWindowIconText(self, str)
setWindowModality(self, Qt.WindowModality)
setWindowModified(self, bool)
setWindowOpacity(self, float)
setWindowRole(self, str)
setWindowState(self, Union[Qt.WindowStates, Qt.WindowState])
setWindowTitle(self, str)
sharedPainter(self) → QPainter
show(self)
showEvent(self, QShowEvent)
showFullScreen(self)
showMaximized(self)
showMinimized(self)
showNormal(self)
signalsBlocked(self) → bool
size(self) → QSize
sizeHint(self) → QSize
sizeIncrement(self) → QSize
sizePolicy(self) → QSizePolicy
stackUnder(self, QWidget)
startTimer(self, int, timerType: Qt.TimerType = Qt.CoarseTimer) → int
staticMetaObject = <PyQt5.QtCore.QMetaObject object>
statusTip(self) → str
style(self) → QStyle
styleSheet(self) → str
syncAll()

Synchronize the full model and selection state.

syncEdges()
syncModel()
syncNodes()
syncNodesAdded(nodes)
syncNodesChanged(nodes)
syncNodesDeleted(nodes)
syncRecursive()

Synchronize the full model and selection state on this view and all subviews.

syncSelection(selection, source)
tabletEvent(self, QTabletEvent)
testAttribute(self, Qt.WidgetAttribute) → bool
thread(self) → QThread
timerEvent(self, QTimerEvent)
toolTip(self) → str
toolTipDuration(self) → int
tr(self, str, disambiguation: str = None, n: int = - 1) → str
underMouse(self) → bool
ungrabGesture(self, Qt.GestureType)
unsetCursor(self)
unsetLayoutDirection(self)
unsetLocale(self)
update(self)

update(self, QRect) update(self, QRegion) update(self, int, int, int, int)

updateEdge(edge)

A convenience method for calling updateEdges() for a single edge.

Parameters

edge (Edge) – the model edge corresponding to the view edge to update

updateGeometry(self)
updateMicroFocus(self)
updateNode(node)

Convenience method for calling updateNodes() for a single node.

Parameters

node (Node) – the model node to update to

updatesEnabled(self) → bool
visibleRegion(self) → QRegion
whatsThis(self) → str
wheelEvent(self, QWheelEvent)
width(self) → int
widthMM(self) → int
winId(self) → sip.voidptr
window(self) → QWidget
windowFilePath(self) → str
windowFlags(self) → Qt.WindowFlags
windowHandle(self) → QWindow
windowIcon(self) → QIcon
windowIconChanged

windowIconChanged(self, QIcon) [signal]

windowIconText(self) → str
windowIconTextChanged

windowIconTextChanged(self, str) [signal]

windowModality(self) → Qt.WindowModality
windowOpacity(self) → float
windowRole(self) → str
windowState(self) → Qt.WindowStates
windowTitle(self) → str
windowTitleChanged

windowTitleChanged(self, str) [signal]

windowType(self) → Qt.WindowType
x(self) → int
y(self) → int
schrodinger.ui.qt.network_visualizer.perp(a)
schrodinger.ui.qt.network_visualizer.seg_intersect(a1, a2, b1, b2)

Checks whether two line segments cross each other.

Parameters
  • a1 (numpy.array) – first endpoint of line segment a

  • a2 (numpy.array) – second endpoint of line segment a

  • b1 (numpy.array) – first endpoint of line segment b

  • b2 (numpy.array) – second endpoint of line segment b

Returns

whether the line segments intersect

Return type

bool

schrodinger.ui.qt.network_visualizer.fruchterman_reingold_layout(G, dim=2, pos=None, fixed=None, iterations=50, weight='weight', scale=1)

Position nodes using Fruchterman-Reingold force-directed algorithm.

Parameters
  • G – NetworkX graph

  • dim (int) – Dimension of layout

  • pos (dict) – Initial positions for nodes as a dictionary with node as keys and values as a list or tuple. If None, then use random initial positions.

  • fixed (list) – Nodes to keep fixed at initial position. optional

  • iterations (int) – Number of iterations of spring-force relaxation

  • weight (str or None) – The edge attribute that holds the numerical value used for the edge weight. If None, then all edge weights are 1.

  • scale (float) – Scale factor for positions

Return type

dict

Returns

A dictionary of positions keyed by gnode

Examples:

>>> G=nx.path_graph(4)
>>> pos=nx.spring_layout(G)

# The same using longer function name
>>> pos=nx.fruchterman_reingold_layout(G)
schrodinger.ui.qt.network_visualizer.spring_layout(G, dim=2, pos=None, fixed=None, iterations=50, weight='weight', scale=1)

Position nodes using Fruchterman-Reingold force-directed algorithm.

Parameters
  • G – NetworkX graph

  • dim (int) – Dimension of layout

  • pos (dict) – Initial positions for nodes as a dictionary with node as keys and values as a list or tuple. If None, then use random initial positions.

  • fixed (list) – Nodes to keep fixed at initial position. optional

  • iterations (int) – Number of iterations of spring-force relaxation

  • weight (str or None) – The edge attribute that holds the numerical value used for the edge weight. If None, then all edge weights are 1.

  • scale (float) – Scale factor for positions

Return type

dict

Returns

A dictionary of positions keyed by gnode

Examples:

>>> G=nx.path_graph(4)
>>> pos=nx.spring_layout(G)

# The same using longer function name
>>> pos=nx.fruchterman_reingold_layout(G)