2 from lib.document import PDF_INFO
3 import lib.utils as utils
4 #from wx.lib.mixins import listctrl as listmix
6 #class InfoList(wx.ListCtrl, listmix.ListCtrlAutoWidthMixin):
7 class InfoList(wx.ListCtrl):
8 def __init__(self, parent):
9 wx.ListCtrl.__init__(self, parent,
15 #| wx.LC_SORT_ASCENDING
21 #listmix.ListCtrlAutoWidthMixin.__init__(self)
22 #self.setResizeColumn("LAST")
24 self.InsertColumn(0, "Property")
25 self.InsertColumn(1, "Value", wx.LIST_FORMAT_LEFT)
26 self.SetColumnWidth(0, 120)
27 self.SetColumnWidth(1, 400)
31 def append(self, data):
32 self.__data.append(data)
33 self.SetItemCount(len(self.__data))
34 self.RefreshItem(len(self.__data)-1)
36 def OnGetItemText(self, item, col):
37 data_row = self.__data[item]
40 def display(self, doc):
43 val = getattr(doc, item)
44 # This will be the fallback value
45 sane_val = repr(val)[1:-1]
46 # Maybe more enconding, which ones?
47 for encoding in ["utf-8", "iso-8859-15",]:
49 sane_val = utils.force_unicode(val, encoding)
51 except utils.GPdf2SwfUnicodeDecodeError:
54 self.append([item, sane_val])