From dcd997b3de9421026126877c5731e0ddb975e668 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 22 Jul 2009 09:40:35 +0100 Subject: [PATCH] Allow a keybinding to be set to a string value of None so it can be deconfigured. Also supports clearing a keybinding through the prefs profile. Closes LP #391778 --- terminatorlib/keybindings.py | 2 +- terminatorlib/prefs_profile.py | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/terminatorlib/keybindings.py b/terminatorlib/keybindings.py index 15b85545..76af7997 100644 --- a/terminatorlib/keybindings.py +++ b/terminatorlib/keybindings.py @@ -71,7 +71,7 @@ class TerminatorKeybindings: bindings = (bindings,) for binding in bindings: - if binding is None: + if binding is None or binding == "None": continue try: diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index 60dd73d5..5eeab77b 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -391,7 +391,7 @@ class ProfileEditor: mask = 0 if isinstance (value, tuple): value = value[0] - if value is not None: + if value is not None and value != "None": (keyval, mask) = self.tkbobj._parsebinding (value) self.liststore.append ([binding, self.source_get_keyname (binding), keyval, mask, True]) dbg("Appended row: %s, %s, %s" % (binding, keyval, mask)) @@ -418,6 +418,7 @@ class ProfileEditor: col.set_attributes(cell, accel_key=2, accel_mods=3, editable=4) cell.connect ('accel-edited', self.edited) + cell.connect ('accel-cleared', self.cleared) self.treeview.append_column(col) @@ -429,3 +430,7 @@ class ProfileEditor: def edited (self, obj, path, key, mods, code): iter = self.liststore.get_iter_from_string(path) self.liststore.set(iter, 2, key, 3, mods) + + def cleared (self, obj, path): + iter = self.liststore.get_iter_from_string(path) + self.liststore.set(iter, 2, 0, 3, 0)