git.cweiske.de
/
enigma2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
insert cutmark on EIT change
[enigma2.git]
/
lib
/
python
/
Tools
/
LoadPixmap.py
diff --git
a/lib/python/Tools/LoadPixmap.py
b/lib/python/Tools/LoadPixmap.py
index b7838a39c1f4a206e72e9d26024f6cfdedbebf55..53e04e54eca00e410406bb97ea2335c153eef91a 100644
(file)
--- a/
lib/python/Tools/LoadPixmap.py
+++ b/
lib/python/Tools/LoadPixmap.py
@@
-1,6
+1,11
@@
from enigma import loadPNG, loadJPG
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":
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)
raise "neither .png nor .jpg, please fix file extension"
if ptr and desktop:
desktop.makeCompatiblePixmap(ptr)
+
+ if cached:
+ pixmap_cache[path] = ptr
+
return ptr
return ptr