82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 | #
# An according entries list then would contain a dictionary for each row:
# entries = [ {"titlerow":"first", "interndat":123}, {"titlerow":"..."}, ]
# Keys not mentioned in the datamap get ignored, and defaults are applied
# for missing cols. All values must already be in the correct type however.
#
@staticmethod
def columns(widget, datamap=[], entries=None, pix_entry=False):
# create treeviewcolumns?
if (not widget.get_column(0)):
# loop through titles
datapos = 0
for n_col,desc in enumerate(datamap):
|
|
| 82
83
84
85
86
87
88
89
90
91
92
93
94
95
96 | #
# An according entries list then would contain a dictionary for each row:
# entries = [ {"titlerow":"first", "interndat":123}, {"titlerow":"..."}, ]
# Keys not mentioned in the datamap get ignored, and defaults are applied
# for missing cols. All values must already be in the correct type however.
#
@staticmethod
def columns(widget, datamap=[], entries=None, show_favicons=True, pix_entry=False):
# create treeviewcolumns?
if (not widget.get_column(0)):
# loop through titles
datapos = 0
for n_col,desc in enumerate(datamap):
|
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 | # map Python2 unicode to str
row = [ str(value) if type(value) is unicode else value for value in row ]
# autotransform string -> gtk image object
if (pix_entry and type(row[pix_entry]) == str):
pix = None
try:
if os.path.exists(row[pix_entry]):
pix = gtk.gdk.pixbuf_new_from_file(row[pix_entry])
except Exception as e:
log.ERR("uikik.columns: Pixbuf fail,", e)
row[pix_entry] = pix or defaults[gtk.gdk.Pixbuf]
try:
# add |
|
| 182
183
184
185
186
187
188
189
190
191
192
193
194
195
196 | # map Python2 unicode to str
row = [ str(value) if type(value) is unicode else value for value in row ]
# autotransform string -> gtk image object
if (pix_entry and type(row[pix_entry]) == str):
pix = None
try:
if show_favicons and os.path.exists(row[pix_entry]):
pix = gtk.gdk.pixbuf_new_from_file(row[pix_entry])
except Exception as e:
log.ERR("uikik.columns: Pixbuf fail,", e)
row[pix_entry] = pix or defaults[gtk.gdk.Pixbuf]
try:
# add |