Simplify cross-platform clipboard code in gtk add torrent dialog.

This commit is contained in:
Chase Sterling 2012-11-14 20:58:48 -05:00
parent 5b2be2d190
commit 0c1dd44cd6
1 changed files with 2 additions and 9 deletions

View File

@ -647,15 +647,8 @@ class AddTorrentDialog(component.Component):
dialog.set_transient_for(self.dialog) dialog.set_transient_for(self.dialog)
entry.grab_focus() entry.grab_focus()
if deluge.common.windows_check(): text = (gtk.clipboard_get(selection='PRIMARY').wait_for_text() or
import win32clipboard as clip gtk.clipboard_get().wait_for_text())
import win32con
clip.OpenClipboard()
text = clip.GetClipboardData(win32con.CF_UNICODETEXT)
clip.CloseClipboard()
else:
clip = gtk.clipboard_get(selection='PRIMARY')
text = clip.wait_for_text()
if text: if text:
text = text.strip() text = text.strip()
if deluge.common.is_url(text) or deluge.common.is_magnet(text): if deluge.common.is_url(text) or deluge.common.is_magnet(text):