mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-04 15:38:43 +00:00
[GTKUI] Fix unhandled error with empty clipboard
If the primary clipboard was empty the fallback resulted in an unhandled error due to missing arguments. Fixed by using SELECTION_PRIMARY as fallback clipboard
This commit is contained in:
parent
cb75192df4
commit
2a312159b9
1 changed files with 3 additions and 3 deletions
|
@ -16,7 +16,7 @@ import shutil
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
import six.moves.cPickle as pickle # noqa: N813
|
import six.moves.cPickle as pickle # noqa: N813
|
||||||
from gi.repository.Gdk import SELECTION_CLIPBOARD, Display
|
from gi.repository.Gdk import SELECTION_CLIPBOARD, SELECTION_PRIMARY, Display
|
||||||
from gi.repository.GdkPixbuf import Colorspace, Pixbuf
|
from gi.repository.GdkPixbuf import Colorspace, Pixbuf
|
||||||
from gi.repository.GLib import GError
|
from gi.repository.GLib import GError
|
||||||
from gi.repository.Gtk import (
|
from gi.repository.Gtk import (
|
||||||
|
@ -395,8 +395,8 @@ def listview_replace_treestore(listview):
|
||||||
|
|
||||||
def get_clipboard_text():
|
def get_clipboard_text():
|
||||||
text = (
|
text = (
|
||||||
Clipboard.get(selection=SELECTION_CLIPBOARD).wait_for_text()
|
Clipboard.get(SELECTION_CLIPBOARD).wait_for_text()
|
||||||
or Clipboard.get().wait_for_text()
|
or Clipboard.get(SELECTION_PRIMARY).wait_for_text()
|
||||||
)
|
)
|
||||||
if text:
|
if text:
|
||||||
return text.strip()
|
return text.strip()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue