Skip to content

Commit 0e537aa

Browse files
committed
updated port indicator
1 parent 30b9d79 commit 0e537aa

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

NodeGraphQt/qgraphics/port.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,8 @@ def paint(self, painter, option, widget):
5555
painter.save()
5656

5757
rect = QtCore.QRectF(0.0, 0.8, self._width, self._height)
58-
painter.setBrush(QtGui.QColor(0, 0, 0, 200))
59-
painter.setPen(QtGui.QPen(QtGui.QColor(0, 0, 0, 255), 1.8))
6058
path = QtGui.QPainterPath()
6159
path.addEllipse(rect)
62-
painter.drawPath(path)
6360

6461
if self._hovered:
6562
color = QtGui.QColor(*PORT_HOVER_COLOR)
@@ -76,6 +73,28 @@ def paint(self, painter, option, widget):
7673
painter.setPen(pen)
7774
painter.drawEllipse(self.boundingRect())
7875

76+
if self.connected_pipes and not self._hovered:
77+
painter.setBrush(border_color)
78+
w = self._width / 2.5
79+
h = self._height / 2.5
80+
rect = QtCore.QRectF(self.boundingRect().center().x() - w / 2,
81+
self.boundingRect().center().y() - h / 2,
82+
w, h)
83+
painter.drawEllipse(rect)
84+
elif self._hovered:
85+
if self.multi_connection:
86+
painter.setBrush(color)
87+
w = self._width / 1.8
88+
h = self._height / 1.8
89+
else:
90+
painter.setBrush(border_color)
91+
w = self._width / 3.5
92+
h = self._height / 3.5
93+
rect = QtCore.QRectF(self.boundingRect().center().x() - w / 2,
94+
self.boundingRect().center().y() - h / 2,
95+
w, h)
96+
painter.drawEllipse(rect)
97+
7998
painter.restore()
8099

81100
def itemChange(self, change, value):

0 commit comments

Comments
 (0)