X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FSystemPlugins%2FSkinSelector%2Fplugin.py;h=30cbb6b6bbf7f307dc39db7b68799b7eaa62e987;hp=b0418de0fffb487136ee199f40b4ef317013320d;hb=80a99b08bd6e0932a420e805d928dc5ae5b80f61;hpb=731b74fb5560df6554e586feeec2a5af08058222 diff --git a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py index b0418de..30cbb6b 100755 --- a/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SkinSelector/plugin.py @@ -2,42 +2,34 @@ # (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.Sources.StaticText import StaticText 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 Tools.Directories import resolveFilename, SCOPE_PLUGINS from os import path, walk -from enigma import quitMainloop +from enigma import eEnv class SkinSelector(Screen): # for i18n: # _("Choose your Skin") - skin = """ - - - - - """ - skinlist = [] - root = "/usr/share/enigma2/" + root = eEnv.resolve("${datadir}/enigma2/") def __init__(self, session, args = None): - self.skin = SkinSelector.skin Screen.__init__(self, session) self.skinlist = [] - self.session = session self.previewPath = "" - path.walk(self.root, self.find, "") + self["key_red"] = StaticText(_("Close")) + self["introduction"] = StaticText(_("Press OK to activate the selected skin.")) self.skinlist.sort() self["SkinList"] = MenuList(self.skinlist) self["Preview"] = Pixmap() @@ -46,14 +38,28 @@ class SkinSelector(Screen): { "ok": self.ok, "back": self.close, + "red": self.close, "up": self.up, "down": self.down, "left": self.left, "right": self.right, "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() @@ -72,7 +78,7 @@ class SkinSelector(Screen): self.loadPreview() def info(self): - aboutbox = self.session.open(MessageBox,_("Enigma2 Skinselector v0.5 BETA\n\nIf you experience any problems please contact\nstephan@reichholf.net\n\n\xA9 2006 - Stephan Reichholf"), MessageBox.TYPE_INFO) + aboutbox = self.session.open(MessageBox,_("Enigma2 Skinselector\n\nIf you experience any problems please contact\nstephan@reichholf.net\n\n\xA9 2006 - Stephan Reichholf"), MessageBox.TYPE_INFO) aboutbox.setTitle(_("About...")) def find(self, arg, dirname, names): @@ -104,8 +110,7 @@ class SkinSelector(Screen): pngpath = self.root+self["SkinList"].getCurrent()+"/prev.png" if not path.exists(pngpath): - # FIXME: don't use hardcoded path - pngpath = "/usr/lib/enigma2/python/Plugins/SystemPlugins/SkinSelector/noprev.png" + pngpath = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/SkinSelector/noprev.png") if self.previewPath != pngpath: self.previewPath = pngpath @@ -114,16 +119,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)