Skip to content

Commit

Permalink
Try to use WebKit2Gtk v4.1 rather than v4.0, if available
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dlenski committed May 3, 2024
1 parent feac68e commit adf8261
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions gp_saml_gui.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
#!/usr/bin/env python3

import warnings
try:
import gi

gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
try:
gi.require_version('WebKit2', '4.1')
except ValueError: # I wish this were ImportError
gi.require_version('WebKit2', '4.0')
warnings.warn("Using WebKit2Gtk 4.0 (obsolete); please upgrade to WebKit2Gtk 4.1")
from gi.repository import Gtk, WebKit2, GLib
except ImportError:
try:
import pgi as gi
gi.require_version('Gtk', '3.0')
gi.require_version('WebKit2', '4.0')
from pgi.repository import Gtk, WebKit2, GLib
warnings.warn("Using PGI and WebKit2Gtk 4.0 (both obsolete); please upgrade to PyGObject and WebKit2Gtk 4.1")
except ImportError:
gi = None
if gi is None:
raise ImportError("Either gi (PyGObject) or pgi module is required.")
raise ImportError("Either gi (PyGObject) or pgi (obsolete) module is required.")

import argparse
import urllib3
Expand Down

0 comments on commit adf8261

Please sign in to comment.