Don't install *.jpg files with the Plugin metadata to save space.
[enigma2.git] / lib / python / Plugins / SystemPlugins / SkinSelector / plugin.py
index 18ffd9943fb9c2a898df63e7a6e190e12e6bb033..060a4f35e03f68b2ccd51344959812883df98dde 100755 (executable)
@@ -2,14 +2,13 @@
 # (c) 2006 Stephan Reichholf
 # This Software is Free, use it where you want, when you want for whatever you want and modify it if you want but don't remove my copyright!
 from Screens.Screen import Screen
+from Screens.Standby import TryQuitMainloop
 from Screens.MessageBox import MessageBox
 from Components.ActionMap import NumberActionMap
 from Components.Pixmap import Pixmap
 from Components.MenuList import MenuList
 from Plugins.Plugin import PluginDescriptor
 from Components.config import config
-from Tools.Directories import SCOPE_SKIN
-from Components.config import config
 
 from os import path, walk
 
@@ -32,7 +31,6 @@ class SkinSelector(Screen):
                Screen.__init__(self, session)
 
                self.skinlist = []
-               self.session = session
                self.previewPath = ""
 
                path.walk(self.root, self.find, "")
@@ -52,7 +50,20 @@ class SkinSelector(Screen):
                        "info": self.info,
                }, -1)
                
-               self.onLayoutFinish.append(self.loadPreview)
+               self.onLayoutFinish.append(self.layoutFinished)
+
+       def layoutFinished(self):
+               tmp = config.skin.primary_skin.value.find('/skin.xml')
+               if tmp != -1:
+                       tmp = config.skin.primary_skin.value[:tmp]
+                       idx = 0
+                       for skin in self.skinlist:
+                               if skin == tmp:
+                                       break
+                               idx += 1
+                       if idx < len(self.skinlist):
+                               self["SkinList"].moveToIndex(idx)
+               self.loadPreview()
 
        def up(self):
                self["SkinList"].up()
@@ -113,16 +124,16 @@ class SkinSelector(Screen):
 
        def restartGUI(self, answer):
                if answer is True:
-                       quitMainloop(3)
+                       self.session.open(TryQuitMainloop, 3)
 
 def SkinSelMain(session, **kwargs):
        session.open(SkinSelector)
 
-def SkinSelSetup(menuid):
+def SkinSelSetup(menuid, **kwargs):
        if menuid == "system":
-               return [("Skin...", SkinSelMain)]
+               return [(_("Skin..."), SkinSelMain, "skin_selector", None)]
        else:
                return []
 
 def Plugins(**kwargs):
-       return PluginDescriptor(name="Skinselector", description="Select Your Skin", where = PluginDescriptor.WHERE_SETUP, fnc=SkinSelSetup)
+       return PluginDescriptor(name="Skinselector", description="Select Your Skin", where = PluginDescriptor.WHERE_MENU, fnc=SkinSelSetup)