@@ -160,20 +160,34 @@ def paint(self, painter, option, widget):
160160
161161 def __draw_path_cycled_vertical (self , start_port , pos1 , pos2 , path ):
162162 """
163- Draws the pipe path around the node if the in port and out port
164- connect to each other for cycle connection.
163+ Draw pipe vertically around node if connection is cyclic.
165164
166165 Args:
167166 start_port (PortItem): port used to draw the starting point.
168167 pos1 (QPointF): start port position.
169168 pos2 (QPointF): end port position.
170169 path (QPainterPath): path to draw.
171170 """
171+ ptype = start_port .port_type
172+ in_pos = pos1 if ptype == PortTypeEnum .IN .value else pos2
173+ out_pos = pos2 if ptype == PortTypeEnum .IN .value else pos1
174+
175+ n_rect = start_port .node .boundingRect ()
176+ padding = 40
177+
178+ top = in_pos .y () - padding
179+ bottom = out_pos .y () + padding
180+ path .moveTo (out_pos )
181+ path .lineTo (out_pos .x (), bottom )
182+ path .lineTo (out_pos .x () + n_rect .right (), bottom )
183+ path .lineTo (out_pos .x () + n_rect .right (), top )
184+ path .lineTo (in_pos .x (), top )
185+ path .lineTo (in_pos )
186+ self .setPath (path )
172187
173188 def __draw_path_cycled_horizontal (self , start_port , pos1 , pos2 , path ):
174189 """
175- Draws the pipe path around the node if the in port and out port
176- connect to each other for cycle connection.
190+ Draw pipe horizontally around node if connection is cyclic.
177191
178192 Args:
179193 start_port (PortItem): port used to draw the starting point.
0 commit comments