From e2443297258a2c18d65bbcad70bdb4c0396c0180 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Tue, 28 Oct 2008 22:24:42 +0000 Subject: [PATCH] Make gio optional; it's way too soon to expect everyone to have this. Fix keybindings error handling. --- terminatorlib/config.py | 15 +++++++++++---- terminatorlib/keybindings.py | 1 + 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 4ab74b9b..14eb4e22 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -34,7 +34,11 @@ up, set a default for it first.""" import os, platform, sys, re import pwd import gtk, pango -import gio + +try: + import gio +except ImportError: + pass # set this to true to enable debugging output # These should be moved somewhere better. @@ -209,9 +213,12 @@ class TerminatorConfValuestoreRC (TerminatorConfValuestore): dbg(" VS_RCFile: config file located at %s" % self.rcfilename) self.call_parser(True) - monfile = gio.File(self.rcfilename) - monmon = monfile.monitor_file() - monmon.connect("changed", self.file_changed) + try: + monfile = gio.File(self.rcfilename) + monmon = monfile.monitor_file() + monmon.connect("changed", self.file_changed) + except NameError: + dbg ("gio module not found, config file monitoring disabled") def set_reconfigure_callback (self, function): dbg (" VS_RCFile: setting callback to: %s"%function) diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index af915a26..e7dc7b35 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -1,6 +1,7 @@ import re, gtk import terminatorlib.config +from terminatorlib.config import err class KeymapError(Exception): def __init__(self, value):