1818from NodeGraphQt .base .port import Port
1919from NodeGraphQt .constants import (
2020 NODE_LAYOUT_DIRECTION , NODE_LAYOUT_HORIZONTAL , NODE_LAYOUT_VERTICAL ,
21- PIPE_LAYOUT ,
21+ PipeLayoutEnum ,
2222 URI_SCHEME , URN_SCHEME ,
23- PORT_TYPE ,
24- VIEWER_STYLING
23+ PortTypeEnum ,
24+ ViewerEnum
2525)
2626from NodeGraphQt .nodes .backdrop_node import BackdropNode
2727from NodeGraphQt .nodes .base_node import BaseNode
@@ -369,7 +369,8 @@ def _on_connection_changed(self, disconnected, connected):
369369 return
370370
371371 label = 'connect node(s)' if connected else 'disconnect node(s)'
372- ptypes = {PORT_TYPE .IN .value : 'inputs' , PORT_TYPE .OUT .value : 'outputs' }
372+ ptypes = {PortTypeEnum .IN .value : 'inputs' ,
373+ PortTypeEnum .OUT .value : 'outputs' }
373374
374375 self ._undo_stack .beginMacro (label )
375376 for p1_view , p2_view in disconnected :
@@ -396,7 +397,8 @@ def _on_connection_sliced(self, ports):
396397 """
397398 if not ports :
398399 return
399- ptypes = {PORT_TYPE .IN .value : 'inputs' , PORT_TYPE .OUT .value : 'outputs' }
400+ ptypes = {PortTypeEnum .IN .value : 'inputs' ,
401+ PortTypeEnum .OUT .value : 'outputs' }
400402 self ._undo_stack .beginMacro ('slice connections' )
401403 for p1_view , p2_view in ports :
402404 node1 = self ._model .nodes [p1_view .node .id ]
@@ -562,20 +564,20 @@ def set_grid_mode(self, mode=None):
562564
563565 Node graph background types:
564566
565- * :attr:`NodeGraphQt.constants.VIEWER_STYLING .GRID_DISPLAY_NONE.value`
566- * :attr:`NodeGraphQt.constants.VIEWER_STYLING .GRID_DISPLAY_DOTS.value`
567- * :attr:`NodeGraphQt.constants.VIEWER_STYLING .GRID_DISPLAY_LINES.value`
567+ * :attr:`NodeGraphQt.constants.ViewerEnum .GRID_DISPLAY_NONE.value`
568+ * :attr:`NodeGraphQt.constants.ViewerEnum .GRID_DISPLAY_DOTS.value`
569+ * :attr:`NodeGraphQt.constants.ViewerEnum .GRID_DISPLAY_LINES.value`
568570
569571 Args:
570572 mode (int): background style.
571573 """
572574 display_types = [
573- VIEWER_STYLING .GRID_DISPLAY_NONE .value ,
574- VIEWER_STYLING .GRID_DISPLAY_DOTS .value ,
575- VIEWER_STYLING .GRID_DISPLAY_LINES .value
575+ ViewerEnum .GRID_DISPLAY_NONE .value ,
576+ ViewerEnum .GRID_DISPLAY_DOTS .value ,
577+ ViewerEnum .GRID_DISPLAY_LINES .value
576578 ]
577579 if mode not in display_types :
578- mode = VIEWER_STYLING .GRID_DISPLAY_LINES .value
580+ mode = ViewerEnum .GRID_DISPLAY_LINES .value
579581 self .scene ().grid_mode = mode
580582 self ._viewer .force_update ()
581583
@@ -759,7 +761,7 @@ def set_pipe_collision(self, mode=True):
759761 self ._model .pipe_collision = mode
760762 self ._viewer .pipe_collision = mode
761763
762- def set_pipe_style (self , style = PIPE_LAYOUT .CURVED .value ):
764+ def set_pipe_style (self , style = PipeLayoutEnum .CURVED .value ):
763765 """
764766 Set node graph pipes to be drawn as straight, curved or angled.
765767
@@ -771,17 +773,17 @@ def set_pipe_style(self, style=PIPE_LAYOUT.CURVED.value):
771773
772774 Pipe Layout Styles:
773775
774- * :attr:`NodeGraphQt.constants.PIPE_LAYOUT .CURVED.value`
775- * :attr:`NodeGraphQt.constants.PIPE_LAYOUT .STRAIGHT.value`
776- * :attr:`NodeGraphQt.constants.PIPE_LAYOUT .ANGLE.value`
776+ * :attr:`NodeGraphQt.constants.PipeLayoutEnum .CURVED.value`
777+ * :attr:`NodeGraphQt.constants.PipeLayoutEnum .STRAIGHT.value`
778+ * :attr:`NodeGraphQt.constants.PipeLayoutEnum .ANGLE.value`
777779
778780 Args:
779781 style (int): pipe layout style.
780782 """
781- pipe_max = max ([PIPE_LAYOUT .CURVED .value ,
782- PIPE_LAYOUT .STRAIGHT .value ,
783- PIPE_LAYOUT .ANGLE .value ])
784- style = style if 0 <= style <= pipe_max else PIPE_LAYOUT .CURVED .value
783+ pipe_max = max ([PipeLayoutEnum .CURVED .value ,
784+ PipeLayoutEnum .STRAIGHT .value ,
785+ PipeLayoutEnum .ANGLE .value ])
786+ style = style if 0 <= style <= pipe_max else PipeLayoutEnum .CURVED .value
785787 self ._viewer .set_pipe_layout (style )
786788
787789 def fit_to_selection (self ):
@@ -1254,8 +1256,8 @@ def _serialize(self, nodes):
12541256 for conn_id , prt_names in conn_data .items ():
12551257 for conn_prt in prt_names :
12561258 pipe = {
1257- PORT_TYPE .IN .value : [n_id , pname ],
1258- PORT_TYPE .OUT .value : [conn_id , conn_prt ]
1259+ PortTypeEnum .IN .value : [n_id , pname ],
1260+ PortTypeEnum .OUT .value : [conn_id , conn_prt ]
12591261 }
12601262 if pipe not in serial_data ['connections' ]:
12611263 serial_data ['connections' ].append (pipe )
@@ -1264,8 +1266,8 @@ def _serialize(self, nodes):
12641266 for conn_id , prt_names in conn_data .items ():
12651267 for conn_prt in prt_names :
12661268 pipe = {
1267- PORT_TYPE .OUT .value : [n_id , pname ],
1268- PORT_TYPE .IN .value : [conn_id , conn_prt ]
1269+ PortTypeEnum .OUT .value : [n_id , pname ],
1270+ PortTypeEnum .IN .value : [conn_id , conn_prt ]
12691271 }
12701272 if pipe not in serial_data ['connections' ]:
12711273 serial_data ['connections' ].append (pipe )
@@ -2374,8 +2376,8 @@ def get_node_by_port(self, port):
23742376 PortInputNode or PortOutputNode: port node object.
23752377 """
23762378 func_type = {
2377- PORT_TYPE .IN .value : self .get_input_port_nodes ,
2378- PORT_TYPE .OUT .value : self .get_output_port_nodes
2379+ PortTypeEnum .IN .value : self .get_input_port_nodes ,
2380+ PortTypeEnum .OUT .value : self .get_output_port_nodes
23792381 }
23802382 for n in func_type .get (port .type_ (), []):
23812383 if port == n .parent_port :
0 commit comments