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="wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
44 <ePixmap pixmap="skin_default/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="rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
48 <widget name="arrowdown" pixmap="arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
49 <widget name="arrowup" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
50 <widget name="arrowup2" pixmap="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
79 def listInputChannels(self):
82 for port in self.hw.getPortList():
83 if self.hw.isPortUsed(port):
84 list.append((port,port))
85 list.sort(key = lambda x: x[0])
86 print "listInputChannels:", list
89 def inputSelectionMade(self, index):
90 print "inputSelectionMade:", index
92 self.inputSelect(index)
94 def inputSelectionMoved(self):
95 print "input selection moved:", self.selection
96 self.inputSelect(self.selection)
97 if self["portpic"].instance is not None:
98 self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png"))
100 def inputSelect(self, port):
101 print "inputSelect:", port
102 modeList = self.hw.getModeList(self.selection)
103 print "modeList:", modeList
104 self.hw.setMode(port = port, mode = modeList[0][0], rate = modeList[0][1][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 list.append((rate, rate))
141 def rateSelectionMade(self, index):
142 print "rateSelectionMade:", index
144 self.rateSelect(index)
146 def rateSelectionMoved(self):
147 print "rate selection moved:", self.selection
148 self.rateSelect(self.selection)
150 def rateSelect(self, rate):
151 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
153 def showTestCard(self, selection = None):
154 if selection is None:
155 selection = self.selection
156 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
157 if selection == "yes":
158 config.misc.showtestcard.value = True
160 config.misc.showtestcard.value = False
162 def keyNumberGlobal(self, number):
163 if number in [1,2,3]:
165 self.hw.saveMode("DVI", "720p", "multi")
167 self.hw.saveMode("DVI", "1080i", "multi")
169 self.hw.saveMode("Scart", "Multi", "multi")
170 self.hw.setConfiguredMode()
173 WizardLanguage.keyNumberGlobal(self, number)