File tree Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Expand file tree Collapse file tree 3 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -1550,6 +1550,18 @@ def clear_selection(self):
15501550 [node .set_selected (False ) for node in self .all_nodes ()]
15511551 self ._undo_stack .endMacro ()
15521552
1553+ def invert_selection (self ):
1554+ """
1555+ Inverts the current node selection.
1556+ """
1557+ if not self .selected_nodes ():
1558+ self .select_all ()
1559+ return
1560+ self ._undo_stack .beginMacro ('invert selection' )
1561+ for node in self .all_nodes ():
1562+ node .set_selected (not node .selected ())
1563+ self ._undo_stack .endMacro ()
1564+
15531565 def get_node_by_id (self , node_id = None ):
15541566 """
15551567 Returns the node from the node id string.
Original file line number Diff line number Diff line change @@ -164,6 +164,13 @@ def clear_node_selection(graph):
164164 graph .clear_selection ()
165165
166166
167+ def invert_node_selection (graph ):
168+ """
169+ Invert node selection.
170+ """
171+ graph .invert_selection ()
172+
173+
167174def disable_nodes (graph ):
168175 """
169176 Toggle disable on selected nodes.
Original file line number Diff line number Diff line change 9898 "file" :" ../examples/hotkeys/hotkey_functions.py" ,
9999 "function_name" :" clear_node_selection" ,
100100 "shortcut" :" Ctrl+Shift+A"
101+ },
102+ {
103+ "type" :" command" ,
104+ "label" :" Invert Selection" ,
105+ "file" :" ../examples/hotkeys/hotkey_functions.py" ,
106+ "function_name" :" invert_node_selection"
101107 },
102108 {
103109 "type" :" command" ,
You can’t perform that action at this time.
0 commit comments