Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ENH] Canvas: Always show the link dialog if the user holds Shift #1673

Merged
merged 1 commit into from
Oct 21, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion Orange/canvas/document/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,7 @@ def __init__(self, document, *args, **kwargs):
self.sink_item = None
self.from_item = None
self.direction = None
self.force_link_dialog = False

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

def mouseReleaseEvent(self, event):
if self.tmp_link_item:
self.force_link_dialog = bool(event.modifiers() & Qt.ShiftModifier)
item = self.target_node_item_at(event.scenePos())
node = None
stack = self.document.undoStack()
Expand Down Expand Up @@ -501,7 +505,7 @@ def connect_nodes(self, source_node, sink_node):
# to SchemeLinks later
links_to_add = [(source, sink)]
links_to_remove = []
show_link_dialog = False
show_link_dialog = self.force_link_dialog

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

def edit_links(self, source_node, sink_node, initial_links=None):
"""
Expand Down