diff options
author | Marcus Müller <mmueller@gnuradio.org> | 2021-10-19 19:49:14 +0200 |
---|---|---|
committer | Jeff Long <willcode4@gmail.com> | 2021-10-22 18:54:07 -0400 |
commit | 6b6ad1938fa70d4817e2d46b8fd6afd6d2ceeb73 (patch) | |
tree | d21323b7a7b9622e0456f60fc3e27ff80be27d29 | |
parent | GRC: don't rely on GUI to inform about failure to initialize GUI (diff) | |
download | gnuradio-6b6ad1938fa70d4817e2d46b8fd6afd6d2ceeb73.tar.xz gnuradio-6b6ad1938fa70d4817e2d46b8fd6afd6d2ceeb73.zip |
GRC: be tolerant against Gtk.init_check failure, which seems to be flimsy
Signed-off-by: Marcus Müller <mmueller@gnuradio.org>
(cherry picked from commit fe3b52cf1d80cf4c393ce3820172b7df4f31b84b)
Signed-off-by: Jeff Long <willcode4@gmail.com>
-rwxr-xr-x | grc/scripts/gnuradio-companion | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/grc/scripts/gnuradio-companion b/grc/scripts/gnuradio-companion index c8d9d8692..1db1994b8 100755 --- a/grc/scripts/gnuradio-companion +++ b/grc/scripts/gnuradio-companion @@ -18,7 +18,6 @@ import os import sys -import warnings GR_IMPORT_ERROR_MESSAGE = """\ @@ -60,15 +59,20 @@ def die(error, message): def check_gtk(): try: - warnings.filterwarnings("error") import gi gi.require_version('Gtk', '3.0') gi.require_version('PangoCairo', '1.0') gi.require_foreign('cairo', 'Context') from gi.repository import Gtk - Gtk.init_check() - warnings.filterwarnings("always") + success = Gtk.init_check()[0] + if not success: + # Don't display a warning dialogue. This seems to be a Gtk bug. If it + # still can display warning dialogues, it does probably work! + print( + "Gtk init_check failed. GRC might not be able to start a GUI.", + file=sys.stderr) + except Exception as err: die(err, "Failed to initialize GTK. If you are running over ssh, " "did you enable X forwarding and start ssh with -X?") |