for motor 200ms to powerup before send diseqc command should be enough to
[enigma2.git] / lib / python / Components / ParentalControlList.py
1 from HTMLComponent import *
2 from GUIComponent import *
3
4 from MenuList import MenuList
5 from Components.ParentalControl import parentalControl
6 from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
7
8 from enigma import loadPNG, eListbox, eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
9
10 lockPicture = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "lock-fs8.png"))
11
12 def ParentalControlEntryComponent(service, name, locked = True):
13         res = [ (service, name, locked) ]
14         res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 50, 0, RT_HALIGN_LEFT, name))
15         if locked:
16                 res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 0, 0, 32, 32, lockPicture))
17         return res
18
19 class ParentalControlList(MenuList, HTMLComponent, GUIComponent):
20         def __init__(self, list):
21                 GUIComponent.__init__(self)
22                 self.l = eListboxPythonMultiContent()
23                 self.list = list
24                 self.l.setList(list)
25                 self.l.setFont(0, gFont("Regular", 20))
26                 self.l.setItemHeight(32)
27
28         GUI_WIDGET = eListbox
29         
30         def setList(self, list):
31                 self.list = list
32                 self.l.setList(list)
33                 
34         def postWidgetCreate(self, instance):
35                 instance.setContent(self.l)
36
37         def toggleSelectedLock(self):
38                 print "self.l.getCurrentSelection():", self.l.getCurrentSelection()
39                 print "self.l.getCurrentSelectionIndex():", self.l.getCurrentSelectionIndex()
40                 self.list[self.l.getCurrentSelectionIndex()] = ParentalControlEntryComponent(self.l.getCurrentSelection()[0][0], self.l.getCurrentSelection()[0][1], not self.l.getCurrentSelection()[0][2]);
41                 if self.l.getCurrentSelection()[0][2]:
42                         parentalControl.protectService(self.l.getCurrentSelection()[0][0])
43                 else:
44                         parentalControl.unProtectService(self.l.getCurrentSelection()[0][0])    
45                 self.l.setList(self.list)