Skip to content

Commit

Permalink
FIX: Fix the clipboard copy. It was failing under MacOS and Windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
Hugo Slepicka committed Aug 14, 2018
1 parent 1a9d2f3 commit 012e764
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pydm/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,9 +562,14 @@ def show_address_tooltip(self, obj, event):
# If the address has a protocol, and it is the default protocol, strip it out before putting it on the clipboard.
m = re.match('(.+?):/{2,3}(.+?)$', addr)
if m is not None and DEFAULT_PROTOCOL is not None and m.group(1) == DEFAULT_PROTOCOL:
QApplication.clipboard().setText(m.group(2), mode=QClipboard.Selection)
copy_text = m.group(2)
else:
QApplication.clipboard().setText(addr, mode=QClipboard.Selection)
copy_text = addr

clipboard = QApplication.clipboard()
clipboard.setText(copy_text)
event = QEvent(QEvent.Clipboard)
self.sendEvent(clipboard, event)

def establish_widget_connections(self, widget):
"""
Expand Down

0 comments on commit 012e764

Please sign in to comment.