File tree Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Expand file tree Collapse file tree 2 files changed +14
-12
lines changed Original file line number Diff line number Diff line change 1414from NodeGraphQt .base .model import NodeGraphModel
1515from NodeGraphQt .base .node import NodeObject
1616from NodeGraphQt .base .port import Port
17- from NodeGraphQt .constants import DRAG_DROP_ID
17+ from NodeGraphQt .constants import (DRAG_DROP_ID ,
18+ PIPE_LAYOUT_CURVED ,
19+ PIPE_LAYOUT_STRAIGHT )
1820from NodeGraphQt .widgets .viewer import NodeViewer
1921
2022
@@ -381,15 +383,20 @@ def set_acyclic(self, mode=False):
381383 self ._model .acyclic = mode
382384 self ._viewer .acyclic = mode
383385
384- def set_pipe_layout (self , layout = 'curved' ):
386+ def set_pipe_style (self , style = None ):
385387 """
386388 Set node graph pipes to be drawn straight or curved by default
387- all pipes are set curved. (default='curved')
389+ all pipes are set curved. (default=0)
390+
391+ PIPE_LAYOUT_CURVED = 0
392+ PIPE_LAYOUT_STRAIGHT = 1
388393
389394 Args:
390- layout (str ): 'straight' or 'curved'
395+ style (int ): pipe style.
391396 """
392- self ._viewer .set_pipe_layout (layout )
397+ pipe_default = max ([PIPE_LAYOUT_CURVED , PIPE_LAYOUT_STRAIGHT ])
398+ style = PIPE_LAYOUT_STRAIGHT if style > pipe_default else style
399+ self ._viewer .set_pipe_layout (style )
393400
394401 def fit_to_selection (self ):
395402 """
Original file line number Diff line number Diff line change 55from NodeGraphQt import QtGui , QtCore , QtWidgets
66from NodeGraphQt .constants import (IN_PORT , OUT_PORT ,
77 PIPE_LAYOUT_CURVED ,
8- PIPE_LAYOUT_STRAIGHT ,
98 PIPE_STYLE_DASHED ,
109 SCENE_AREA ,
1110 Z_VAL_NODE_WIDGET )
@@ -677,12 +676,8 @@ def center_selection(self, nodes=None):
677676 def get_pipe_layout (self ):
678677 return self ._pipe_layout
679678
680- def set_pipe_layout (self , layout = '' ):
681- layout_types = {
682- 'curved' : PIPE_LAYOUT_CURVED ,
683- 'straight' : PIPE_LAYOUT_STRAIGHT
684- }
685- self ._pipe_layout = layout_types .get (layout , 'curved' )
679+ def set_pipe_layout (self , layout ):
680+ self ._pipe_layout = layout
686681 for pipe in self .all_pipes ():
687682 pipe .draw_path (pipe .input_port , pipe .output_port )
688683
You can’t perform that action at this time.
0 commit comments