Skip to content

Commit adf8261

Browse files
committed
Try to use WebKit2Gtk v4.1 rather than v4.0, if available
Thanks to @jbicha in #92 for bringing this to my attention; I've chosen to implement this with automatic fallback to v4.0, with a warning.
1 parent feac68e commit adf8261

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

gp_saml_gui.py

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
#!/usr/bin/env python3
22

3+
import warnings
34
try:
45
import gi
6+
57
gi.require_version('Gtk', '3.0')
6-
gi.require_version('WebKit2', '4.0')
8+
try:
9+
gi.require_version('WebKit2', '4.1')
10+
except ValueError: # I wish this were ImportError
11+
gi.require_version('WebKit2', '4.0')
12+
warnings.warn("Using WebKit2Gtk 4.0 (obsolete); please upgrade to WebKit2Gtk 4.1")
713
from gi.repository import Gtk, WebKit2, GLib
814
except ImportError:
915
try:
1016
import pgi as gi
1117
gi.require_version('Gtk', '3.0')
1218
gi.require_version('WebKit2', '4.0')
1319
from pgi.repository import Gtk, WebKit2, GLib
20+
warnings.warn("Using PGI and WebKit2Gtk 4.0 (both obsolete); please upgrade to PyGObject and WebKit2Gtk 4.1")
1421
except ImportError:
1522
gi = None
1623
if gi is None:
17-
raise ImportError("Either gi (PyGObject) or pgi module is required.")
24+
raise ImportError("Either gi (PyGObject) or pgi (obsolete) module is required.")
1825

1926
import argparse
2027
import urllib3

0 commit comments

Comments
 (0)