Wizard shouldn't be a subclass of HelpableScreen since there is no help
[enigma2.git] / lib / python / Tools / LoadPixmap.py
1 from enigma import loadPNG, loadJPG
2
3 pixmap_cache = {}
4
5 def LoadPixmap(path, desktop = None, cached = False):
6         if path in pixmap_cache:
7                 return pixmap_cache[path]
8
9         if path[-4:] == ".png":
10                 ptr = loadPNG(path)
11         elif path[-4:] == ".jpg":
12                 ptr = loadJPG(path)
13         elif path[-1:] == ".":
14                 alpha = loadPNG(path + "a.png")
15                 ptr = loadJPG(path + "rgb.jpg", alpha)
16         else:
17                 raise "neither .png nor .jpg, please fix file extension"
18         if ptr and desktop:
19                 desktop.makeCompatiblePixmap(ptr)
20
21         if cached:
22                 pixmap_cache[path] = ptr
23
24         return ptr