diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2008-03-15 10:50:29 +0000 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2008-03-15 10:50:29 +0000 |
| commit | 72089a1844b6b6e820601d00c028b774dc0cbf75 (patch) | |
| tree | 0d4555b1496075d836c44f37d1df0c09c1a26397 /lib/python/Tools | |
| parent | 792d7967cd9a719a8cdd577a5d1c177db46c8630 (diff) | |
| download | enigma2-72089a1844b6b6e820601d00c028b774dc0cbf75.tar.gz enigma2-72089a1844b6b6e820601d00c028b774dc0cbf75.zip | |
optional pixmap caching
Diffstat (limited to 'lib/python/Tools')
| -rw-r--r-- | lib/python/Tools/LoadPixmap.py | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/python/Tools/LoadPixmap.py b/lib/python/Tools/LoadPixmap.py index b7838a39..53e04e54 100644 --- a/lib/python/Tools/LoadPixmap.py +++ b/lib/python/Tools/LoadPixmap.py @@ -1,6 +1,11 @@ from enigma import loadPNG, loadJPG -def LoadPixmap(path, desktop = None): +pixmap_cache = {} + +def LoadPixmap(path, desktop = None, cached = False): + if path in pixmap_cache: + return pixmap_cache[path] + if path[-4:] == ".png": ptr = loadPNG(path) elif path[-4:] == ".jpg": @@ -12,4 +17,8 @@ def LoadPixmap(path, desktop = None): raise "neither .png nor .jpg, please fix file extension" if ptr and desktop: desktop.makeCompatiblePixmap(ptr) + + if cached: + pixmap_cache[path] = ptr + return ptr |
