-
Notifications
You must be signed in to change notification settings - Fork 299
Description
Description
When clicking on a pipe connection between 2 nodes, the original pipe is immediately deleted, and a live connection pipe is started. If you release the LMB having not connected to another port the connection between the original ports is disconnected.
It is this disconnection that should delete the pipe following the emitted connection_changed
signal, however the pipe is already deleted from the sceneMousePressEvent
.
This causes an issue if I disconnect the graph and viewers connection_changed
signal (to make the graph not editable), the pipe should not be deleted on click, but rather after the connection_changed
has fired
# my sample code
graph.viewer().connection_changed.disconnect(
graph._on_connection_changed
)
Possible Solution
Remove the following line in the NodeViewer.sceneMousePressEvent
function:
if pipe_items:
if not self.LMB_state:
return
pipe = pipe_items[0]
attr = {IN_PORT: 'output_port', OUT_PORT: 'input_port'}
from_port = pipe.port_from_pos(pos, True)
from_port._hovered = True
self._detached_port = getattr(pipe, attr[from_port.port_type])
self.start_live_connection(from_port)
self._live_pipe.draw_path(self._start_port, None, pos)
# pipe.delete() <-- remove this line, let the signals handle this later
This is perhaps a niche bug to my use case so understand if this fix isn't suitable. However I think a general graph setting for enabling/disabling new connections would be great!