1 from Screens.Wizard import WizardSummary
2 from Screens.WizardLanguage import WizardLanguage
3 from Screens.Rc import Rc
4 from VideoHardware import video_hw
6 from Components.Pixmap import Pixmap, MovingPixmap, MultiPixmap
7 from Components.config import config, ConfigBoolean, configfile
9 from Tools.Directories import resolveFilename, SCOPE_PLUGINS
11 config.misc.showtestcard = ConfigBoolean(default = False)
13 class VideoWizardSummary(WizardSummary):
15 <screen position="0,0" size="132,64">
16 <widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" />
17 <widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14">
18 <convert type="StringListSelection" />
20 <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
21 </screen>""" #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png"))
23 def __init__(self, session, parent):
24 WizardSummary.__init__(self, session, parent)
25 #self["pic"] = Pixmap()
27 def setLCDPicCallback(self):
28 self.parent.setLCDTextCallback(self.setText)
30 def setLCDPic(self, file):
31 self["pic"].instance.setPixmapFromFile(file)
33 class VideoWizard(WizardLanguage, Rc):
35 <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
36 <widget name="text" position="153,50" size="340,270" font="Regular;23" />
37 <widget source="list" render="Listbox" position="200,300" size="290,200" scrollbarMode="showOnDemand" >
38 <convert type="StringList" />
40 <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
41 <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
42 <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
43 <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
44 <widget name="portpic" pixmap="%s" position="50,300" zPosition="10" size="150,150" transparent="1" alphatest="on"/>
45 <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" transparent="1" alphatest="on"/>
46 <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
47 <widget name="arrowdown2" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
48 <widget name="arrowup" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
49 <widget name="arrowup2" pixmap="skin_default/arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
50 </screen>""" % (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/Scart.png"))
52 def __init__(self, session):
53 # FIXME anyone knows how to use relative paths from the plugin's directory?
54 self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/videowizard.xml")
57 WizardLanguage.__init__(self, session, showSteps = False, showStepSlider = False)
59 self["wizard"] = Pixmap()
60 self["portpic"] = Pixmap()
67 def createSummary(self):
68 print "++++++++++++***++**** VideoWizard-createSummary"
69 from Screens.Wizard import WizardSummary
70 return VideoWizardSummary
73 config.misc.videowizardenabled.value = 0
74 config.misc.videowizardenabled.save()
77 def listInputChannels(self):
80 for port in self.hw.getPortList():
81 if self.hw.isPortUsed(port):
82 list.append((port,port))
83 list.sort(key = lambda x: x[0])
84 print "listInputChannels:", list
87 def inputSelectionMade(self, index):
88 print "inputSelectionMade:", index
90 self.inputSelect(index)
92 def inputSelectionMoved(self):
93 print "input selection moved:", self.selection
94 self.inputSelect(self.selection)
95 if self["portpic"].instance is not None:
96 self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png"))
98 def inputSelect(self, port):
99 print "inputSelect:", port
100 modeList = self.hw.getModeList(self.selection)
101 print "modeList:", modeList
103 ratesList = self.listRates(modeList[0][0])
104 self.hw.setMode(port = port, mode = modeList[0][0], rate = ratesList[0][0])
108 print "modes for port", self.port
109 for mode in self.hw.getModeList(self.port):
111 list.append((mode[0], mode[0]))
112 print "modeslist:", list
115 def modeSelectionMade(self, index):
116 print "modeSelectionMade:", index
118 self.modeSelect(index)
120 def modeSelectionMoved(self):
121 print "mode selection moved:", self.selection
122 self.modeSelect(self.selection)
124 def modeSelect(self, mode):
125 ratesList = self.listRates(mode)
126 print "ratesList:", ratesList
127 self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
129 def listRates(self, querymode = None):
130 if querymode is None:
131 querymode = self.mode
133 print "modes for port", self.port, "and mode", querymode
134 for mode in self.hw.getModeList(self.port):
136 if mode[0] == querymode:
138 if self.port == "DVI-PC":
140 if rate == "640x480":
141 list.insert(0, (rate, rate))
143 list.append((rate, rate))
146 def rateSelectionMade(self, index):
147 print "rateSelectionMade:", index
149 self.rateSelect(index)
151 def rateSelectionMoved(self):
152 print "rate selection moved:", self.selection
153 self.rateSelect(self.selection)
155 def rateSelect(self, rate):
156 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
158 def showTestCard(self, selection = None):
159 if selection is None:
160 selection = self.selection
161 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
162 if selection == "yes":
163 config.misc.showtestcard.value = True
165 config.misc.showtestcard.value = False
167 def keyNumberGlobal(self, number):
168 if number in [1,2,3]:
170 self.hw.saveMode("DVI", "720p", "multi")
172 self.hw.saveMode("DVI", "1080i", "multi")
174 self.hw.saveMode("Scart", "Multi", "multi")
175 self.hw.setConfiguredMode()
178 WizardLanguage.keyNumberGlobal(self, number)