55import re
66import copy
77
8- from NodeGraphQt import QtCore , QtWidgets , QtGui
9- from NodeGraphQt . base .commands import (NodeAddedCmd ,
10- NodeRemovedCmd ,
11- NodeMovedCmd ,
12- PortConnectedCmd )
13- from NodeGraphQt . base .factory import NodeFactory
14- from NodeGraphQt . base .menu import NodeGraphMenu , NodesMenu
15- from NodeGraphQt . base .model import NodeGraphModel
16- from NodeGraphQt . base .node import NodeObject , BaseNode
17- from NodeGraphQt . base .port import Port
18- from NodeGraphQt .constants import (DRAG_DROP_ID ,
19- PIPE_LAYOUT_CURVED ,
20- PIPE_LAYOUT_STRAIGHT ,
21- PIPE_LAYOUT_ANGLE ,
22- IN_PORT , OUT_PORT )
23- from NodeGraphQt .widgets .viewer import NodeViewer
8+ from .. import QtCore , QtWidgets , QtGui
9+ from .commands import (NodeAddedCmd ,
10+ NodeRemovedCmd ,
11+ NodeMovedCmd ,
12+ PortConnectedCmd )
13+ from .factory import NodeFactory
14+ from .menu import NodeGraphMenu , NodesMenu
15+ from .model import NodeGraphModel
16+ from .node import NodeObject , BaseNode
17+ from .port import Port
18+ from . .constants import (DRAG_DROP_ID ,
19+ PIPE_LAYOUT_CURVED ,
20+ PIPE_LAYOUT_STRAIGHT ,
21+ PIPE_LAYOUT_ANGLE ,
22+ IN_PORT , OUT_PORT )
23+ from . .widgets .viewer import NodeViewer
2424
2525
2626class QWidgetDrops (QtWidgets .QWidget ):
@@ -43,7 +43,7 @@ def dropEvent(self, event):
4343 for url in event .mimeData ().urls ():
4444 self .import_session (url .toLocalFile ())
4545 else :
46- e .ignore ()
46+ event .ignore ()
4747
4848
4949class NodeGraph (QtCore .QObject ):
@@ -119,6 +119,7 @@ class NodeGraph(QtCore.QObject):
119119 :parameters: :str
120120 :emits: new session path
121121 """
122+
122123 def __init__ (self , parent = None ):
123124 super (NodeGraph , self ).__init__ (parent )
124125 self .setObjectName ('NodeGraphQt' )
@@ -204,7 +205,7 @@ def _on_property_bin_changed(self, node_id, prop_name, prop_value):
204205 node = self .get_node_by_id (node_id )
205206
206207 # prevent signals from causing a infinite loop.
207- _exc = [float , int , str , bool , None ]
208+ _exc = [float , int , str , bool , None ]
208209 if node .get_property (prop_name ) != prop_value :
209210 if type (node .get_property (prop_name )) in _exc :
210211 value = prop_value
@@ -351,8 +352,8 @@ def widget(self):
351352 if self ._widget is None :
352353 self ._widget = QWidgetDrops ()
353354 self ._widget .import_session = self .import_session
354-
355- layout = QtWidgets .QVBoxLayout (self ._widget )
355+
356+ layout = QtWidgets .QVBoxLayout (self ._widget )
356357 layout .setContentsMargins (0 , 0 , 0 , 0 )
357358 layout .addWidget (self ._viewer )
358359 return self ._widget
@@ -1087,7 +1088,7 @@ def import_session(self, file_path):
10871088 Args:
10881089 file_path (str): path to the serialized layout file.
10891090 """
1090-
1091+
10911092 file_path = file_path .strip ()
10921093 if not os .path .isfile (file_path ):
10931094 raise IOError ('file does not exist.' )
0 commit comments