from Screens.Screen import Screen from Components.ConfigList import ConfigListScreen from Components.config import config, getConfigListEntry from Components.Sources.StaticText import StaticText from Plugins.Plugin import PluginDescriptor import Components.HdmiCec class HdmiCECSetupScreen(Screen, ConfigListScreen): skin = """ """ def __init__(self, session): self.skin = HdmiCECSetupScreen.skin Screen.__init__(self, session) self.setTitle(_("HDMI-CEC setup")) from Components.ActionMap import ActionMap from Components.Button import Button self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("OK")) self["key_yellow"] = StaticText(_("Set fixed")) self["key_blue"] = StaticText(_("Clear fixed")) self["current_address"] = StaticText() self["fixed_address"] = StaticText() self["actions"] = ActionMap(["SetupActions", "ColorActions", "MenuActions"], { "ok": self.keyGo, "save": self.keyGo, "cancel": self.keyCancel, "green": self.keyGo, "red": self.keyCancel, "yellow": self.setFixedAddress, "blue": self.clearFixedAddress, "menu": self.closeRecursive, }, -2) self.list = [] ConfigListScreen.__init__(self, self.list, session = self.session) self.createSetup() self.updateAddress() def createSetup(self): self.list = [] self.list.append(getConfigListEntry(_("Enabled"), config.hdmicec.enabled)) if config.hdmicec.enabled.value: self.list.append(getConfigListEntry(_("Put TV in standby"), config.hdmicec.control_tv_standby)) self.list.append(getConfigListEntry(_("Wakeup TV from standby"), config.hdmicec.control_tv_wakeup)) self.list.append(getConfigListEntry(_("Regard deep standby as standby"), config.hdmicec.handle_deepstandby_events)) self.list.append(getConfigListEntry(_("Switch TV to correct input"), config.hdmicec.report_active_source)) self.list.append(getConfigListEntry(_("Use TV remote control"), config.hdmicec.report_active_menu)) self.list.append(getConfigListEntry(_("Handle standby from TV"), config.hdmicec.handle_tv_standby)) self.list.append(getConfigListEntry(_("Handle wakeup from TV"), config.hdmicec.handle_tv_wakeup)) self.list.append(getConfigListEntry(_("Wakeup signal from TV"), config.hdmicec.tv_wakeup_detection)) self.list.append(getConfigListEntry(_("Forward volume keys"), config.hdmicec.volume_forwarding)) self.list.append(getConfigListEntry(_("Put receiver in standby"), config.hdmicec.control_receiver_standby)) self.list.append(getConfigListEntry(_("Wakeup receiver from standby"), config.hdmicec.control_receiver_wakeup)) self.list.append(getConfigListEntry(_("Minimum send interval"), config.hdmicec.minimum_send_interval)) self.list.append(getConfigListEntry(_("Repeat leave standby messages"), config.hdmicec.repeat_wakeup_timer)) self["config"].list = self.list self["config"].l.setList(self.list) def keyLeft(self): ConfigListScreen.keyLeft(self) self.createSetup() def keyRight(self): ConfigListScreen.keyRight(self) self.createSetup() def keyGo(self): for x in self["config"].list: x[1].save() self.close() def keyCancel(self): for x in self["config"].list: x[1].cancel() self.close() def setFixedAddress(self): import Components.HdmiCec Components.HdmiCec.hdmi_cec.setFixedPhysicalAddress(Components.HdmiCec.hdmi_cec.getPhysicalAddress()) self.updateAddress() def clearFixedAddress(self): import Components.HdmiCec Components.HdmiCec.hdmi_cec.setFixedPhysicalAddress("0.0.0.0") self.updateAddress() def updateAddress(self): import Components.HdmiCec self["current_address"].setText(_("Current CEC address") + ": " + Components.HdmiCec.hdmi_cec.getPhysicalAddress()) if config.hdmicec.fixed_physical_address.value == "0.0.0.0": fixedaddresslabel = "" else: fixedaddresslabel = _("Using fixed address") + ": " + config.hdmicec.fixed_physical_address.value self["fixed_address"].setText(fixedaddresslabel) def main(session, **kwargs): session.open(HdmiCECSetupScreen) def startSetup(menuid): if menuid == "system": return [(_("HDMI-CEC setup"), main, "hdmi_cec_setup", 0)] return [] def Plugins(**kwargs): return [PluginDescriptor(where = PluginDescriptor.WHERE_MENU, fnc = startSetup)]