use LoadPixmap with cached instead of global loadPNG (to optimize enigma2 startup...
authorghost <andreas.monzner@multimedia-labs.de>
Sun, 15 Feb 2009 13:42:44 +0000 (14:42 +0100)
committerghost <andreas.monzner@multimedia-labs.de>
Sun, 15 Feb 2009 13:42:44 +0000 (14:42 +0100)
lib/python/Screens/VirtualKeyBoard.py

index 53970ab..5dc1a09 100755 (executable)
@@ -5,19 +5,10 @@ from Components.Label import Label
 from Components.Pixmap import Pixmap\r
 from Components.MenuList import MenuList\r
 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest\r
 from Components.Pixmap import Pixmap\r
 from Components.MenuList import MenuList\r
 from Components.MultiContent import MultiContentEntryText, MultiContentEntryPixmapAlphaTest\r
-from enigma import eListboxPythonMultiContent, gFont, loadPNG, RT_HALIGN_CENTER, RT_VALIGN_CENTER\r
+from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_CENTER, RT_VALIGN_CENTER\r
 from Screen import Screen\r
 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE\r
 from Screen import Screen\r
 from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE\r
-\r
-key_backspace = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png"))\r
-key_bg = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png"))\r
-key_clr = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png"))\r
-key_esc = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png"))\r
-key_ok = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png"))\r
-key_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png"))\r
-key_shift = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png"))\r
-key_shift_sel = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png"))\r
-key_space = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png"))\r
+from Tools.LoadPixmap import LoadPixmap\r
 \r
 class VirtualKeyBoardList(MenuList):\r
        def __init__(self, list, enableWrapAround=False):\r
 \r
 class VirtualKeyBoardList(MenuList):\r
        def __init__(self, list, enableWrapAround=False):\r
@@ -26,6 +17,16 @@ class VirtualKeyBoardList(MenuList):
                self.l.setItemHeight(45)\r
 \r
 def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):\r
                self.l.setItemHeight(45)\r
 \r
 def VirtualKeyBoardEntryComponent(keys, selectedKey,shiftMode=False):\r
+       key_backspace = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_backspace.png"))\r
+       key_bg = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_bg.png"))\r
+       key_clr = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_clr.png"))\r
+       key_esc = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_esc.png"))\r
+       key_ok = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_ok.png"))\r
+       key_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_sel.png"))\r
+       key_shift = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift.png"))\r
+       key_shift_sel = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_shift_sel.png"))\r
+       key_space = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/vkey_space.png"))\r
+       \r
        res = [ (keys) ]\r
        \r
        x = 0\r
        res = [ (keys) ]\r
        \r
        x = 0\r
@@ -116,6 +117,7 @@ class VirtualKeyBoard(Screen):
                                [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],\r
                                [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],\r
                                [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
                                [u"Q", u"W", u"E", u"R", u"T", u"Z", u"U", u"I", u"O", u"P", u"É", u"*"],\r
                                [u"A", u"S", u"D", u"F", u"G", u"H", u"J", u"K", u"L", u"Ö", u"Ä", u"'"],\r
                                [u">", u"Y", u"X", u"C", u"V", u"B", u"N", u"M", u";", u":", u"_", u"CLEAR"],\r
+\r
                                [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]\r
                else:\r
                        self.keys_list = [\r
                                [u"SHIFT", u"SPACE", u"?", u"\\", u"Å", u"OK"]]\r
                else:\r
                        self.keys_list = [\r