readding thomas changes

This commit is contained in:
Emmanuel Bretelle 2008-08-25 20:56:08 +01:00
commit 47bc7bc378
3 changed files with 53 additions and 35 deletions

View File

@ -105,8 +105,8 @@ Defaults = {
'zoom_normal' : '<Ctrl>0', 'zoom_normal' : '<Ctrl>0',
'new_root_tab' : '<Ctrl><Shift><Alt>T', 'new_root_tab' : '<Ctrl><Shift><Alt>T',
'new_tab' : '<Ctrl><Shift>T', 'new_tab' : '<Ctrl><Shift>T',
'go_next' : '<Ctrl><Shift>N', 'go_next' : ('<Ctrl><Shift>N','<Ctrl>Tab'),
'go_prev' : '<Ctrl><Shift>P', 'go_prev' : ('<Ctrl><Shift>P','<Ctrl><Shift>Tab'),
'split_horiz' : '<Ctrl><Shift>O', 'split_horiz' : '<Ctrl><Shift>O',
'split_vert' : '<Ctrl><Shift>E', 'split_vert' : '<Ctrl><Shift>E',
'close_term' : '<Ctrl><Shift>W', 'close_term' : '<Ctrl><Shift>W',

View File

@ -32,29 +32,33 @@ class TerminatorKeybindings:
def reload(self): def reload(self):
self._lookup = {} self._lookup = {}
self._masks = 0 self._masks = 0
for action, binding in self.keys.items(): for action, bindings in self.keys.items():
try: if not isinstance(bindings, tuple):
keyval, mask = self._parsebinding(binding) bindings = (bindings,)
#keyval, mask = gtk.accelerator_parse(binding)
#mask = int(mask) for binding in bindings:
except KeymapError, e: try:
e.action = action keyval, mask = self._parsebinding(binding)
raise e # Does much the same, but with poorer error handling.
else: #keyval, mask = gtk.accelerator_parse(binding)
if mask & gtk.gdk.SHIFT_MASK: except KeymapError, e:
if keyval == gtk.keysyms.Tab: e.action = action
keyval = gtk.keysyms.ISO_Left_Tab raise e
mask &= ~gtk.gdk.SHIFT_MASK
else:
keyvals = gtk.gdk.keyval_convert_case(keyval)
if keyvals[0] != keyvals[1]:
keyval = keyvals[1]
mask &= ~gtk.gdk.SHIFT_MASK
else: else:
keyval = gtk.gdk.keyval_to_lower(keyval) if mask & gtk.gdk.SHIFT_MASK:
self._lookup.setdefault(mask, {}) if keyval == gtk.keysyms.Tab:
self._lookup[mask][keyval] = action keyval = gtk.keysyms.ISO_Left_Tab
self._masks |= mask mask &= ~gtk.gdk.SHIFT_MASK
else:
keyvals = gtk.gdk.keyval_convert_case(keyval)
if keyvals[0] != keyvals[1]:
keyval = keyvals[1]
mask &= ~gtk.gdk.SHIFT_MASK
else:
keyval = gtk.gdk.keyval_to_lower(keyval)
self._lookup.setdefault(mask, {})
self._lookup[mask][keyval] = action
self._masks |= mask
def _parsebinding(self, binding): def _parsebinding(self, binding):
mask = 0 mask = 0

View File

@ -29,18 +29,32 @@ class ProfileEditor:
value = Defaults[key] value = Defaults[key]
widget = None widget = None
if type == "bool": if key == 'font':
widget = gtk.CheckButton () #widget = gtk.FontSelection()
widget.set_active (value) #widget.set_preview_text("Terminator: The robot future of terminals")
elif type in ["str", "int", "float"]: #widget.set_font_name(value)
widget = gtk.Entry () widget = gtk.FontButton(value)
widget.set_text (str(value)) elif key == 'scrollback_lines':
elif type == "list": # estimated byte size per line according to g-t:
continue # sizeof(void *) + sizeof(char *) + sizeof(int) + (80 * (sizeof(int32) + 4)
widget = gtk.SpinButton()
widget.set_digits(0)
widget.set_increments(100, 1000)
widget.set_range(0, 100000)
widget.set_value(value)
else: else:
print "Unknown type: " + type if type == "bool":
continue widget = gtk.CheckButton ()
widget.set_active (value)
elif type in ["str", "int", "float"]:
widget = gtk.Entry ()
widget.set_text (str(value))
elif type == "list":
continue
else:
print "Unknown type: " + type
continue
table.attach (label, 0, 1, row, row + 1) table.attach (label, 0, 1, row, row + 1)
table.attach (widget, 1, 2, row, row + 1) table.attach (widget, 1, 2, row, row + 1)
row += 1 row += 1