Skip to content

Commit

Permalink
only import the GdkX11 if it is part of the glib module repository
Browse files Browse the repository at this point in the history
  • Loading branch information
mattrose committed Apr 17, 2020
1 parent 51fc72d commit 769aaf1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
8 changes: 7 additions & 1 deletion terminatorlib/terminator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import gi
gi.require_version('Vte', '2.91')
from gi.repository import Gtk, Gdk, Vte, GdkX11
from gi.repository import Gtk, Gdk, Vte
from gi.repository.GLib import GError

from . import borg
Expand All @@ -18,6 +18,12 @@
from .cwd import get_pid_cwd
from .version import APP_NAME, APP_VERSION

try:
from gi.repository import GdkX11
except ImportError:
dbg("could not import X11 gir module")


def eventkey2gdkevent(eventkey): # FIXME FOR GTK3: is there a simpler way of casting from specific EventKey to generic (union) GdkEvent?
gdkevent = Gdk.Event.new(eventkey.type)
gdkevent.key.window = eventkey.window
Expand Down
10 changes: 8 additions & 2 deletions terminatorlib/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,22 @@
import uuid
import gi
from gi.repository import GObject
from gi.repository import Gtk, Gdk, GdkX11
from gi.repository import Gtk, Gdk

from .util import dbg, err, make_uuid, display_manager

try:
from gi.repository import GdkX11
except ImportError:
dbg("could not import X11 gir module")


from . import util
from .translation import _
from .version import APP_NAME
from .container import Container
from .factory import Factory
from .terminator import Terminator

if display_manager() == 'X11':
try:
gi.require_version('Keybinder', '3.0')
Expand Down

0 comments on commit 769aaf1

Please sign in to comment.