Simplify cross-platform clipboard code in gtk add torrent dialog.
This commit is contained in:
parent
5b2be2d190
commit
0c1dd44cd6
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue