Skip to content

Commit 09d3c9b

Browse files
committed
small cleanup
1 parent a712170 commit 09d3c9b

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

NodeGraphQt/widgets/pipe.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -92,13 +92,10 @@ def paint(self, painter, option, widget):
9292
color = QtGui.QColor(*PIPE_HIGHLIGHT_COLOR)
9393
pen_style = PIPE_STYLES.get(PIPE_STYLE_DEFAULT)
9494

95-
if self.input_port and self.output_port:
96-
in_node = self.input_port.node
97-
out_node = self.output_port.node
98-
if in_node.disabled or out_node.disabled:
99-
color.setAlpha(200)
100-
pen_width += 0.2
101-
pen_style = PIPE_STYLES.get(PIPE_STYLE_DOTTED)
95+
if self.disabled():
96+
color.setAlpha(200)
97+
pen_width += 0.2
98+
pen_style = PIPE_STYLES.get(PIPE_STYLE_DOTTED)
10299

103100
pen = QtGui.QPen(color, pen_width)
104101
pen.setStyle(pen_style)
@@ -240,6 +237,13 @@ def set_connections(self, port1, port2):
240237
ports[IN_PORT].add_pipe(self)
241238
ports[OUT_PORT].add_pipe(self)
242239

240+
def disabled(self):
241+
if self.input_port and self.input_port.node.disabled:
242+
return True
243+
if self.output_port and self.output_port.node.disabled:
244+
return True
245+
return False
246+
243247
@property
244248
def input_port(self):
245249
return self._input_port

0 commit comments

Comments
 (0)