108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# loop through cells
for var in xrange(2, len(desc)):
cell = desc[var]
# cell renderer
if (cell[2] == "pixbuf"):
rend = gtk.CellRendererPixbuf() # img cell
#rend.set_fixed_size(24, 24)
if (cell[1] == str):
cell[3]["stock_id"] = datapos # for stock icons
expand = False
else:
pix_entry = datapos
cell[3]["pixbuf"] = datapos
else:
|
|
|
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
# loop through cells
for var in xrange(2, len(desc)):
cell = desc[var]
# cell renderer
if (cell[2] == "pixbuf"):
rend = gtk.CellRendererPixbuf() # img cell
rend.set_fixed_size(24, 24)
if (cell[1] == str):
cell[3]["stock_id"] = datapos # for stock icons
expand = False
else:
pix_entry = datapos
cell[3]["pixbuf"] = datapos
else:
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
|
def tree(widget, entries, title="category", icon=gtk.STOCK_DIRECTORY):
# list types
ls = gtk.TreeStore(str, str)
#log.DATA(".tree", entries)
# add entries
for entry in entries:
if isinstance(entry, (str,unicode)):
main = ls.append(None, [str(entry), icon])
else:
for sub_title in entry:
ls.append(main, [str(sub_title), icon])
|
>
|
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
|
def tree(widget, entries, title="category", icon=gtk.STOCK_DIRECTORY):
# list types
ls = gtk.TreeStore(str, str)
#log.DATA(".tree", entries)
# add entries
main = None
for entry in entries:
if isinstance(entry, (str,unicode)):
main = ls.append(None, [str(entry), icon])
else:
for sub_title in entry:
ls.append(main, [str(sub_title), icon])
|
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
|
return len(uikit.idle_tasks) > 0
# adds background color to widget,
# eventually wraps it into a gtk.Window, if it needs a container
@staticmethod
def bg(w, color="", where=["bg"]):
""" this method should be called after widget creation, and before .add()ing it to container """
if color:
# wrap unstylable widgets into EventBox
if not isinstance(w, gtk.Window):
wrap = gtk.EventBox()
wrap.add(w)
##########wrap.set_property("visible", True)
w = wrap
# copy style object, modify settings
s = w.get_style().copy()
c = w.get_colormap().alloc_color(color)
for state in (gtk.STATE_NORMAL, gtk.STATE_SELECTED):
s.bg[state] = c
w.set_style(s)
# probably redundant, but better safe than sorry:
w.modify_bg(gtk.STATE_NORMAL, c)
# return modified or wrapped widget
return w
|
|
|
|
|
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
|
return len(uikit.idle_tasks) > 0
# adds background color to widget,
# eventually wraps it into a gtk.Window, if it needs a container
@staticmethod
def bg(w, color="", where=["bg"], wrap=1):
""" this method should be called after widget creation, and before .add()ing it to container """
if color:
# wrap unstylable widgets into EventBox
if wrap and not isinstance(w, (gtk.Window, gtk.EventBox)):
wrap = gtk.EventBox()
wrap.add(w)
##########wrap.set_property("visible", True)
w = wrap
# copy style object, modify settings
s = w.get_style().copy()
c = w.get_colormap().alloc_color(color)
for state in (gtk.STATE_NORMAL, gtk.STATE_SELECTED, gtk.STATE_ACTIVE):
s.bg[state] = c
w.set_style(s)
# probably redundant, but better safe than sorry:
w.modify_bg(gtk.STATE_NORMAL, c)
# return modified or wrapped widget
return w
|