From 2a312159b9374e4a7f4a7cc1a05e08e4e59c0ca8 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Thu, 2 Sep 2021 20:17:09 +0100 Subject: [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 --- deluge/ui/gtk3/common.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/deluge/ui/gtk3/common.py b/deluge/ui/gtk3/common.py index 743417284..e7b46c8d5 100644 --- a/deluge/ui/gtk3/common.py +++ b/deluge/ui/gtk3/common.py @@ -16,7 +16,7 @@ import shutil import sys 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.GLib import GError from gi.repository.Gtk import ( @@ -395,8 +395,8 @@ def listview_replace_treestore(listview): def get_clipboard_text(): text = ( - Clipboard.get(selection=SELECTION_CLIPBOARD).wait_for_text() - or Clipboard.get().wait_for_text() + Clipboard.get(SELECTION_CLIPBOARD).wait_for_text() + or Clipboard.get(SELECTION_PRIMARY).wait_for_text() ) if text: return text.strip() -- cgit