131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
col.pack_end(rend, expand=cell[3].get("expand",True))
# apply attributes
for attr,val in list(cell[3].items()):
col.add_attribute(rend, attr, val)
# next
datapos += 1
__print__(cell)
# add column to treeview
widget.append_column(col)
# finalize widget
widget.set_search_column(5) #??
widget.set_search_column(4) #??
widget.set_search_column(3) #??
widget.set_search_column(2) #??
|
|
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
|
col.pack_end(rend, expand=cell[3].get("expand",True))
# apply attributes
for attr,val in list(cell[3].items()):
col.add_attribute(rend, attr, val)
# next
datapos += 1
__print__(dbg.INFO, cell)
# add column to treeview
widget.append_column(col)
# finalize widget
widget.set_search_column(5) #??
widget.set_search_column(4) #??
widget.set_search_column(3) #??
widget.set_search_column(2) #??
|
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
|
if (not rowmap):
for desc in datamap:
for var in xrange(2, len(desc)):
vartypes.append(desc[var][1]) # content types
rowmap.append(desc[var][0]) # dict{} column keys in entries[] list
# create gtk array storage
ls = gtk.ListStore(*vartypes) # could be a TreeStore, too
__print__(vartypes)
__print__(rowmap)
# prepare for missing values, and special variable types
defaults = {
str: "",
unicode: "",
bool: False,
int: 0,
gtk.gdk.Pixbuf: empty_pixbuf
}
if gtk.gdk.Pixbuf in vartypes:
pix_entry = vartypes.index(gtk.gdk.Pixbuf)
# sort data into gtk liststore array
for row in entries:
# row["search_col"] = "white"
# generate ordered list from dictionary, using rowmap association
row = [ row.get( skey , defaults[vartypes[i]] ) for i,skey in enumerate(rowmap) ]
# autotransform string -> gtk image object
if (pix_entry and type(row[pix_entry]) == str):
row[pix_entry] = ( gtk.gdk.pixbuf_new_from_file(row[pix_entry]) if os.path.exists(row[pix_entry]) else defaults[gtk.gdk.Pixbuf] )
|
|
|
>
>
>
|
>
|
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
|
if (not rowmap):
for desc in datamap:
for var in xrange(2, len(desc)):
vartypes.append(desc[var][1]) # content types
rowmap.append(desc[var][0]) # dict{} column keys in entries[] list
# create gtk array storage
ls = gtk.ListStore(*vartypes) # could be a TreeStore, too
__print__(dbg.UI, vartypes)
__print__(dbg.DATA, rowmap)
# prepare for missing values, and special variable types
defaults = {
str: "",
unicode: "",
bool: False,
int: 0,
gtk.gdk.Pixbuf: empty_pixbuf
}
if gtk.gdk.Pixbuf in vartypes:
pix_entry = vartypes.index(gtk.gdk.Pixbuf)
# sort data into gtk liststore array
for row in entries:
# defaults
row["deleted"] = 0
row["search_col"] = "#ffffff"
row["search_set"] = 0
# generate ordered list from dictionary, using rowmap association
row = [ row.get( skey , defaults[vartypes[i]] ) for i,skey in enumerate(rowmap) ]
# autotransform string -> gtk image object
if (pix_entry and type(row[pix_entry]) == str):
row[pix_entry] = ( gtk.gdk.pixbuf_new_from_file(row[pix_entry]) if os.path.exists(row[pix_entry]) else defaults[gtk.gdk.Pixbuf] )
|