1 from Screens.Wizard import wizardManager, WizardSummary
2 from Screens.WizardLanguage import WizardLanguage
4 from VideoHardware import video_hw
6 from Components.Pixmap import Pixmap, MovingPixmap
7 from Components.config import config, ConfigBoolean, configfile
9 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
10 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
11 from Tools.LoadPixmap import LoadPixmap
13 config.misc.showtestcard = ConfigBoolean(default = False)
15 class VideoWizardSummary(WizardSummary):
17 <screen position="0,0" size="132,64">
18 <widget name="text" position="6,4" size="120,42" font="Regular;14" transparent="1" />
19 <widget source="parent.list" render="Label" position="6,25" size="120,21" font="Regular;16">
20 <convert type="StringListSelection" />
22 <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
23 </screen>""" #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png"))
25 def __init__(self, session, parent):
26 WizardSummary.__init__(self, session, parent)
27 #self["pic"] = Pixmap()
29 def setLCDPicCallback(self):
30 self.parent.setLCDTextCallback(self.setText)
32 def setLCDPic(self, file):
33 self["pic"].instance.setPixmapFromFile(file)
35 class VideoWizard(WizardLanguage):
37 <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
38 <widget name="text" position="153,50" size="340,270" font="Regular;23" />
39 <widget source="list" render="Listbox" position="200,300" size="290,200" scrollbarMode="showOnDemand" >
40 <convert type="StringList" />
42 <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
43 <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
44 <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
45 <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
46 <widget name="portpic" pixmap="%s" position="50,300" zPosition="10" size="150,150" transparent="1" alphatest="on"/>
47 <widget name="rc" pixmap="skin_default/rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
48 <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
49 <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
50 <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
51 </screen>""" % (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/Scart.png"))
53 def __init__(self, session):
54 # FIXME anyone knows how to use relative paths from the plugin's directory?
55 self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/videowizard.xml")
58 WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
59 self["wizard"] = Pixmap()
60 self["rc"] = MovingPixmap()
61 self["portpic"] = Pixmap()
62 self["arrowdown"] = MovingPixmap()
63 self["arrowup"] = MovingPixmap()
64 self["arrowup2"] = MovingPixmap()
71 def createSummary(self):
72 print "++++++++++++***++**** VideoWizard-createSummary"
73 from Screens.Wizard import WizardSummary
74 return VideoWizardSummary
77 config.misc.videowizardenabled.value = 0
78 config.misc.videowizardenabled.save()
81 def listInputChannels(self):
84 for port in self.hw.getPortList():
85 if self.hw.isPortUsed(port):
86 list.append((port,port))
87 list.sort(key = lambda x: x[0])
88 print "listInputChannels:", list
91 def inputSelectionMade(self, index):
92 print "inputSelectionMade:", index
94 self.inputSelect(index)
96 def inputSelectionMoved(self):
97 print "input selection moved:", self.selection
98 self.inputSelect(self.selection)
99 if self["portpic"].instance is not None:
100 self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png"))
102 def inputSelect(self, port):
103 print "inputSelect:", port
104 modeList = self.hw.getModeList(self.selection)
105 print "modeList:", modeList
106 self.hw.setMode(port = port, mode = modeList[0][0], rate = modeList[0][1][0])
110 print "modes for port", self.port
111 for mode in self.hw.getModeList(self.port):
113 list.append((mode[0], mode[0]))
114 print "modeslist:", list
117 def modeSelectionMade(self, index):
118 print "modeSelectionMade:", index
120 self.modeSelect(index)
122 def modeSelectionMoved(self):
123 print "mode selection moved:", self.selection
124 self.modeSelect(self.selection)
126 def modeSelect(self, mode):
127 ratesList = self.listRates(mode)
128 print "ratesList:", ratesList
129 self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
131 def listRates(self, querymode = None):
132 if querymode is None:
133 querymode = self.mode
135 print "modes for port", self.port, "and mode", querymode
136 for mode in self.hw.getModeList(self.port):
138 if mode[0] == querymode:
140 list.append((rate, rate))
143 def rateSelectionMade(self, index):
144 print "rateSelectionMade:", index
146 self.rateSelect(index)
148 def rateSelectionMoved(self):
149 print "rate selection moved:", self.selection
150 self.rateSelect(self.selection)
152 def rateSelect(self, rate):
153 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
155 def showTestCard(self, selection = None):
156 if selection is None:
157 selection = self.selection
158 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
159 if selection == "yes":
160 config.misc.showtestcard.value = True
162 config.misc.showtestcard.value = False
164 def keyNumberGlobal(self, number):
165 if number in [1,2,3]:
167 self.hw.saveMode("DVI", "720p", "multi")
169 self.hw.saveMode("DVI", "1080i", "multi")
171 self.hw.saveMode("Scart", "Multi", "multi")
172 self.hw.setConfiguredMode()
175 WizardLanguage.keyNumberGlobal(self, number)