1 from Plugins.Plugin import PluginDescriptor
2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4 from Components.ConfigList import ConfigListScreen
5 from Components.ActionMap import ActionMap
6 from Components.Label import Label
7 from Components.config import *
10 CONFIGS = [("1", _("layer 1")),
16 config.plugins.MultiRC = ConfigSubsection()
17 config.plugins.MultiRC.mask = ConfigSelection(choices = CONFIGS, default = "f")
19 # config file for IR mask, default is DM7025 or later, fallback to DM500/600
20 MASK = "/proc/stb/ir/rc/mask0"
21 if not path.exists(MASK):
22 MASK = "/proc/stb/ir/rc/mask"
24 class MultiRCSetup(ConfigListScreen, Screen):
26 <screen position="170,150" size="420,280" title="Multi RemoteControl" >
27 <widget name="config" position="10,10" size="400,40" scrollbarMode="showOnDemand" />
28 <widget name="warning" position="10,50" size="400,220" font="Regular;20" halign="center"/>
31 # most of the following is black magic copied from other plugins.
32 # e2 devs should really make some best practices or wrapper for this!
33 def __init__(self, session, args = None):
34 Screen.__init__(self, session)
35 self.list = [getConfigListEntry(_("Listen on Remote Control"), config.plugins.MultiRC.mask)]
36 ConfigListScreen.__init__(self, self.list)
37 self["warning"] = Label(_("""WARNING!
38 After changing this and pressing <Ok>, your Remote Control might stop working!
40 Information about re-configuring the RC is available at http://www.dream-multimedia-tv.de/board/thread.php?threadid=5613"""))
41 self["config"].list = self.list
42 self["config"].setList(self.list)
43 self["setupActions"] = ActionMap(["SetupActions"],
45 "save": self.ask_save,
46 "cancel": self.cancel,
52 self.session.open(MessageBox, text = _("Error writing to %s!") % MASK,
53 type = MessageBox.TYPE_WARNING)
55 # mask value 0xf allows all RCs, no need to verify
56 if config.plugins.MultiRC.mask.value == "f":
57 self.confirm_save(True)
59 self.session.openWithCallback(self.confirm_save, MessageBox,
60 _("Is the RC still working?"), MessageBox.TYPE_YESNO,
61 timeout = 20, default = False)
63 def confirm_save(self, confirmed):
65 for x in self["config"].list:
70 # input failed, reset to any RC
74 for x in self["config"].list:
79 def set_mask(mask=None):
81 mask = config.plugins.MultiRC.mask.value
90 def multirc_setup(session, **kwargs):
91 session.open(MultiRCSetup)
93 def multirc_autostart(reason, **kwargs):
94 # on startup, set correct remote mask
99 def Plugins(**kwargs):
100 return [PluginDescriptor(name="Multi RemoteControl",
101 description=_("Multi Dreambox RC layer setup"),
102 where=PluginDescriptor.WHERE_PLUGINMENU,
103 fnc = multirc_setup),
105 PluginDescriptor(where=PluginDescriptor.WHERE_AUTOSTART,
106 fnc = multirc_autostart)]