@@ -63,13 +63,13 @@ def __init__(self, parent=None):
6363 QtWidgets .QRubberBand .Rectangle , self
6464 )
6565
66- self ._live_pipe = LivePipe ()
67- self ._live_pipe .setVisible (False )
68- self .scene ().addItem (self ._live_pipe )
66+ self ._LIVE_PIPE = LivePipe ()
67+ self ._LIVE_PIPE .setVisible (False )
68+ self .scene ().addItem (self ._LIVE_PIPE )
6969
70- self ._pipe_slicer = SlicerPipe ()
71- self ._pipe_slicer .setVisible (False )
72- self .scene ().addItem (self ._pipe_slicer )
70+ self ._SLICER_PIPE = SlicerPipe ()
71+ self ._SLICER_PIPE .setVisible (False )
72+ self .scene ().addItem (self ._SLICER_PIPE )
7373
7474 self ._undo_stack = QtWidgets .QUndoStack (self )
7575 self ._context_menu = QtWidgets .QMenu ('main' , self )
@@ -128,7 +128,7 @@ def _items_near(self, pos, item_type=None, width=20, height=20):
128128 x , y = pos .x () - width , pos .y () - height
129129 rect = QtCore .QRectF (x , y , width , height )
130130 items = []
131- excl = [self ._live_pipe , self ._pipe_slicer ]
131+ excl = [self ._LIVE_PIPE , self ._SLICER_PIPE ]
132132 for item in self .scene ().items (rect ):
133133 if item in excl :
134134 continue
@@ -144,7 +144,7 @@ def _on_pipes_sliced(self, path):
144144 self .connection_sliced .emit ([
145145 [i .input_port , i .output_port ]
146146 for i in self .scene ().items (path )
147- if isinstance (i , Pipe ) and i != self ._live_pipe
147+ if isinstance (i , Pipe ) and i != self ._LIVE_PIPE
148148 ])
149149
150150 # --- reimplemented events ---
@@ -180,8 +180,8 @@ def mousePressEvent(self, event):
180180
181181 # pipe slicer enabled.
182182 if self .ALT_state and self .SHIFT_state :
183- self ._pipe_slicer .draw_path (map_pos , map_pos )
184- self ._pipe_slicer .setVisible (True )
183+ self ._SLICER_PIPE .draw_path (map_pos , map_pos )
184+ self ._SLICER_PIPE .setVisible (True )
185185 return
186186
187187 # pan mode.
@@ -224,11 +224,11 @@ def mouseReleaseEvent(self, event):
224224 self .MMB_state = False
225225
226226 # hide pipe slicer.
227- if self ._pipe_slicer .isVisible ():
228- self ._on_pipes_sliced (self ._pipe_slicer .path ())
227+ if self ._SLICER_PIPE .isVisible ():
228+ self ._on_pipes_sliced (self ._SLICER_PIPE .path ())
229229 p = QtCore .QPointF (0.0 , 0.0 )
230- self ._pipe_slicer .draw_path (p , p )
231- self ._pipe_slicer .setVisible (False )
230+ self ._SLICER_PIPE .draw_path (p , p )
231+ self ._SLICER_PIPE .setVisible (False )
232232
233233 # hide selection marquee
234234 if self ._rubber_band .isVisible ():
@@ -252,11 +252,11 @@ def mouseReleaseEvent(self, event):
252252
253253 def mouseMoveEvent (self , event ):
254254 if self .ALT_state and self .SHIFT_state :
255- if self .LMB_state and self ._pipe_slicer .isVisible ():
256- p1 = self ._pipe_slicer .path ().pointAtPercent (0 )
255+ if self .LMB_state and self ._SLICER_PIPE .isVisible ():
256+ p1 = self ._SLICER_PIPE .path ().pointAtPercent (0 )
257257 p2 = self .mapToScene (self ._previous_pos )
258- self ._pipe_slicer .draw_path (p1 , p2 )
259- self ._pipe_slicer .show ()
258+ self ._SLICER_PIPE .draw_path (p1 , p2 )
259+ self ._SLICER_PIPE .show ()
260260 self ._previous_pos = event .pos ()
261261 super (NodeViewer , self ).mouseMoveEvent (event )
262262 return
@@ -347,7 +347,7 @@ def sceneMouseMoveEvent(self, event):
347347 event (QtWidgets.QGraphicsSceneMouseEvent):
348348 The event handler from the QtWidgets.QGraphicsScene
349349 """
350- if not self ._live_pipe .isVisible ():
350+ if not self ._LIVE_PIPE .isVisible ():
351351 return
352352 if not self ._start_port :
353353 return
@@ -361,7 +361,7 @@ def sceneMouseMoveEvent(self, event):
361361 pos .setX (pos .x () + x )
362362 pos .setY (pos .y () + y )
363363
364- self ._live_pipe .draw_path (self ._start_port , cursor_pos = pos )
364+ self ._LIVE_PIPE .draw_path (self ._start_port , cursor_pos = pos )
365365
366366 def sceneMousePressEvent (self , event ):
367367 """
@@ -417,10 +417,10 @@ def sceneMousePressEvent(self, event):
417417 attr = {IN_PORT : 'output_port' , OUT_PORT : 'input_port' }
418418 self ._detached_port = getattr (pipe , attr [from_port .port_type ])
419419 self .start_live_connection (from_port )
420- self ._live_pipe .draw_path (self ._start_port , cursor_pos = pos )
420+ self ._LIVE_PIPE .draw_path (self ._start_port , cursor_pos = pos )
421421
422422 if self .SHIFT_state :
423- self ._live_pipe .shift_selected = True
423+ self ._LIVE_PIPE .shift_selected = True
424424 return
425425
426426 pipe .delete ()
@@ -434,7 +434,7 @@ def sceneMouseReleaseEvent(self, event):
434434 event (QtWidgets.QGraphicsSceneMouseEvent):
435435 The event handler from the QtWidgets.QGraphicsScene
436436 """
437- if not self ._live_pipe .isVisible ():
437+ if not self ._LIVE_PIPE .isVisible ():
438438 return
439439
440440 self ._start_port ._hovered = False
@@ -451,7 +451,7 @@ def sceneMouseReleaseEvent(self, event):
451451
452452 # if port disconnected from existing pipe.
453453 if end_port is None :
454- if self ._detached_port and not self ._live_pipe .shift_selected :
454+ if self ._detached_port and not self ._LIVE_PIPE .shift_selected :
455455 disconnected .append ((self ._start_port , self ._detached_port ))
456456 self .connection_changed .emit (disconnected , connected )
457457
@@ -515,19 +515,19 @@ def start_live_connection(self, selected_port):
515515 return
516516 self ._start_port = selected_port
517517 if self ._start_port .type == IN_PORT :
518- self ._live_pipe .input_port = self ._start_port
518+ self ._LIVE_PIPE .input_port = self ._start_port
519519 elif self ._start_port == OUT_PORT :
520- self ._live_pipe .output_port = self ._start_port
521- self ._live_pipe .setVisible (True )
520+ self ._LIVE_PIPE .output_port = self ._start_port
521+ self ._LIVE_PIPE .setVisible (True )
522522
523523 def end_live_connection (self ):
524524 """
525525 delete live connection pipe and reset start port.
526526 (hides the pipe item used for drawing the live connection)
527527 """
528- self ._live_pipe .reset_path ()
529- self ._live_pipe .setVisible (False )
530- self ._live_pipe .shift_selected = False
528+ self ._LIVE_PIPE .reset_path ()
529+ self ._LIVE_PIPE .setVisible (False )
530+ self ._LIVE_PIPE .shift_selected = False
531531 self ._start_port = None
532532
533533 def establish_connection (self , start_port , end_port ):
@@ -624,7 +624,7 @@ def save_dialog(self, current_dir=None, ext=None):
624624
625625 def all_pipes (self ):
626626 pipes = []
627- excl = [self ._live_pipe , self ._pipe_slicer ]
627+ excl = [self ._LIVE_PIPE , self ._SLICER_PIPE ]
628628 for item in self .scene ().items ():
629629 if isinstance (item , Pipe ) and item not in excl :
630630 pipes .append (item )
0 commit comments