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 ratesList = self.listRates(modeList[0][0])
109 self.hw.setMode(port = port, mode = modeList[0][0], rate = ratesList[0][0])
113 print "modes for port", self.port
114 for mode in self.hw.getModeList(self.port):
116 list.append((mode[0], mode[0]))
117 print "modeslist:", list
120 def modeSelectionMade(self, index):
121 print "modeSelectionMade:", index
123 self.modeSelect(index)
125 def modeSelectionMoved(self):
126 print "mode selection moved:", self.selection
127 self.modeSelect(self.selection)
129 def modeSelect(self, mode):
130 ratesList = self.listRates(mode)
131 print "ratesList:", ratesList
132 self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
134 def listRates(self, querymode = None):
135 if querymode is None:
136 querymode = self.mode
138 print "modes for port", self.port, "and mode", querymode
139 for mode in self.hw.getModeList(self.port):
141 if mode[0] == querymode:
143 if self.port == "DVI-PC":
145 if rate == "640x480":
146 list.insert(0, (rate, rate))
148 list.append((rate, rate))
151 def rateSelectionMade(self, index):
152 print "rateSelectionMade:", index
154 self.rateSelect(index)
156 def rateSelectionMoved(self):
157 print "rate selection moved:", self.selection
158 self.rateSelect(self.selection)
160 def rateSelect(self, rate):
161 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
163 def showTestCard(self, selection = None):
164 if selection is None:
165 selection = self.selection
166 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
167 if selection == "yes":
168 config.misc.showtestcard.value = True
170 config.misc.showtestcard.value = False
172 def keyNumberGlobal(self, number):
173 if number in (1,2,3):
175 self.hw.saveMode("DVI", "720p", "multi")
177 self.hw.saveMode("DVI", "1080i", "multi")
179 self.hw.saveMode("Scart", "Multi", "multi")
180 self.hw.setConfiguredMode()
183 WizardLanguage.keyNumberGlobal(self, number)