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

This commit is contained in:
Chris Jones 2009-07-22 09:40:35 +01:00
parent 34c9c816ea
commit dcd997b3de
2 changed files with 7 additions and 2 deletions

View File

@ -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:

View File

@ -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)