fontView: Set column titles and disable sorting
Also handle some KeyError exceptions
diff --git a/Lib/fontTools/fontView.py b/Lib/fontTools/fontView.py
index 9faf0b4..71a9448 100644
--- a/Lib/fontTools/fontView.py
+++ b/Lib/fontTools/fontView.py
@@ -92,7 +92,7 @@
# Make sure item is decompiled
try:
value["asdf"]
- except AttributeError:
+ except (AttributeError, KeyError):
pass
if isinstance(value, fontTools.ttLib.getTableModule('glyf').Glyph):
# Glyph type needs explicit expanding to be useful
@@ -255,18 +255,15 @@
#self.treeview.set_reorderable(True)
for i in range(2):
-
- col = gtk.TreeViewColumn('Column %d' % i)
-
+ col_name = ('Key', 'Value')[i]
+ col = gtk.TreeViewColumn(col_name)
+ col.set_sort_column_id(-1)
self.treeview.append_column(col)
cell = gtk.CellRendererText()
col.pack_start(cell, True)
-
col.add_attribute(cell, 'text', i)
- col.set_sort_column_id(i)
-
self.treeview.set_search_column(1)
self.scrolled_window.add(self.treeview)
self.window.show_all()