From 8ea4872af167af0d246f437b259e4d00f6493912 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 1 Dec 2009 23:59:04 +0000 Subject: [PATCH] Make keybinding errors significantly less fatal. Closes LP #476271 --- terminatorlib/keybindings.py | 3 +-- terminatorlib/prefs_profile.py | 12 +++++++++--- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index 76af7997..97ab6628 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -79,8 +79,7 @@ class TerminatorKeybindings: # Does much the same, but with poorer error handling. #keyval, mask = gtk.accelerator_parse(binding) except KeymapError, ex: - ex.action = action - raise ex + continue else: if mask & gtk.gdk.SHIFT_MASK: if keyval == gtk.keysyms.Tab: diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index bd045e5b..ec6bc911 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -1,7 +1,7 @@ #!/usr/bin/python from terminatorlib.config import dbg,err,DEFAULTS,TerminatorConfValuestoreRC -from terminatorlib.keybindings import TerminatorKeybindings +from terminatorlib.keybindings import TerminatorKeybindings, KeymapError from terminatorlib.version import APP_NAME, APP_VERSION from terminatorlib import translation @@ -363,7 +363,10 @@ class ProfileEditor: keyval = 0 mask = 0 if value is not None and value != "None": - (keyval, mask) = self.tkbobj._parsebinding(value) + try: + (keyval, mask) = self.tkbobj._parsebinding(value) + except KeymapError: + pass if (row[2], row[3]) != (keyval, mask): changed_keybindings.append ((row[0], accel)) dbg("%s changed from %s to %s" % (row[0], self.term.conf.keybindings[row[0]], accel)) @@ -392,7 +395,10 @@ class ProfileEditor: if isinstance (value, tuple): value = value[0] if value is not None and value != "None": - (keyval, mask) = self.tkbobj._parsebinding (value) + try: + (keyval, mask) = self.tkbobj._parsebinding (value) + except KeymapError: + pass self.liststore.append ([binding, self.source_get_keyname (binding), keyval, mask, True]) dbg("Appended row: %s, %s, %s" % (binding, keyval, mask))