summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCalum Lind <calumlind+deluge@gmail.com>2019-06-12 10:16:32 +0100
committerCalum Lind <calumlind+deluge@gmail.com>2019-06-12 10:21:23 +0100
commit03e7952d269648369f74e8df10bd07f8f3d85e03 (patch)
tree956901fc74f74dc4bc54437ac883a191d6101567
parent7ee8750be4bc5d2c652e6df9455ac56dc45ca28c (diff)
downloaddeluge-03e7952d269648369f74e8df10bd07f8f3d85e03.tar.gz
deluge-03e7952d269648369f74e8df10bd07f8f3d85e03.tar.bz2
deluge-03e7952d269648369f74e8df10bd07f8f3d85e03.zip
[GTK] Only import wnck on X11 display
Wnck is only supported on X11 and raises errors in Wayland so only load it when X11 present. Fixes: #3265
-rw-r--r--CHANGELOG.md1
-rw-r--r--deluge/ui/gtk3/mainwindow.py17
2 files changed, 10 insertions, 8 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e2d6db23f..f216f34d9 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -4,6 +4,7 @@
### Gtk UI
+- Fix errors running on Wayland (#3265).
- Fix Peers Tab tooltip and context menu errors (#3266).
### Web UI
diff --git a/deluge/ui/gtk3/mainwindow.py b/deluge/ui/gtk3/mainwindow.py
index 8896d49a6..92ef91bce 100644
--- a/deluge/ui/gtk3/mainwindow.py
+++ b/deluge/ui/gtk3/mainwindow.py
@@ -13,6 +13,7 @@ import logging
import os.path
from hashlib import sha1 as sha
+import gi
from gi.repository import Gtk
from gi.repository.Gdk import DragAction, WindowState
from twisted.internet import reactor
@@ -28,18 +29,18 @@ from .dialogs import PasswordDialog
from .ipcinterface import process_args
try:
- import gi
-
- gi.require_version('Wnck', '3.0')
- from gi.repository import Wnck
-except ValueError:
- Wnck = None
-
-try:
from gi.repository import GdkX11
except ImportError:
GdkX11 = None
+Wnck = None
+if GdkX11:
+ try:
+ gi.require_version('Wnck', '3.0')
+ from gi.repository import Wnck
+ except (ImportError, ValueError):
+ pass
+
log = logging.getLogger(__name__)