@@ -1660,7 +1660,8 @@ def clear_session(self):
16601660 """
16611661 Clears the current node graph session.
16621662 """
1663- for n in self .all_nodes ():
1663+ nodes = self .all_nodes ()
1664+ for n in nodes :
16641665 if isinstance (n , BaseNode ):
16651666 for p in n .input_ports ():
16661667 if p .locked ():
@@ -1670,7 +1671,7 @@ def clear_session(self):
16701671 if p .locked ():
16711672 p .set_locked (False , connected_ports = False )
16721673 p .clear_connections ()
1673- self ._undo_stack .push (NodeRemovedCmd (self , n ))
1674+ self ._undo_stack .push (NodesRemovedCmd (self , nodes ))
16741675 self ._undo_stack .clear ()
16751676 self ._model .session = ''
16761677
@@ -1819,9 +1820,12 @@ def _deserialize(self, data, relative_pos=False, pos=None):
18191820 allow_connection = any ([not in_port .model .connected_ports ,
18201821 in_port .model .multi_connection ])
18211822 if allow_connection :
1822- self ._undo_stack .push (PortConnectedCmd (in_port , out_port ))
1823+ self ._undo_stack .push (
1824+ PortConnectedCmd (in_port , out_port , emit_signal = False )
1825+ )
18231826
1824- # Run on_input_connected to ensure connections are fully set up after deserialization.
1827+ # Run on_input_connected to ensure connections are fully set up
1828+ # after deserialization.
18251829 in_node .on_input_connected (in_port , out_port )
18261830
18271831 node_objs = nodes .values ()
@@ -2009,8 +2013,7 @@ def cut_nodes(self, nodes=None):
20092013 if isinstance (node , GroupNode ) and node .is_expanded :
20102014 node .collapse ()
20112015
2012- self ._undo_stack .push (NodeRemovedCmd (self , node ))
2013-
2016+ self ._undo_stack .push (NodesRemovedCmd (self , nodes ))
20142017 self ._undo_stack .endMacro ()
20152018
20162019 def paste_nodes (self ):
@@ -2681,7 +2684,9 @@ def _deserialize(self, data, relative_pos=False, pos=None):
26812684 out_port = out_node .outputs ().get (pname ) if out_node else None
26822685
26832686 if in_port and out_port :
2684- self ._undo_stack .push (PortConnectedCmd (in_port , out_port ))
2687+ self ._undo_stack .push (
2688+ PortConnectedCmd (in_port , out_port , emit_signal = False )
2689+ )
26852690
26862691 node_objs = list (nodes .values ())
26872692 if relative_pos :
0 commit comments