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 # mask value 0xf allows all RCs, no need to verify
53 if config.plugins.MultiRC.mask.value == "f":
54 self.confirm_save(True)
56 self.session.openWithCallback(self.confirm_save, MessageBox,
57 "Is the RC still working?", MessageBox.TYPE_YESNO,
58 timeout = 20, default = False)
60 def confirm_save(self, confirmed):
62 for x in self["config"].list:
67 # input failed, reset to any RC
71 for x in self["config"].list:
76 def set_mask(mask=None):
78 mask = config.plugins.MultiRC.mask.value
83 def multirc_setup(session, **kwargs):
84 session.open(MultiRCSetup)
86 def multirc_autostart(reason, **kwargs):
87 # on startup, set correct remote mask
92 def Plugins(**kwargs):
93 return [PluginDescriptor(name="Multi RemoteControl",
94 description="Multi Dreambox RC layer setup",
95 where=PluginDescriptor.WHERE_PLUGINMENU,
98 PluginDescriptor(where=PluginDescriptor.WHERE_AUTOSTART,
99 fnc = multirc_autostart)]