From f739269dfd0358a37e54b21b319b2618e38f248c Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 18 Oct 2016 19:20:47 +0100 Subject: [PATCH] [GTKUI] Autofill infohash entry from clipboard --- deluge/ui/gtkui/addtorrentdialog.py | 6 ++++++ 1 file changed, 6 insertions(+) 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()