summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2016-10-18 19:20:47 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2016-10-18 19:20:47 +0100
commitf739269dfd0358a37e54b21b319b2618e38f248c (patch)
tree197aa435c099912c145cf03c5364c4686fed4398
parentf57ee74ee2dd10cc886fb34498a43f606448dde6 (diff)
downloaddeluge-f739269dfd0358a37e54b21b319b2618e38f248c.tar.gz
deluge-f739269dfd0358a37e54b21b319b2618e38f248c.tar.bz2
deluge-f739269dfd0358a37e54b21b319b2618e38f248c.zip
[GTKUI] Autofill infohash entry from clipboard
-rw-r--r--deluge/ui/gtkui/addtorrentdialog.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/deluge/ui/gtkui/addtorrentdialog.py b/deluge/ui/gtkui/addtorrentdialog.py
index e40e1e9b4..becc9dee8 100644
--- a/deluge/ui/gtkui/addtorrentdialog.py
+++ b/deluge/ui/gtkui/addtorrentdialog.py
@@ -738,6 +738,12 @@ class AddTorrentDialog(component.Component):
dialog.set_default_response(gtk.RESPONSE_OK)
dialog.set_transient_for(self.dialog)
entry.grab_focus()
+
+ text = (gtk.clipboard_get(selection='PRIMARY').wait_for_text() or
+ gtk.clipboard_get().wait_for_text()).strip()
+ if len(text) == 40:
+ entry.set_text(text)
+
dialog.show_all()
response = dialog.run()
infohash = entry.get_text().strip()