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
10 from Tools.HardwareInfo import HardwareInfo
12 config.misc.showtestcard = ConfigBoolean(default = False)
14 class VideoWizardSummary(WizardSummary):
16 <screen position="0,0" size="132,64">
17 <widget name="text" position="6,4" size="120,40" font="Regular;12" transparent="1" />
18 <widget source="parent.list" render="Label" position="6,40" size="120,21" font="Regular;14">
19 <convert type="StringListSelection" />
21 <!--widget name="pic" pixmap="%s" position="6,22" zPosition="10" size="64,64" transparent="1" alphatest="on"/-->
22 </screen>""" #% (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/lcd_Scart.png"))
24 def __init__(self, session, parent):
25 WizardSummary.__init__(self, session, parent)
26 #self["pic"] = Pixmap()
28 def setLCDPicCallback(self):
29 self.parent.setLCDTextCallback(self.setText)
31 def setLCDPic(self, file):
32 self["pic"].instance.setPixmapFromFile(file)
34 class VideoWizard(WizardLanguage, Rc):
36 <screen position="0,0" size="720,576" title="Welcome..." flags="wfNoBorder" >
37 <widget name="text" position="153,50" size="340,270" font="Regular;23" />
38 <widget source="list" render="Listbox" position="200,300" size="290,200" scrollbarMode="showOnDemand" >
39 <convert type="StringList" />
41 <widget name="config" position="50,300" zPosition="1" size="440,200" transparent="1" scrollbarMode="showOnDemand" />
42 <widget name="wizard" pixmap="skin_default/wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
43 <ePixmap pixmap="skin_default/buttons/button_red.png" position="40,225" zPosition="0" size="15,16" transparent="1" alphatest="on" />
44 <widget name="languagetext" position="55,225" size="95,30" font="Regular;18" />
45 <widget name="portpic" pixmap="%s" position="50,300" zPosition="10" size="150,150" transparent="1" alphatest="on"/>
46 <widget name="rc" pixmaps="skin_default/rc.png,skin_default/rcold.png" position="500,50" zPosition="10" size="154,500" transparent="1" alphatest="on"/>
47 <widget name="arrowdown" pixmap="skin_default/arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
48 <widget name="arrowdown2" 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)
60 self["wizard"] = Pixmap()
61 self["portpic"] = Pixmap()
68 def createSummary(self):
69 print "++++++++++++***++**** VideoWizard-createSummary"
70 from Screens.Wizard import WizardSummary
71 return VideoWizardSummary
74 config.misc.videowizardenabled.value = 0
75 config.misc.videowizardenabled.save()
78 def listInputChannels(self):
79 hw_type = HardwareInfo().get_device_name()
82 for port in self.hw.getPortList():
83 if self.hw.isPortUsed(port):
85 if descr == 'DVI' and hw_type == 'dm500hd':
87 list.append((descr,port))
88 list.sort(key = lambda x: x[0])
89 print "listInputChannels:", list
92 def inputSelectionMade(self, index):
93 print "inputSelectionMade:", index
95 self.inputSelect(index)
97 def inputSelectionMoved(self):
98 print "input selection moved:", self.selection
99 self.inputSelect(self.selection)
100 if self["portpic"].instance is not None:
101 self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png"))
103 def inputSelect(self, port):
104 print "inputSelect:", port
105 modeList = self.hw.getModeList(self.selection)
106 print "modeList:", modeList
108 if (len(modeList) > 0):
109 ratesList = self.listRates(modeList[0][0])
110 self.hw.setMode(port = port, mode = modeList[0][0], rate = ratesList[0][0])
114 print "modes for port", self.port
115 for mode in self.hw.getModeList(self.port):
117 list.append((mode[0], mode[0]))
118 print "modeslist:", list
121 def modeSelectionMade(self, index):
122 print "modeSelectionMade:", index
124 self.modeSelect(index)
126 def modeSelectionMoved(self):
127 print "mode selection moved:", self.selection
128 self.modeSelect(self.selection)
130 def modeSelect(self, mode):
131 ratesList = self.listRates(mode)
132 print "ratesList:", ratesList
133 self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
135 def listRates(self, querymode = None):
136 if querymode is None:
137 querymode = self.mode
139 print "modes for port", self.port, "and mode", querymode
140 for mode in self.hw.getModeList(self.port):
142 if mode[0] == querymode:
144 if self.port == "DVI-PC":
146 if rate == "640x480":
147 list.insert(0, (rate, rate))
149 list.append((rate, rate))
152 def rateSelectionMade(self, index):
153 print "rateSelectionMade:", index
155 self.rateSelect(index)
157 def rateSelectionMoved(self):
158 print "rate selection moved:", self.selection
159 self.rateSelect(self.selection)
161 def rateSelect(self, rate):
162 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
164 def showTestCard(self, selection = None):
165 if selection is None:
166 selection = self.selection
167 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
168 if selection == "yes":
169 config.misc.showtestcard.value = True
171 config.misc.showtestcard.value = False
173 def keyNumberGlobal(self, number):
174 if number in (1,2,3):
176 self.hw.saveMode("DVI", "720p", "multi")
178 self.hw.saveMode("DVI", "1080i", "multi")
180 self.hw.saveMode("Scart", "Multi", "multi")
181 self.hw.setConfiguredMode()
184 WizardLanguage.keyNumberGlobal(self, number)