summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbendikro <bro.devel@gmail.com>2020-04-12 19:24:34 +0200
committerCalum Lind <calumlind+deluge@gmail.com>2020-04-23 17:17:20 +0100
commit3427ae4b9079b4f1ae65e1203913bd8215247617 (patch)
tree5be78edfba1d131bc5d8061e1c593f5dd497677d
parent034db27936c882c9d9e5e5b6881d6ba4b2a3bad0 (diff)
downloaddeluge-3427ae4b9079b4f1ae65e1203913bd8215247617.zip
deluge-3427ae4b9079b4f1ae65e1203913bd8215247617.tar.gz
deluge-3427ae4b9079b4f1ae65e1203913bd8215247617.tar.bz2
[GTK] Remove PyGIWarning in gtk3/files_tab.py
Remove warning: PyGIWarning: Gtk was imported without specifying a version first
-rw-r--r--deluge/tests/test_files_tab.py3
-rw-r--r--deluge/ui/gtk3/files_tab.py7
2 files changed, 9 insertions, 1 deletions
diff --git a/deluge/tests/test_files_tab.py b/deluge/tests/test_files_tab.py
index 23865d7..1ec8e18 100644
--- a/deluge/tests/test_files_tab.py
+++ b/deluge/tests/test_files_tab.py
@@ -24,7 +24,8 @@ try:
from deluge.ui.gtk3.files_tab import FilesTab
from deluge.ui.gtk3.gtkui import DEFAULT_PREFS
from deluge.ui.gtk3.mainwindow import MainWindow
-except ImportError:
+except (ImportError, ValueError):
+ # gi.require_version gives ValueError if library not available
libs_available = False
setup_translation()
diff --git a/deluge/ui/gtk3/files_tab.py b/deluge/ui/gtk3/files_tab.py
index b3bd5b5..6fda2fd 100644
--- a/deluge/ui/gtk3/files_tab.py
+++ b/deluge/ui/gtk3/files_tab.py
@@ -13,15 +13,22 @@ import json
import logging
import os.path
+import gi # isort:skip (Required before Gtk import).
+
+gi.require_version('Gtk', '3.0') # NOQA: E402
+
+# isort:imports-thirdparty
from gi.repository import Gio, Gtk
from gi.repository.Gdk import DragAction, ModifierType, keyval_name
from gi.repository.GObject import TYPE_UINT64
+# isort:imports-firstparty
import deluge.component as component
from deluge.common import open_file, show_file
from deluge.ui.client import client
from deluge.ui.common import FILE_PRIORITY
+# isort:imports-localfolder
from .common import (
listview_replace_treestore,
load_pickled_state_file,