diff options
| author | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
|---|---|---|
| committer | Felix Domke <tmbinc@elitedvb.net> | 2009-03-31 15:51:31 +0200 |
| commit | bce53d4a67d1655a496eebe5912c8573e880114e (patch) | |
| tree | 9b410fbcaf0f4a22f1cf3489b635e3e94e47a6d8 /lib/python/Plugins/SystemPlugins | |
| parent | 166db5a9c9222c82939eede51d964c706039ebe8 (diff) | |
| parent | 54475ce18e43482b2ec1a150f7fa07c3464ec6d2 (diff) | |
| download | enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.tar.gz enigma2-bce53d4a67d1655a496eebe5912c8573e880114e.zip | |
Merge commit 'origin/master' into tmbinc/FixTimingBugs
Diffstat (limited to 'lib/python/Plugins/SystemPlugins')
13 files changed, 809 insertions, 45 deletions
diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE new file mode 100644 index 00000000..99700593 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/LICENSE @@ -0,0 +1,12 @@ +This plugin is licensed under the Creative Commons +Attribution-NonCommercial-ShareAlike 3.0 Unported +License. To view a copy of this license, visit +http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative +Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. + +Alternatively, this plugin may be distributed and executed on hardware which +is licensed by Dream Multimedia GmbH. + +This plugin is NOT free software. It is open source, you are allowed to +modify it (if you keep the license), but it may not be commercially +distributed other than under the conditions noted above. diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am new file mode 100644 index 00000000..562b1491 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/Makefile.am @@ -0,0 +1,6 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/CommonInterfaceAssignment + +install_PYTHON = \ + __init__.py \ + plugin.py + diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py new file mode 100644 index 00000000..e69de29b --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/__init__.py diff --git a/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py new file mode 100644 index 00000000..4c8167d4 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/CommonInterfaceAssignment/plugin.py @@ -0,0 +1,630 @@ +from Screens.Screen import Screen +from Screens.ChannelSelection import * +from Components.ActionMap import HelpableActionMap, ActionMap, NumberActionMap +from Components.Sources.List import List +from Components.Sources.StaticText import StaticText +from Components.config import ConfigNothing +from Components.ConfigList import ConfigList +from Components.Label import Label +from Components.SelectionList import SelectionList +from Components.MenuList import MenuList +from ServiceReference import ServiceReference +from Plugins.Plugin import PluginDescriptor +from xml.etree.cElementTree import parse as ci_parse +from Tools.XMLTools import elementsWithTag, mergeText, stringToXML +from enigma import eDVBCI_UI, eDVBCIInterfaces + +from os import system, path as os_path + +class CIselectMainMenu(Screen): + skin = """ + <screen position="205,150" size="310,270" title="CI Assignment" > + <widget name="CiList" position="10,10" size="290,200" scrollbarMode="showOnDemand" /> + <ePixmap position="10,210" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,220" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,220" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,220" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, args = 0): + self.skin = CIselectMainMenu.skin + Screen.__init__(self, session) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Config")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "ok": self.greenPressed, + "cancel": self.cancel + }, -1) + + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + + print "[CI_Wizzard] FOUND %d CI Slots " % NUM_CI + + self.dlg = None + self.state = { } + self.list = [ ] + if NUM_CI > 0: + for slot in range(NUM_CI): + state = eDVBCI_UI.getInstance().getState(slot) + if state == 0: + appname = _("Slot %d") %(slot+1) + " - " + _("no module") + elif state == 1: + appname = _("Slot %d") %(slot+1) + " - " + _("init modules") + elif state == 2: + appname = _("Slot %d") %(slot+1) + " - " + eDVBCI_UI.getInstance().getAppName(slot) + self.list.append( (appname, ConfigNothing(), 0, slot) ) + else: + self.list.append( (_("no CI slots found") , ConfigNothing(), 1, -1) ) + + menuList = ConfigList(self.list) + menuList.list = self.list + menuList.l.setList(self.list) + self["CiList"] = menuList + + def greenPressed(self): + cur = self["CiList"].getCurrent() + if cur and len(cur) > 2: + action = cur[2] + slot = cur[3] + if action == 1: + print "[CI_Wizzard] there is no CI Slot in your receiver" + else: + print "[CI_Wizzard] selected CI Slot : %d" % slot + if config.usage.setup_level.index > 1: # advanced + self.session.open(CIconfigMenu, slot) + else: + self.session.open(easyCIconfigMenu, slot) + + def yellowPressed(self): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Check] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + for ci in range(NUM_CI): + print eDVBCIInterfaces.getInstance().getDescrambleRules(ci) +# else: +# print "no ci found" + + def redPressed(self): + print "[CI_Config] RED BUTTON not implemented yet - only use self.cancel()" + self.cancel() + + def cancel(self): + self.close() + +class CIconfigMenu(Screen): + skin = """ + <screen position="60,80" size="595,436" title="CI Assignment" > + <widget name="CAidList.desc" position="10,10" size="575,22" font="Regular;20" /> + <widget name="CAidList" position="10,40" size="575,45" font="Regular;20" /> + <widget name="ServiceList.desc" position="10,90" size="575,22" font="Regular;20" /> + <widget name="ServiceList" position="10,120" size="575,250" scrollbarMode="showOnDemand" /> + <ePixmap position="10,380" size="575,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="155,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="300,390" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="445,390" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="155,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="300,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_blue" render="Label" position="445,390" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + self.skin = CIconfigMenu.skin + Screen.__init__(self, session) + self.ci_slot=ci_slot + self.filename="/etc/enigma2/ci"+str(self.ci_slot)+".xml" + + self["key_red"] = StaticText(_("delete")) + self["key_green"] = StaticText(_("add Service")) + self["key_yellow"] = StaticText(_("add Provider")) + self["key_blue"] = StaticText(_("select CAId")) + self["CAidList.desc"] = Label(_("assigned CAIds")) + self["ServiceList.desc"] = Label(_("assigned Services/Provider")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + print "[CI_Wizzard_Config] Configuring CI Slots : %d " % self.ci_slot + + i=0 + self.caidlist=[] + print eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot) + for caid in eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot): + i+=1 + self.caidlist.append((str(hex(int(caid))),str(caid),i)) + + print "[CI_Wizzard_Config_CI%d] read following CAIds from CI: %s" %(self.ci_slot, self.caidlist) + self.selectedcaid =[] + self.servicelist = [] + self.caids=_("no CAId selected") + self["CAidList"] = Label(self.caids) + + serviceList = ConfigList(self.servicelist) + serviceList.list = self.servicelist + serviceList.l.setList(self.servicelist) + self["ServiceList"] = serviceList + + self.loadXML() + # if config mode !=advanced autoselect any caid + if config.usage.setup_level.index <= 1: # advanced + self.selectedcaid=self.caidlist + + def redPressed(self): + self.delete() + + def greenPressed(self): + self.session.openWithCallback( self.finishedChannelSelection, myChannelSelection, None) + + def yellowPressed(self): + self.session.openWithCallback( self.finishedProviderSelection, myProviderSelection, None) + + def bluePressed(self): + self.session.openWithCallback(self.finishedCAidSelection, CAidSelect, self.caidlist, self.selectedcaid) + + def okPressed(self): + print "[CI_Config_CI%d] OK BUTTON not implemented yet" %self.ci_slot + + def cancel(self): + self.saveXML() + activate_all(self) + self.close() + + def delete(self): + cur = self["ServiceList"].getCurrent() + if cur and len(cur) > 2: + self.servicelist.remove(cur) + self["ServiceList"].l.setList(self.servicelist) + + def finishedChannelSelection(self, *args): + if len(args): + ref=args[0] + service_ref = ServiceReference(ref) + service_name = service_ref.getServiceName() + if find_in_list(self.servicelist, service_name, 0)==False: + split_ref=service_ref.ref.toString().split(":") + if split_ref[0] == "1": #== dvb service und nicht muell von None + self.servicelist.append( (service_name , ConfigNothing(), 0, service_ref.ref.toString()) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedProviderSelection(self, *args): + if len(args)>1: # bei nix selected kommt nur 1 arg zurueck (==None) + name=args[0] + dvbnamespace=args[1] + if find_in_list(self.servicelist, name, 0)==False: + self.servicelist.append( (name , ConfigNothing(), 1, dvbnamespace) ) + self["ServiceList"].l.setList(self.servicelist) + + def finishedCAidSelection(self, *args): + if len(args): + self.selectedcaid=args[0] + self.caids="" + for item in self.selectedcaid: + if len(self.caids): + self.caids+= ", " + item[0] + else: + self.caids=item[0] + else: + self.selectedcaid=[] + self.caids=_("no CAId selected") + self["CAidList"].setText(self.caids) + + def saveXML(self): + try: + fp = file(self.filename, 'w') + fp.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n") + fp.write("<ci>\n") + fp.write("\t<slot>\n") + fp.write("\t\t<id>%s</id>\n" % self.ci_slot) + for item in self.selectedcaid: + if len(self.selectedcaid): + fp.write("\t\t<caid id=\"%s\" />\n" % item[0]) + for item in self.servicelist: + if len(self.servicelist): + if item[2]==1: + fp.write("\t\t<provider name=\"%s\" dvbnamespace=\"%s\" />\n" % (item[0], item[3])) + else: + fp.write("\t\t<service name=\"%s\" ref=\"%s\" />\n" % (item[0], item[3])) + fp.write("\t</slot>\n") + fp.write("</ci>\n") + fp.close() + except: + print "[CI_Config_CI%d] xml not written" %self.ci_slot + os.unlink(self.filename) + + def loadXML(self): + if not os_path.exists(self.filename): + return + + def getValue(definitions, default): + ret = "" + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + try: + tree = ci_parse(self.filename).getroot() + self.read_services=[] + self.read_providers=[] + self.usingcaid=[] + self.ci_config=[] +# for ci in tree.findall("ci"): + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + print "ci " + read_slot + + i=0 + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + self.selectedcaid.append((str(read_caid),str(read_caid),i)) + self.usingcaid.append(long(read_caid,16)) + i+=1 + + for service in slot.findall("service"): + read_service_name = service.get("name").encode("UTF-8") + read_service_ref = service.get("ref").encode("UTF-8") + self.read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + self.read_providers.append((read_provider_name,read_provider_dvbname)) + + self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid))) + except: + print "[CI_Config_CI%d] error parsing xml..." %self.ci_slot + + for item in self.read_services: + if len(item): + self.finishedChannelSelection(item) + + for item in self.read_providers: + if len(item): + self.finishedProviderSelection(item[0],item[1]) + + print self.ci_config + self.finishedCAidSelection(self.selectedcaid) + self["ServiceList"].l.setList(self.servicelist) + +class easyCIconfigMenu(CIconfigMenu): + skin = """ + <screen position="80,80" size="470,420" title="CI Assignment" > + <widget name="ServiceList.desc" position="10,10" size="420,22" font="Regular;20" /> + <widget name="ServiceList" position="10,40" size="450,340" scrollbarMode="showOnDemand" /> + <ePixmap position="10,360" size="450,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,370" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="310,370" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget source="key_yellow" render="Label" position="310,370" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, ci_slot="9"): + ci=ci_slot + CIconfigMenu.__init__(self, session, ci_slot) + self.skin = easyCIconfigMenu.skin + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "green": self.greenPressed, + "red": self.redPressed, + "yellow": self.yellowPressed, + "blue": self.bluePressed, + "ok": self.okPressed, + "cancel": self.cancel + }, -1) + + def bluePressed(self): + print "do nothing" + +class CAidSelect(Screen): + skin = """ + <screen position="210,140" size="310,290" title="select CAId's" > + <widget name="list" position="10,10" size="290,210" scrollbarMode="showOnDemand" /> + <ePixmap position="10,230" size="290,2" pixmap="skin_default/div-h.png" transparent="1" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,240" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,240" size="140,40" alphatest="on" /> + <widget source="key_red" render="Label" position="10,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget source="key_green" render="Label" position="160,240" zPosition="1" size="140,40" font="Regular;19" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + </screen>""" + + def __init__(self, session, list, selected_caids): + self.skin = CAidSelect.skin + Screen.__init__(self, session) + + self.list = SelectionList() + self["list"] = self.list + + for listindex in range(len(list)): + if find_in_list(selected_caids,list[listindex][0],0): + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True) + else: + self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False) + + self["key_red"] = StaticText(_("Cancel")) + self["key_green"] = StaticText(_("Save")) + + self["actions"] = ActionMap(["ColorActions","SetupActions"], + { + "ok": self.list.toggleSelection, + "cancel": self.cancel, + "green": self.greenPressed, + "red": self.cancel + }, -1) + + def greenPressed(self): + list = self.list.getSelectionsList() + print list + self.close(list) + + def cancel(self): + self.close() + +class myProviderSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select provider to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + + self["actions"] = ActionMap(["OkCancelActions", "ChannelSelectBaseActions"], + { + "showFavourites": self.doNothing, + "showAllServices": self.doNothing, + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + }) + self["key_red"] = StaticText(_("")) + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + self["key_blue"] = StaticText(_("")) + + def doNothing(self): + print "nothing to do..." + + def __onExecCallback(self): + self.showSatellites() + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + splited_ref=ref.toString().split(":") + if ref.flags == 7 and splited_ref[6] != "0": + self.dvbnamespace=splited_ref[6] + self.enterPath(ref) + else: + self.close(ref.getName(), self.dvbnamespace) + + def showSatellites(self): + if not self.pathChangeDisabled: + refstr = '%s FROM SATELLITES ORDER BY satellitePosition'%(self.service_types) + if not self.preEnterPath(refstr): + ref = eServiceReference(refstr) + justSet=False + prev = None + + if self.isBasePathEqual(ref): + if self.isPrevPathEqual(ref): + justSet=True + prev = self.pathUp(justSet) + else: + currentRoot = self.getRoot() + if currentRoot is None or currentRoot != ref: + justSet=True + self.clearPath() + self.enterPath(ref, True) + if justSet: + serviceHandler = eServiceCenter.getInstance() + servicelist = serviceHandler.list(ref) + if not servicelist is None: + while True: + service = servicelist.getNext() + if not service.valid(): #check if end of list + break + unsigned_orbpos = service.getUnsignedData(4) >> 16 + orbpos = service.getData(4) >> 16 + if orbpos < 0: + orbpos += 3600 + if service.getPath().find("FROM PROVIDER") != -1: + service_type = _("Providers") + try: + # why we need this cast? + service_name = str(nimmanager.getSatDescription(orbpos)) + except: + if unsigned_orbpos == 0xFFFF: #Cable + service_name = _("Cable") + elif unsigned_orbpos == 0xEEEE: #Terrestrial + service_name = _("Terrestrial") + else: + if orbpos > 1800: # west + orbpos = 3600 - orbpos + h = _("W") + else: + h = _("E") + service_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10) + service.setName("%s - %s" % (service_name, service_type)) + self.servicelist.addService(service) + self.servicelist.finishFill() + if prev is not None: + self.setCurrentSelection(prev) + + def cancel(self): + self.close(None) + +class myChannelSelection(ChannelSelectionBase): + skin = """ + <screen position="80,80" size="560,430" title="Select service to add..."> + <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" /> + <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" /> + <widget name="key_red" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" /> + <widget name="key_green" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" /> + <widget name="key_yellow" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" /> + <widget name="key_blue" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" /> + <widget name="list" position="00,45" size="560,364" scrollbarMode="showOnDemand" /> + </screen>""" + + def __init__(self, session, title): + ChannelSelectionBase.__init__(self, session) + self.onShown.append(self.__onExecCallback) + service = self.session.nav.getCurrentService() + if service: + info = service.info() + if info: + refstr = info.getInfoString(iServiceInformation.sServiceref) + self.servicelist.setPlayableIgnoreService(eServiceReference(refstr)) + + self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions", "ChannelSelectBaseActions"], + { + "showProviders": self.doNothing, + "showSatellites": self.doNothing, + "cancel": self.cancel, + "ok": self.channelSelected, + "keyRadio": self.setModeRadio, + "keyTV": self.setModeTv + }) + + self["key_green"] = StaticText(_("")) + self["key_yellow"] = StaticText(_("")) + + def __onExecCallback(self): + self.setModeTv() + + def doNothing(self): + print "nothing to do..." + + def channelSelected(self): # just return selected service + ref = self.getCurrentSelection() + if (ref.flags & 7) == 7: + self.enterPath(ref) + elif not (ref.flags & eServiceReference.isMarker): + ref = self.getCurrentSelection() + self.close(ref) + + def setModeTv(self): + self.setTvMode() + self.showFavourites() + + def setModeRadio(self): + self.setRadioMode() + self.showFavourites() + + def cancel(self): + self.close(None) + +def activate_all(session): + NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots() + print "[CI_Activate] FOUND %d CI Slots " % NUM_CI + if NUM_CI > 0: + ci_config=[] + def getValue(definitions, default): + # Initialize Output + ret = "" + # How many definitions are present + Len = len(definitions) + return Len > 0 and definitions[Len-1].text or default + + for ci in range(NUM_CI): + filename="/etc/enigma2/ci"+str(ci)+".xml" + + if not os_path.exists(filename): + print "[CI_Activate_Config_CI%d] no config file found" %ci + + try: + tree = ci_parse(filename).getroot() + read_services=[] + read_providers=[] + usingcaid=[] + for slot in tree.findall("slot"): + read_slot = getValue(slot.findall("id"), False).encode("UTF-8") + + for caid in slot.findall("caid"): + read_caid = caid.get("id").encode("UTF-8") + usingcaid.append(long(read_caid,16)) + + for service in slot.findall("service"): + read_service_ref = service.get("ref").encode("UTF-8") + read_services.append (read_service_ref) + + for provider in slot.findall("provider"): + read_provider_name = provider.get("name").encode("UTF-8") + read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8") + read_providers.append((read_provider_name,long(read_provider_dvbname,16))) + + ci_config.append((int(read_slot), (read_services, read_providers, usingcaid))) + except: + print "[CI_Activate_Config_CI%d] error parsing xml..." %ci + + for item in ci_config: + print "[CI_Activate] activate CI%d with following settings:" %item[0] + print item[0] + print item[1] + try: + eDVBCIInterfaces.getInstance().setDescrambleRules(item[0],item[1]) + except: + print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." %item[0] + +def find_in_list(list, search, listpos=0): + for item in list: + if item[listpos]==search: + return True + return False + +global_session = None + +def sessionstart(reason, session): + global global_session + global_session = session + +def autostart(reason, **kwargs): + global global_session + if reason == 0: + print "[CI_Assignment] activating ci configs:" + activate_all(global_session) + elif reason == 1: + global_session = None + +def main(session, **kwargs): + session.open(CIselectMainMenu) + +def menu(menuid, **kwargs): + if menuid == "setup" and eDVBCIInterfaces.getInstance().getNumOfSlots(): + return [(_("Common Interface Assignment"), main, "ci_assign", 11)] + return [ ] + +def Plugins(**kwargs): + if config.usage.setup_level.index > 1: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers/caids to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] + else: + return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, fnc = sessionstart ), + PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, fnc = autostart ), + PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers to common interface modules"), where = PluginDescriptor.WHERE_MENU, fnc = menu )] diff --git a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py index 07861954..bb4df74a 100644 --- a/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py +++ b/lib/python/Plugins/SystemPlugins/DiseqcTester/plugin.py @@ -78,6 +78,14 @@ class ResultParser: text += " ==> " text += str(transponder[0]) text += "\n" + if reason == "pids_failed": + text += "(tsid, onid): " + text += str(transponder[3]['real']) + text += "(read from sat) != " + text += str(transponder[3]['expected']) + text += "(read from file)" + text += "\n" + text += "\n" if countsuccessful > 0: text += "\n" text += "Successfully tuned transponders' previous planes:\n" @@ -265,7 +273,7 @@ class DiseqcTester(Screen, TuneTest, ResultParser): for sat in nimmanager.getSatListForNim(self.feid): for transponder in nimmanager.getTransponders(sat[0]): #print transponder - mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[5], sat[0], None, None, transponder[10], transponder[11]) + mytransponder = (transponder[1] / 1000, transponder[2] / 1000, transponder[3], transponder[4], transponder[7], sat[0], transponder[5], transponder[6], transponder[8], transponder[9], transponder[10], transponder[11]) self.analyseTransponder(mytransponder) def getIndexForTransponder(self, transponder): @@ -623,7 +631,7 @@ class DiseqcTesterNimSelection(NimSelection): def showNim(self, nim): nimConfig = nimmanager.getNimConfig(nim.slot) if nim.isCompatible("DVB-S"): - if nimConfig.configMode.value in ["loopthrough", "equal", "satposdepends", "nothing"]: + if nimConfig.configMode.value in ("loopthrough", "equal", "satposdepends", "nothing"): return False if nimConfig.configMode.value == "simple": if nimConfig.diseqcMode.value == "positioner": diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index 10151f2c..634c7f42 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -1 +1,3 @@ -SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug DefaultServicesScanner NFIFlash DiseqcTester +SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ + SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \ + DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment diff --git a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py index ec223d3e..ec472e72 100644 --- a/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SatelliteEquipmentControl/plugin.py @@ -25,7 +25,8 @@ class SecParameterSetup(Screen, ConfigListScreen): list = [ ("Delay after diseqc reset command", config.sec.delay_after_diseqc_reset_cmd), ("Delay after diseqc peripherial poweron command", config.sec.delay_after_diseqc_peripherial_poweron_cmd), - ("Delay after continuous tone change", config.sec.delay_after_continuous_tone_change), + ("Delay after continuous tone disable before diseqc", config.sec.delay_after_continuous_tone_disable_before_diseqc), + ("Delay after final continuous tone change", config.sec.delay_after_final_continuous_tone_change), ("Delay after last voltage change", config.sec.delay_after_final_voltage_change), ("Delay between diseqc commands", config.sec.delay_between_diseqc_repeats), ("Delay after last diseqc command", config.sec.delay_after_last_diseqc_command), diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py index 947452e9..327f08ed 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/BackupRestore.py @@ -308,5 +308,3 @@ class RestoreScreen(Screen, ConfigListScreen): def runAsync(self, finished_cb): self.finished_cb = finished_cb self.doRestore() - -
\ No newline at end of file diff --git a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py index 09b61bd5..3eefa47d 100755 --- a/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py +++ b/lib/python/Plugins/SystemPlugins/SoftwareManager/plugin.py @@ -19,7 +19,7 @@ from Components.SelectionList import SelectionList from Components.PluginComponent import plugins from Tools.Directories import fileExists, resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE from Tools.LoadPixmap import LoadPixmap -from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont +from enigma import eTimer, quitMainloop, RT_HALIGN_LEFT, RT_VALIGN_CENTER, eListboxPythonMultiContent, eListbox, gFont, getDesktop from cPickle import dump, load from os import path as os_path, system as os_system, unlink, stat, mkdir, popen, makedirs, listdir, access, rename, remove, W_OK, R_OK, F_OK @@ -82,7 +82,7 @@ class UpdatePluginMenu(Screen): <widget source="menu" render="Listbox" position="280,10" size="230,300" scrollbarMode="showNever" selectionDisabled="1"> <convert type="TemplatedMultiContent"> {"template": [ - MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 0 is the MenuText, + MultiContentEntryText(pos = (2, 2), size = (230, 300), flags = RT_HALIGN_CENTER|RT_VALIGN_CENTER|RT_WRAP, text = 2), # index 2 is the Description, ], "fonts": [gFont("Regular", 20)], "itemHeight": 230 @@ -157,7 +157,8 @@ class UpdatePluginMenu(Screen): if (current == "ipkg-manager"): self.session.open(PacketManager, self.skin_path) elif (current == "ipkg-source"): - self.session.open(IPKGSource) + self.session.open(IPKGMenu, self.skin_path) + #self.session.open(IPKGSource) elif (current == "ipkg-install"): try: from Plugins.Extensions.MediaScanner.plugin import main @@ -223,34 +224,123 @@ class UpdatePluginMenu(Screen): self.exe = True self.session.open(RestoreScreen, runRestore = True) +class IPKGMenu(Screen): + skin = """ + <screen name="IPKGMenu" position="135,144" size="450,320" title="Select IPKG source......" > + <widget name="filelist" position="10,10" size="430,240" scrollbarMode="showOnDemand" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,290" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,280" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,290" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> + </screen>""" + + def __init__(self, session, plugin_path): + Screen.__init__(self, session) + self.skin_path = plugin_path + + self["closetext"] = Label(_("Close")) + self["edittext"] = Label(_("Edit")) + + self.sel = [] + self.val = [] + self.entry = False + self.exe = False + + self.path = "" + + self["actions"] = NumberActionMap(["SetupActions"], + { + "ok": self.KeyOk, + "cancel": self.keyCancel + }, -1) + + self["shortcuts"] = ActionMap(["ShortcutActions"], + { + "red": self.keyCancel, + "green": self.KeyOk, + }) + self.flist = [] + self["filelist"] = MenuList(self.flist) + self.fill_list() + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + + def setWindowTitle(self): + self.setTitle(_("Select IPKG source to edit...")) + + + def fill_list(self): + self.flist = [] + self.path = '/etc/ipkg/' + if (os_path.exists(self.path) == False): + self.entry = False + return + for file in listdir(self.path): + if (file.endswith(".conf")): + if file != 'arch.conf': + self.flist.append((file)) + self.entry = True + self["filelist"].l.setList(self.flist) + + def KeyOk(self): + if (self.exe == False) and (self.entry == True): + self.sel = self["filelist"].getCurrent() + self.val = self.path + self.sel + self.session.open(IPKGSource, self.val) + + def keyCancel(self): + self.close() + + def Exit(self): + self.close() + class IPKGSource(Screen): skin = """ - <screen position="100,100" size="550,60" title="IPKG source" > - <widget name="text" position="0,0" size="550,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <screen name="IPKGSource" position="100,100" size="550,80" title="IPKG source" > + <widget name="text" position="10,10" size="530,25" font="Regular;20" backgroundColor="background" foregroundColor="#cccccc" /> + <ePixmap pixmap="skin_default/buttons/red.png" position="10,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="closetext" position="20,50" size="140,21" zPosition="10" font="Regular;21" transparent="1" /> + <ePixmap pixmap="skin_default/buttons/green.png" position="160,40" zPosition="2" size="140,40" transparent="1" alphatest="on" /> + <widget name="edittext" position="170,50" size="300,21" zPosition="10" font="Regular;21" transparent="1" /> </screen>""" - def __init__(self, session, args = None): + def __init__(self, session, configfile = None): Screen.__init__(self, session) self.session = session - - #FIXMEEEE add handling for more than one feed conf file! + self.configfile = configfile text = "" - try: - fp = file('/etc/ipkg/official-feed.conf', 'r') - sources = fp.readlines() - if sources: - text = sources[0] - fp.close() - except IOError: - pass - - self["text"] = Input(text, maxSize=False, type=Input.TEXT) - - self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions"], + if self.configfile: + try: + fp = file(configfile, 'r') + sources = fp.readlines() + if sources: + text = sources[0] + fp.close() + except IOError: + pass + + desk = getDesktop(0) + x= int(desk.size().width()) + y= int(desk.size().height()) + #print "[IPKGSource] mainscreen: current desktop size: %dx%d" % (x,y) + + self["closetext"] = Label(_("Cancel")) + self["edittext"] = Label(_("Save")) + + if (y>=720): + self["text"] = Input(text, maxSize=False, type=Input.TEXT) + else: + self["text"] = Input(text, maxSize=False, visible_width = 55, type=Input.TEXT) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions", "TextEntryActions", "KeyboardInputActions","ShortcutActions"], { "ok": self.go, "back": self.close, + "red": self.close, + "green": self.go, "left": self.keyLeft, "right": self.keyRight, "home": self.keyHome, @@ -268,12 +358,22 @@ class IPKGSource(Screen): "9": self.keyNumberGlobal, "0": self.keyNumberGlobal }, -1) + + self.onLayoutFinish.append(self.layoutFinished) + + def layoutFinished(self): + self.setWindowTitle() + self["text"].right() + + def setWindowTitle(self): + self.setTitle(_("Edit IPKG source URL...")) def go(self): text = self["text"].getText() if text: - fp = file('/etc/ipkg/official-feed.conf', 'w') - fp.write() + fp = file(self.configfile, 'w') + fp.write(text) + fp.write("\n") fp.close() self.close() @@ -715,7 +815,7 @@ def filescan(**kwargs): ScanPath(path = "", with_subdirs = False), ], name = "Ipkg", - description = "Install software updates...", + description = _("Install software updates..."), openfnc = filescan_open, ) def UpgradeMain(session, **kwargs): diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py index 6a85c4da..64f79e04 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoHardware.py @@ -67,7 +67,7 @@ class VideoHardware: else: mode = config.av.videomode[port].value force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" if is_widescreen: if force_widescreen: @@ -283,7 +283,7 @@ class VideoHardware: force_widescreen = self.isWidescreenMode(port, mode) - is_widescreen = force_widescreen or config.av.aspect.value in ["16_9", "16_10"] + is_widescreen = force_widescreen or config.av.aspect.value in ("16_9", "16_10") is_auto = config.av.aspect.value == "auto" policy2 = "policy" # use main policy diff --git a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py index 1d7ce7b5..8f8bea09 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/VideoWizard.py @@ -13,8 +13,8 @@ config.misc.showtestcard = ConfigBoolean(default = False) class VideoWizardSummary(WizardSummary): skin = """ <screen position="0,0" size="132,64"> - <widget name="text" position="6,4" size="120,42" font="Regular;14" transparent="1" /> - <widget source="parent.list" render="Label" position="6,25" size="120,21" font="Regular;16"> + <widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" /> + <widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14"> <convert type="StringListSelection" /> </widget> <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/--> @@ -165,7 +165,7 @@ class VideoWizard(WizardLanguage, Rc): config.misc.showtestcard.value = False def keyNumberGlobal(self, number): - if number in [1,2,3]: + if number in (1,2,3): if number == 1: self.hw.saveMode("DVI", "720p", "multi") elif number == 2: diff --git a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py index 30bdf796..6b6d5045 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/plugin.py +++ b/lib/python/Plugins/SystemPlugins/Videomode/plugin.py @@ -52,8 +52,9 @@ class VideoSetup(Screen, ConfigListScreen): def createSetup(self): level = config.usage.setup_level.index - self.list = [ ] - self.list.append(getConfigListEntry(_("Video Output"), config.av.videoport)) + self.list = [ + getConfigListEntry(_("Video Output"), config.av.videoport) + ] # if we have modes for this port: if config.av.videoport.value in config.av.videomode: @@ -76,9 +77,11 @@ class VideoSetup(Screen, ConfigListScreen): if not force_wide: self.list.append(getConfigListEntry(_("Aspect Ratio"), config.av.aspect)) - if force_wide or config.av.aspect.value in ["16_9", "16_10"]: - self.list.append(getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43)) - self.list.append(getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169)) + if force_wide or config.av.aspect.value in ("16_9", "16_10"): + self.list.extend(( + getConfigListEntry(_("Display 4:3 content as"), config.av.policy_43), + getConfigListEntry(_("Display >16:9 content as"), config.av.policy_169) + )) elif config.av.aspect.value == "4_3": self.list.append(getConfigListEntry(_("Display 16:9 content as"), config.av.policy_169)) @@ -95,6 +98,10 @@ class VideoSetup(Screen, ConfigListScreen): self.list.append(getConfigListEntry(_("AC3 default"), config.av.defaultac3)) if SystemInfo["CanDownmixAC3"]: self.list.append(getConfigListEntry(_("AC3 downmix"), config.av.downmix_ac3)) + self.list.extend(( + getConfigListEntry(_("General AC3 Delay"), config.av.generalAC3delay), + getConfigListEntry(_("General PCM Delay"), config.av.generalPCMdelay) + )) if SystemInfo["CanChangeOsdAlpha"]: self.list.append(getConfigListEntry(_("OSD visibility"), config.av.osd_alpha)) diff --git a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml index 2a592aae..29ac4297 100644 --- a/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml +++ b/lib/python/Plugins/SystemPlugins/Videomode/videowizard.xml @@ -1,7 +1,7 @@ <wizard> - <step id="inputselection" nextstep="modeselection" timeout="10" timeoutaction="selectnext"> + <step id="inputselection" nextstep="modeselection" timeout="20" timeoutaction="selectnext"> <text value="Video input selection\n\nPlease press OK if you can see this page on your TV (or select a different input port).\n\nThe next input port will be automatically probed in 10 seconds." /> - <displaytext value="Select video input" /> + <displaytext value="Select video input with up/down buttons" /> <list type="dynamic" source="listInputChannels" evaluation="inputSelectionMade" onselect="inputSelectionMoved" /> <code> self["portpic"].show() @@ -9,7 +9,7 @@ self.clearSelectedKeys() self.selectKey("OK") </code> </step> - <step id="modeselection" nextstep="rateselection" timeout="10" timeoutaction="selectnext"> + <step id="modeselection" nextstep="rateselection" timeout="20" timeoutaction="selectnext"> <text value="Video mode selection." /> <displaytext value="Select video mode" /> <list type="dynamic" source="listModes" evaluation="modeSelectionMade" onselect="modeSelectionMoved" /> @@ -20,7 +20,7 @@ self.selectKey("DOWN") self["portpic"].hide() </code> </step> - <step id="rateselection" nextstep="dvirateintroduction" timeout="10" timeoutaction="selectnext"> + <step id="rateselection" nextstep="dvirateintroduction" timeout="20" timeoutaction="selectnext"> <condition> self.condition = (self.port != "DVI" or self.mode == "PC") </condition> @@ -46,7 +46,7 @@ self.selectKey("DOWN") self.rateSelect("60Hz") </code> </step> - <step id="dvirateselection" timeout="10" timeoutaction="changestep" timeoutstep="notworking50Hz"> + <step id="dvirateselection" timeout="20" timeoutaction="changestep" timeoutstep="notworking50Hz"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> @@ -77,7 +77,7 @@ self.selectKey("UP") self.selectKey("DOWN") </code> </step> - <step id="working50Hz" nextstep="end" timeout="10" timeoutaction="nextstep"> + <step id="working50Hz" nextstep="end" timeout="20" timeoutaction="nextstep"> <condition> self.condition = (self.port == "DVI" and self.mode in ["720p", "1080i"]) </condition> |
