@@ -168,21 +168,20 @@ def __draw_path_cycled_vertical(self, start_port, pos1, pos2, path):
168168 pos2 (QPointF): end port position.
169169 path (QPainterPath): path to draw.
170170 """
171+ n_rect = start_port .node .boundingRect ()
171172 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
173+ start_pos = pos1 if ptype == PortTypeEnum .IN .value else pos2
174+ end_pos = pos2 if ptype == PortTypeEnum .IN .value else pos1
174175
175- n_rect = start_port .node .boundingRect ()
176176 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 )
177+ top = start_pos .y () - padding
178+ bottom = end_pos .y () + padding
179+ path .moveTo (end_pos )
180+ path .lineTo (end_pos .x (), bottom )
181+ path .lineTo (end_pos .x () + n_rect .right (), bottom )
182+ path .lineTo (end_pos .x () + n_rect .right (), top )
183+ path .lineTo (start_pos .x (), top )
184+ path .lineTo (start_pos )
186185 self .setPath (path )
187186
188187 def __draw_path_cycled_horizontal (self , start_port , pos1 , pos2 , path ):
@@ -195,21 +194,20 @@ def __draw_path_cycled_horizontal(self, start_port, pos1, pos2, path):
195194 pos2 (QPointF): end port position.
196195 path (QPainterPath): path to draw.
197196 """
197+ n_rect = start_port .node .boundingRect ()
198198 ptype = start_port .port_type
199- in_pos = pos1 if ptype == PortTypeEnum .IN .value else pos2
200- out_pos = pos2 if ptype == PortTypeEnum .IN .value else pos1
199+ start_pos = pos1 if ptype == PortTypeEnum .IN .value else pos2
200+ end_pos = pos2 if ptype == PortTypeEnum .IN .value else pos1
201201
202- n_rect = start_port .node .boundingRect ()
203202 padding = 40
204-
205- left = out_pos .x () + padding
206- right = in_pos .x () - padding
207- path .moveTo (out_pos )
208- path .lineTo (left , out_pos .y ())
209- path .lineTo (left , out_pos .y () + n_rect .bottom ())
210- path .lineTo (right , out_pos .y () + n_rect .bottom ())
211- path .lineTo (right , in_pos .y ())
212- path .lineTo (in_pos )
203+ left = end_pos .x () + padding
204+ right = start_pos .x () - padding
205+ path .moveTo (start_pos )
206+ path .lineTo (right , start_pos .y ())
207+ path .lineTo (right , end_pos .y () + n_rect .bottom ())
208+ path .lineTo (left , end_pos .y () + n_rect .bottom ())
209+ path .lineTo (left , end_pos .y ())
210+ path .lineTo (end_pos )
213211 self .setPath (path )
214212
215213 def __draw_path_vertical (self , start_port , pos1 , pos2 , path ):
@@ -326,7 +324,6 @@ def draw_path(self, start_port, end_port=None, cursor_pos=None):
326324
327325 line = QtCore .QLineF (pos1 , pos2 )
328326 path = QtGui .QPainterPath ()
329- path .moveTo (line .x1 (), line .y1 ())
330327
331328 direction = self .viewer_layout_direction ()
332329
@@ -343,6 +340,8 @@ def draw_path(self, start_port, end_port=None, cursor_pos=None):
343340 )
344341 return
345342
343+ path .moveTo (line .x1 (), line .y1 ())
344+
346345 if self .viewer_pipe_layout () == PipeLayoutEnum .STRAIGHT .value :
347346 path .lineTo (pos2 )
348347 self .setPath (path )
0 commit comments