DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Show All Icons In Avkon.mbm

02.14.2006
| 6482 views |
  • submit to reddit
        There are 2 type of mbm files. The following code work with
ROM-type (most mbm on Z:\) only.
>>> from appuifw import *
>>> avkon = u'z:\\system\\data\\avkon.mbm'
>>> def showicon(id_list, maskfunc=lambda x:x):
...     if type(id_list) == int:
...         id_list = [id_list] # one item
...     entries = []
...     if type(maskfunc) == dict:  # allow dict as a func
...         func = lambda id: maskfunc.get(id,id)
...     else:
...         func = maskfunc
...     for id in id_list:
...         item = u'%s, %s' % (id, func(id))
...         icon = Icon(avkon, id, func(id))
...         entries.append((item, u'', icon))
...     app.body = Listbox(entries, lambda: None)
...
>>> showicon(range(503))  # all icons, including mask
>>> showicon(range(0,100,2), lambda x:x+1)  # first 50 icons, with their mask brother