f0fe140322cb85612258f82f653349774122d08d
[enigma2.git] / lib / python / Plugins / SystemPlugins / Videomode / VideoWizard.py
1 from Screens.Wizard import Wizard, wizardManager
2 import sys
3 from VideoHardware import video_hw
4
5 from Components.Pixmap import Pixmap, MovingPixmap
6 from Components.config import config, ConfigBoolean, configfile
7
8 class VideoWizard(Wizard):
9         skin = """
10                 <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
11                         <widget name="text" position="153,50" size="340,270" font="Regular;23" />
12                         <widget source="list" render="Listbox" position="50,300" size="440,200" scrollbarMode="showOnDemand" >
13                                 <convert type="StringList" />
14                         </widget>
15                         <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />                    
16                         <widget name="stepslider" position="50,500" zPosition="1" borderWidth="2" size="440,20" backgroundColor="dark" />
17                         <widget name="wizard" pixmap="wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
18                         <widget name="rc" pixmap="rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
19                         <widget name="arrowdown" pixmap="arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
20                         <widget name="arrowup" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
21                         <widget name="arrowup2" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
22                 </screen>"""
23         
24         def __init__(self, session):
25                 # FIXME anyone knows how to use relative paths from the plugin's directory?
26                 self.xmlfile = sys.path[0] + "/Plugins/SystemPlugins/Videomode/videowizard.xml"
27                 self.hw = video_hw
28                 
29                 Wizard.__init__(self, session, showSteps = False)
30                 self["wizard"] = Pixmap()
31                 self["rc"] = MovingPixmap()
32                 self["arrowdown"] = MovingPixmap()
33                 self["arrowup"] = MovingPixmap()
34                 self["arrowup2"] = MovingPixmap()
35                 
36                 self.port = None
37                 self.mode = None
38                 
39         def createSummary(self):
40                 print "++++++++++++***++**** VideoWizard-createSummary"
41                 from Screens.Wizard import WizardSummary
42                 return WizardSummary
43                 
44         def markDone(self):
45                 pass
46         
47         def listInputChannels(self):
48                 list = []
49
50                 for port in self.hw.getPortList():
51                         list.append((port, port))
52                 return list
53
54         def inputSelectionMade(self, index):
55                 print "inputSelectionMade:", index
56                 self.port = index
57                 
58         def inputSelectionMoved(self):
59                 print "selection moved:", self.selection
60                 
61         def listModes(self):
62                 list = []
63                 print "modes for port", self.port
64                 for mode in self.hw.getModeList(self.port):
65                         list.append((mode[0], mode[0]))
66                 return list
67         
68         def modeSelectionMade(self, index):
69                 print "modeSelectionMade:", index
70                 self.mode = index
71                 
72         def modeSelectionMoved(self):
73                 print "selection moved:", self.selection
74                 
75         def listRates(self):
76                 list = []
77                 print "modes for port", self.port
78                 for mode in self.hw.getModeList(self.port):
79                         print mode
80                         if mode[0] == self.mode:
81                                 for rate in mode[1]:
82                                         list.append((rate, rate))
83                 return list
84         
85         def rateSelectionMade(self, index):
86                 print "rateSelectionMade:", index
87                 
88         def rateSelectionMoved(self):
89                 print "selection moved:", self.selection