From cac821f58a316a2cffa9c3a141ffe2fa60313e35 Mon Sep 17 00:00:00 2001 From: Thomas Hurst Date: Sun, 24 Aug 2008 07:39:49 +0100 Subject: [PATCH] Add a demo font selection button and a spin button for scrollback --- terminatorlib/prefs_profile.py | 36 +++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index cbd541f4..3387bc4e 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -29,18 +29,32 @@ class ProfileEditor: value = Defaults[key] widget = None - if type == "bool": - 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 + if key == 'font': + #widget = gtk.FontSelection() + #widget.set_preview_text("Terminator: The robot future of terminals") + #widget.set_font_name(value) + widget = gtk.FontButton(value) + elif key == 'scrollback_lines': + # estimated byte size per line according to g-t: + # 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: - print "Unknown type: " + type - continue - + if type == "bool": + 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 (widget, 1, 2, row, row + 1) row += 1