2 from Screens.Screen import Screen
3 from Components.ConfigList import ConfigListScreen
6 from Screens.Setup import SetupSummary
9 from Components.ActionMap import ActionMap
10 from Components.SelectionList import SelectionList, SelectionEntryComponent
11 from Components.Sources.StaticText import StaticText
14 from Components.config import config
16 from Components.PluginComponent import plugins
17 from Plugins.Plugin import PluginDescriptor
21 class PluginHiderSetup(Screen):
22 skin = """<screen name="PluginHiderSetup" title="PluginHider Setup" position="center,center" size="565,290">
23 <ePixmap position="0,0" size="140,40" pixmap="skin_default/buttons/red.png" transparent="1" alphatest="on" />
24 <ePixmap position="140,0" size="140,40" pixmap="skin_default/buttons/green.png" transparent="1" alphatest="on" />
25 <ePixmap position="280,0" size="140,40" pixmap="skin_default/buttons/yellow.png" transparent="1" alphatest="on" />
26 <ePixmap position="420,0" size="140,40" pixmap="skin_default/buttons/blue.png" transparent="1" alphatest="on" />
27 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
28 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
29 <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
30 <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" valign="center" halign="center" font="Regular;21" transparent="1" foregroundColor="white" shadowColor="black" shadowOffset="-1,-1" />
31 <widget name="list" position="5,45" size="555,240" scrollbarMode="showOnDemand" />
34 def __init__(self, session):
35 Screen.__init__(self, session)
38 self["key_green"] = StaticText(_("OK"))
39 self["key_red"] = StaticText(_("Cancel"))
40 self["key_yellow"] = StaticText(_("Plugins"))
41 self["key_blue"] = StaticText(_("Extensions"))
43 self["list"] = SelectionList([])
44 self.selectedList = LIST_PLUGINS
47 self["ColorActions"] = ActionMap(["OkCancelActions", "ColorActions"],
49 "ok": self["list"].toggleSelection,
52 "yellow": self.plugins,
53 "blue": self.extensions,
57 self.onLayoutFinish.append(self.setCustomTitle)
60 config.plugins.pluginhider.hideplugins.cancel()
61 config.plugins.pluginhider.hideextensions.cancel()
62 config.plugins.pluginhider.cancel()
67 config.plugins.pluginhider.hideplugins.save()
68 config.plugins.pluginhider.hideextensions.save()
69 config.plugins.pluginhider.save()
74 self.selectedList = LIST_PLUGINS
79 self.selectedList = LIST_EXTENSIONS
82 def setCustomTitle(self):
83 self.setTitle(_("PluginHider Setup"))
86 if hasattr(plugins, 'pluginHider_baseGetPlugins'):
87 fnc = plugins.pluginHider_baseGetPlugins
89 fnc = plugins.getPlugins
91 if self.selectedList == LIST_PLUGINS:
92 list = fnc([PluginDescriptor.WHERE_PLUGINMENU])
93 selected = config.plugins.pluginhider.hideplugins.value
95 list = fnc([PluginDescriptor.WHERE_EXTENSIONSMENU])
96 selected = config.plugins.pluginhider.hideextensions.value
101 if plugin.description:
102 name = "%s (%s)" % (plugin.name, plugin.description)
106 res.append(SelectionEntryComponent(
110 plugin.name in selected,
113 self["list"].setList(res)
115 self["list"].moveToIndex(0)
117 def keepCurrent(self):
118 selected = self["list"].getSelectionsList()
119 if self.selectedList == LIST_PLUGINS:
120 config.plugins.pluginhider.hideplugins.value = [x[1] for x in selected]
122 config.plugins.pluginhider.hideextensions.value = [x[1] for x in selected]