Skip to content

Commit 7c9b1ad

Browse files
authored
Merge pull request #1673 from janezd/force-show-link-dlg
[ENH] Canvas: Always show the link dialog if the user holds Shift
2 parents 5899ce2 + a6cb8f7 commit 7c9b1ad

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Orange/canvas/document/interactions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,6 +228,7 @@ def __init__(self, document, *args, **kwargs):
228228
self.sink_item = None
229229
self.from_item = None
230230
self.direction = None
231+
self.force_link_dialog = False
231232

232233
# An `NodeItem` currently under the mouse as a possible
233234
# link drop target.
@@ -324,6 +325,8 @@ def mousePressEvent(self, event):
324325
self.tr('<h3>Create new link</h3>'
325326
'<p>Drag a link to an existing node or release on '
326327
'an empty spot to create a new node.</p>'
328+
'<p>Hold Shift when releasing the mouse button to '
329+
'edit connections.</p>'
327330
# '<a href="help://orange-canvas/create-new-links">'
328331
# 'More ...</a>'
329332
)
@@ -392,6 +395,7 @@ def mouseMoveEvent(self, event):
392395

393396
def mouseReleaseEvent(self, event):
394397
if self.tmp_link_item:
398+
self.force_link_dialog = bool(event.modifiers() & Qt.ShiftModifier)
395399
item = self.target_node_item_at(event.scenePos())
396400
node = None
397401
stack = self.document.undoStack()
@@ -501,7 +505,7 @@ def connect_nodes(self, source_node, sink_node):
501505
# to SchemeLinks later
502506
links_to_add = [(source, sink)]
503507
links_to_remove = []
504-
show_link_dialog = False
508+
show_link_dialog = self.force_link_dialog
505509

506510
# Ambiguous new link request.
507511
if len(possible) >= 2:
@@ -582,6 +586,8 @@ def connect_nodes(self, source_node, sink_node):
582586
log.error("An error occurred during the creation of a new link.",
583587
exc_info=True)
584588
self.cancel()
589+
finally:
590+
self.force_link_dialog = False
585591

586592
def edit_links(self, source_node, sink_node, initial_links=None):
587593
"""

0 commit comments

Comments
 (0)