1 from Screens.Screen import Screen
2 from Screens.ChannelSelection import *
3 from Components.ActionMap import HelpableActionMap, ActionMap, NumberActionMap
4 from Components.Sources.List import List
5 from Components.Sources.StaticText import StaticText
6 from Components.config import ConfigNothing
7 from Components.ConfigList import ConfigList
8 from Components.Label import Label
9 from Components.SelectionList import SelectionList
10 from Components.MenuList import MenuList
11 from ServiceReference import ServiceReference
12 from Plugins.Plugin import PluginDescriptor
13 from xml.etree.cElementTree import parse as ci_parse
14 from Tools.XMLTools import elementsWithTag, mergeText, stringToXML
15 from enigma import eDVBCI_UI, eDVBCIInterfaces, eEnv
17 from os import system, path as os_path
19 class CIselectMainMenu(Screen):
21 <screen name="CIselectMainMenu" position="center,center" size="500,250" title="CI assignment" >
22 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
23 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
24 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
25 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
26 <widget name="CiList" position="5,50" size="490,200" scrollbarMode="showOnDemand" />
29 def __init__(self, session, args = 0):
31 Screen.__init__(self, session)
33 self["key_red"] = StaticText(_("Close"))
34 self["key_green"] = StaticText(_("Edit"))
36 self["actions"] = ActionMap(["ColorActions","SetupActions"],
38 "green": self.greenPressed,
40 "ok": self.greenPressed,
44 NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots()
46 print "[CI_Wizzard] FOUND %d CI Slots " % NUM_CI
52 for slot in range(NUM_CI):
53 state = eDVBCI_UI.getInstance().getState(slot)
55 appname = _("Slot %d") %(slot+1) + " - " + _("no module found")
57 appname = _("Slot %d") %(slot+1) + " - " + _("init modules")
59 appname = _("Slot %d") %(slot+1) + " - " + eDVBCI_UI.getInstance().getAppName(slot)
60 self.list.append( (appname, ConfigNothing(), 0, slot) )
62 self.list.append( (_("no CI slots found") , ConfigNothing(), 1, -1) )
64 menuList = ConfigList(self.list)
65 menuList.list = self.list
66 menuList.l.setList(self.list)
67 self["CiList"] = menuList
68 self.onShown.append(self.setWindowTitle)
70 def setWindowTitle(self):
71 self.setTitle(_("CI assignment"))
73 def greenPressed(self):
74 cur = self["CiList"].getCurrent()
75 if cur and len(cur) > 2:
79 print "[CI_Wizzard] there is no CI Slot in your receiver"
81 print "[CI_Wizzard] selected CI Slot : %d" % slot
82 if config.usage.setup_level.index > 1: # advanced
83 self.session.open(CIconfigMenu, slot)
85 self.session.open(easyCIconfigMenu, slot)
87 """def yellowPressed(self): # unused
88 NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots()
89 print "[CI_Check] FOUND %d CI Slots " % NUM_CI
91 for ci in range(NUM_CI):
92 print eDVBCIInterfaces.getInstance().getDescrambleRules(ci)"""
95 class CIconfigMenu(Screen):
97 <screen name="CIconfigMenu" position="center,center" size="560,440" title="CI assignment" >
98 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
99 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
100 <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
101 <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
102 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
103 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
104 <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
105 <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
106 <widget source="CAidList_desc" render="Label" position="5,50" size="550,22" font="Regular;20" backgroundColor="#25062748" transparent="1" />
107 <widget source="CAidList" render="Label" position="5,80" size="550,45" font="Regular;20" backgroundColor="#25062748" transparent="1" />
108 <ePixmap pixmap="skin_default/div-h.png" position="0,125" zPosition="1" size="560,2" />
109 <widget source="ServiceList_desc" render="Label" position="5,130" size="550,22" font="Regular;20" backgroundColor="#25062748" transparent="1" />
110 <widget name="ServiceList" position="5,160" size="550,250" zPosition="1" scrollbarMode="showOnDemand" />
111 <widget source="ServiceList_info" render="Label" position="5,160" size="550,250" zPosition="2" font="Regular;20" backgroundColor="#25062748" transparent="1" />
114 def __init__(self, session, ci_slot="9"):
116 Screen.__init__(self, session)
118 self.filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(self.ci_slot) + ".xml"
120 self["key_red"] = StaticText(_("Delete"))
121 self["key_green"] = StaticText(_("add Service"))
122 self["key_yellow"] = StaticText(_("add Provider"))
123 self["key_blue"] = StaticText(_("select CAId"))
124 self["CAidList_desc"] = StaticText(_("assigned CAIds:"))
125 self["CAidList"] = StaticText()
126 self["ServiceList_desc"] = StaticText(_("assigned Services/Provider:"))
127 self["ServiceList_info"] = StaticText()
129 self["actions"] = ActionMap(["ColorActions","SetupActions"],
131 "green": self.greenPressed,
132 "red": self.redPressed,
133 "yellow": self.yellowPressed,
134 "blue": self.bluePressed,
135 "cancel": self.cancel
138 print "[CI_Wizzard_Config] Configuring CI Slots : %d " % self.ci_slot
142 print eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot)
143 for caid in eDVBCIInterfaces.getInstance().readCICaIds(self.ci_slot):
145 self.caidlist.append((str(hex(int(caid))),str(caid),i))
147 print "[CI_Wizzard_Config_CI%d] read following CAIds from CI: %s" %(self.ci_slot, self.caidlist)
149 self.selectedcaid = []
150 self.servicelist = []
153 serviceList = ConfigList(self.servicelist)
154 serviceList.list = self.servicelist
155 serviceList.l.setList(self.servicelist)
156 self["ServiceList"] = serviceList
159 # if config mode !=advanced autoselect any caid
160 if config.usage.setup_level.index <= 1: # advanced
161 self.selectedcaid=self.caidlist
162 self.finishedCAidSelection(self.selectedcaid)
163 self.onShown.append(self.setWindowTitle)
165 def setWindowTitle(self):
166 self.setTitle(_("CI assignment"))
168 def redPressed(self):
171 def greenPressed(self):
172 self.session.openWithCallback( self.finishedChannelSelection, myChannelSelection, None)
174 def yellowPressed(self):
175 self.session.openWithCallback( self.finishedProviderSelection, myProviderSelection, None)
177 def bluePressed(self):
178 self.session.openWithCallback(self.finishedCAidSelection, CAidSelect, self.caidlist, self.selectedcaid)
185 def setServiceListInfo(self):
186 if len(self.servicelist):
187 self["ServiceList_info"].setText("")
189 self["ServiceList_info"].setText(_("no Services/Providers selected"))
192 cur = self["ServiceList"].getCurrent()
193 if cur and len(cur) > 2:
194 self.servicelist.remove(cur)
195 self["ServiceList"].l.setList(self.servicelist)
196 self.setServiceListInfo()
198 def finishedChannelSelection(self, *args):
201 service_ref = ServiceReference(ref)
202 service_name = service_ref.getServiceName()
203 if find_in_list(self.servicelist, service_name, 0)==False:
204 split_ref=service_ref.ref.toString().split(":")
205 if split_ref[0] == "1":#== dvb service und nicht muell von None
206 self.servicelist.append( (service_name , ConfigNothing(), 0, service_ref.ref.toString()) )
207 self["ServiceList"].l.setList(self.servicelist)
208 self.setServiceListInfo()
210 def finishedProviderSelection(self, *args):
211 if len(args)>1: # bei nix selected kommt nur 1 arg zurueck (==None)
214 if find_in_list(self.servicelist, name, 0)==False:
215 self.servicelist.append( (name , ConfigNothing(), 1, dvbnamespace) )
216 self["ServiceList"].l.setList(self.servicelist)
217 self.setServiceListInfo()
219 def finishedCAidSelection(self, *args):
221 self.selectedcaid=args[0]
223 if len(self.selectedcaid):
224 for item in self.selectedcaid:
226 self.caids+= ", " + item[0]
231 self.caids=_("no CAId selected")
234 self.caids=_("no CAId selected")
235 self["CAidList"].setText(self.caids)
239 fp = file(self.filename, 'w')
240 fp.write("<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n")
242 fp.write("\t<slot>\n")
243 fp.write("\t\t<id>%s</id>\n" % self.ci_slot)
244 for item in self.selectedcaid:
245 if len(self.selectedcaid):
246 fp.write("\t\t<caid id=\"%s\" />\n" % item[0])
247 for item in self.servicelist:
248 if len(self.servicelist):
250 fp.write("\t\t<provider name=\"%s\" dvbnamespace=\"%s\" />\n" % (item[0], item[3]))
252 fp.write("\t\t<service name=\"%s\" ref=\"%s\" />\n" % (item[0], item[3]))
253 fp.write("\t</slot>\n")
257 print "[CI_Config_CI%d] xml not written" %self.ci_slot
258 os.unlink(self.filename)
261 if not os_path.exists(self.filename):
264 def getValue(definitions, default):
266 Len = len(definitions)
267 return Len > 0 and definitions[Len-1].text or default
270 tree = ci_parse(self.filename).getroot()
271 self.read_services=[]
272 self.read_providers=[]
275 for slot in tree.findall("slot"):
276 read_slot = getValue(slot.findall("id"), False).encode("UTF-8")
277 print "ci " + read_slot
280 for caid in slot.findall("caid"):
281 read_caid = caid.get("id").encode("UTF-8")
282 self.selectedcaid.append((str(read_caid),str(read_caid),i))
283 self.usingcaid.append(long(read_caid,16))
286 for service in slot.findall("service"):
287 read_service_name = service.get("name").encode("UTF-8")
288 read_service_ref = service.get("ref").encode("UTF-8")
289 self.read_services.append (read_service_ref)
291 for provider in slot.findall("provider"):
292 read_provider_name = provider.get("name").encode("UTF-8")
293 read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
294 self.read_providers.append((read_provider_name,read_provider_dvbname))
296 self.ci_config.append((int(read_slot), (self.read_services, self.read_providers, self.usingcaid)))
298 print "[CI_Config_CI%d] error parsing xml..." %self.ci_slot
300 for item in self.read_services:
302 self.finishedChannelSelection(item)
304 for item in self.read_providers:
306 self.finishedProviderSelection(item[0],item[1])
309 self.finishedCAidSelection(self.selectedcaid)
310 self["ServiceList"].l.setList(self.servicelist)
311 self.setServiceListInfo()
314 class easyCIconfigMenu(CIconfigMenu):
316 <screen name="easyCIconfigMenu" position="center,center" size="560,440" title="CI assignment" >
317 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
318 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
319 <ePixmap pixmap="skin_default/buttons/yellow.png" position="280,0" size="140,40" alphatest="on" />
320 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
321 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
322 <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
323 <widget source="ServiceList_desc" render="Label" position="5,50" size="550,22" font="Regular;20" backgroundColor="#25062748" transparent="1" />
324 <widget name="ServiceList" position="5,80" size="550,300" zPosition="1" scrollbarMode="showOnDemand" />
325 <widget source="ServiceList_info" render="Label" position="5,80" size="550,300" zPosition="2" font="Regular;20" backgroundColor="#25062748" transparent="1" />
328 def __init__(self, session, ci_slot="9"):
331 CIconfigMenu.__init__(self, session, ci_slot)
333 self["actions"] = ActionMap(["ColorActions","SetupActions"],
335 "green": self.greenPressed,
336 "red": self.redPressed,
337 "yellow": self.yellowPressed,
338 "cancel": self.cancel
342 class CAidSelect(Screen):
344 <screen name="CAidSelect" position="center,center" size="450,440" title="select CAId's" >
345 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
346 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
347 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
348 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
349 <widget name="list" position="5,50" size="440,330" scrollbarMode="showOnDemand" />
350 <ePixmap pixmap="skin_default/div-h.png" position="0,390" zPosition="1" size="450,2" />
351 <widget source="introduction" render="Label" position="0,400" size="450,40" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
354 def __init__(self, session, list, selected_caids):
356 Screen.__init__(self, session)
358 self.list = SelectionList()
359 self["list"] = self.list
361 for listindex in range(len(list)):
362 if find_in_list(selected_caids,list[listindex][0],0):
363 self.list.addSelection(list[listindex][0], list[listindex][1], listindex, True)
365 self.list.addSelection(list[listindex][0], list[listindex][1], listindex, False)
367 self["key_red"] = StaticText(_("Cancel"))
368 self["key_green"] = StaticText(_("Save"))
369 self["introduction"] = StaticText(_("Press OK to select/deselect a CAId."))
371 self["actions"] = ActionMap(["ColorActions","SetupActions"],
373 "ok": self.list.toggleSelection,
374 "cancel": self.cancel,
375 "green": self.greenPressed,
378 self.onShown.append(self.setWindowTitle)
380 def setWindowTitle(self):
381 self.setTitle(_("select CAId's"))
383 def greenPressed(self):
384 list = self.list.getSelectionsList()
391 class myProviderSelection(ChannelSelectionBase):
393 <screen name="myProviderSelection" position="center,center" size="560,440" title="Select provider to add...">
394 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
395 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
396 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
397 <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
398 <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
399 <widget name="list" position="5,50" size="550,330" scrollbarMode="showOnDemand" />
400 <ePixmap pixmap="skin_default/div-h.png" position="0,390" zPosition="1" size="560,2" />
401 <widget source="introduction" render="Label" position="0,400" size="560,40" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
404 def __init__(self, session, title):
405 ChannelSelectionBase.__init__(self, session)
406 self.onShown.append(self.__onExecCallback)
408 self["actions"] = ActionMap(["OkCancelActions", "ChannelSelectBaseActions"],
410 "showFavourites": self.doNothing,
411 "showAllServices": self.cancel,
412 "showProviders": self.doNothing,
413 "showSatellites": self.doNothing,
414 "cancel": self.cancel,
415 "ok": self.channelSelected
417 self["key_red"] = StaticText(_("Close"))
418 self["key_green"] = StaticText()
419 self["key_yellow"] = StaticText()
420 self["key_blue"] = StaticText()
421 self["introduction"] = StaticText(_("Press OK to select a Provider."))
426 def __onExecCallback(self):
427 self.showSatellites()
428 self.setTitle(_("Select provider to add..."))
430 def channelSelected(self): # just return selected service
431 ref = self.getCurrentSelection()
432 splited_ref=ref.toString().split(":")
433 if ref.flags == 7 and splited_ref[6] != "0":
434 self.dvbnamespace=splited_ref[6]
437 self.close(ref.getName(), self.dvbnamespace)
439 def showSatellites(self):
440 if not self.pathChangeDisabled:
441 refstr = '%s FROM SATELLITES ORDER BY satellitePosition'%(self.service_types)
442 if not self.preEnterPath(refstr):
443 ref = eServiceReference(refstr)
447 if self.isBasePathEqual(ref):
448 if self.isPrevPathEqual(ref):
450 prev = self.pathUp(justSet)
452 currentRoot = self.getRoot()
453 if currentRoot is None or currentRoot != ref:
456 self.enterPath(ref, True)
458 serviceHandler = eServiceCenter.getInstance()
459 servicelist = serviceHandler.list(ref)
460 if not servicelist is None:
462 service = servicelist.getNext()
463 if not service.valid(): #check if end of list
465 unsigned_orbpos = service.getUnsignedData(4) >> 16
466 orbpos = service.getData(4) >> 16
469 if service.getPath().find("FROM PROVIDER") != -1:
470 service_type = _("Providers")
472 # why we need this cast?
473 service_name = str(nimmanager.getSatDescription(orbpos))
475 if unsigned_orbpos == 0xFFFF: #Cable
476 service_name = _("Cable")
477 elif unsigned_orbpos == 0xEEEE: #Terrestrial
478 service_name = _("Terrestrial")
480 if orbpos > 1800: # west
481 orbpos = 3600 - orbpos
485 service_name = ("%d.%d" + h) % (orbpos / 10, orbpos % 10)
486 service.setName("%s - %s" % (service_name, service_type))
487 self.servicelist.addService(service)
488 self.servicelist.finishFill()
490 self.setCurrentSelection(prev)
495 class myChannelSelection(ChannelSelectionBase):
497 <screen name="myChannelSelection" position="center,center" size="560,440" title="Select service to add...">
498 <ePixmap pixmap="skin_default/buttons/red.png" position="0,0" size="140,40" alphatest="on" />
499 <ePixmap pixmap="skin_default/buttons/green.png" position="140,0" size="140,40" alphatest="on" />
500 <ePixmap pixmap="skin_default/buttons/blue.png" position="420,0" size="140,40" alphatest="on" />
501 <widget source="key_red" render="Label" position="0,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#9f1313" transparent="1" />
502 <widget source="key_green" render="Label" position="140,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#1f771f" transparent="1" />
503 <widget source="key_yellow" render="Label" position="280,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#a08500" transparent="1" />
504 <widget source="key_blue" render="Label" position="420,0" zPosition="1" size="140,40" font="Regular;20" halign="center" valign="center" backgroundColor="#18188b" transparent="1" />
505 <widget name="list" position="5,50" size="550,330" scrollbarMode="showOnDemand" />
506 <ePixmap pixmap="skin_default/div-h.png" position="0,390" zPosition="1" size="560,2" />
507 <widget source="introduction" render="Label" position="0,400" size="560,40" zPosition="10" font="Regular;21" halign="center" valign="center" backgroundColor="#25062748" transparent="1" />
510 def __init__(self, session, title):
511 ChannelSelectionBase.__init__(self, session)
512 self.onShown.append(self.__onExecCallback)
514 self["actions"] = ActionMap(["OkCancelActions", "TvRadioActions", "ChannelSelectBaseActions"],
516 "showProviders": self.doNothing,
517 "showSatellites": self.showAllServices,
518 "showAllServices": self.cancel,
519 "cancel": self.cancel,
520 "ok": self.channelSelected,
521 "keyRadio": self.setModeRadio,
522 "keyTV": self.setModeTv
525 self["key_red"] = StaticText(_("Close"))
526 self["key_green"] = StaticText(_("All"))
527 self["key_yellow"] = StaticText()
528 self["key_blue"] = StaticText(_("Favourites"))
529 self["introduction"] = StaticText(_("Press OK to select a Provider."))
531 def __onExecCallback(self):
533 self.setTitle(_("Select service to add..."))
538 def channelSelected(self): # just return selected service
539 ref = self.getCurrentSelection()
540 if (ref.flags & 7) == 7:
542 elif not (ref.flags & eServiceReference.isMarker):
543 ref = self.getCurrentSelection()
548 self.showFavourites()
550 def setModeRadio(self):
552 self.showFavourites()
557 def activate_all(session):
558 NUM_CI=eDVBCIInterfaces.getInstance().getNumOfSlots()
559 print "[CI_Activate] FOUND %d CI Slots " % NUM_CI
562 def getValue(definitions, default):
565 # How many definitions are present
566 Len = len(definitions)
567 return Len > 0 and definitions[Len-1].text or default
569 for ci in range(NUM_CI):
570 filename = eEnv.resolve("${sysconfdir}/enigma2/ci") + str(ci) + ".xml"
572 if not os_path.exists(filename):
573 print "[CI_Activate_Config_CI%d] no config file found" %ci
576 tree = ci_parse(filename).getroot()
580 for slot in tree.findall("slot"):
581 read_slot = getValue(slot.findall("id"), False).encode("UTF-8")
583 for caid in slot.findall("caid"):
584 read_caid = caid.get("id").encode("UTF-8")
585 usingcaid.append(long(read_caid,16))
587 for service in slot.findall("service"):
588 read_service_ref = service.get("ref").encode("UTF-8")
589 read_services.append (read_service_ref)
591 for provider in slot.findall("provider"):
592 read_provider_name = provider.get("name").encode("UTF-8")
593 read_provider_dvbname = provider.get("dvbnamespace").encode("UTF-8")
594 read_providers.append((read_provider_name,long(read_provider_dvbname,16)))
596 ci_config.append((int(read_slot), (read_services, read_providers, usingcaid)))
598 print "[CI_Activate_Config_CI%d] error parsing xml..." %ci
600 for item in ci_config:
601 print "[CI_Activate] activate CI%d with following settings:" %item[0]
605 eDVBCIInterfaces.getInstance().setDescrambleRules(item[0],item[1])
607 print "[CI_Activate_Config_CI%d] error setting DescrambleRules..." %item[0]
609 def find_in_list(list, search, listpos=0):
611 if item[listpos]==search:
615 global_session = None
617 def sessionstart(reason, session):
618 global global_session
619 global_session = session
621 def autostart(reason, **kwargs):
622 global global_session
624 print "[CI_Assignment] activating ci configs:"
625 activate_all(global_session)
627 global_session = None
629 def main(session, **kwargs):
630 session.open(CIselectMainMenu)
632 def menu(menuid, **kwargs):
633 if menuid == "setup" and eDVBCIInterfaces.getInstance().getNumOfSlots():
634 return [(_("Common Interface Assignment"), main, "ci_assign", 11)]
637 def Plugins(**kwargs):
638 if config.usage.setup_level.index > 1:
639 return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, needsRestart = False, fnc = sessionstart ),
640 PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, needsRestart = False, fnc = autostart ),
641 PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers/caids to common interface modules"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc = menu )]
643 return [PluginDescriptor( where = PluginDescriptor.WHERE_SESSIONSTART, needsRestart = False, fnc = sessionstart ),
644 PluginDescriptor( where = PluginDescriptor.WHERE_AUTOSTART, needsRestart = False, fnc = autostart ),
645 PluginDescriptor( name = "CommonInterfaceAssignment", description = _("a gui to assign services/providers to common interface modules"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc = menu )]