1 from Screens.Wizard import Wizard, wizardManager, WizardSummary
3 from VideoHardware import video_hw
5 from Components.Pixmap import Pixmap, MovingPixmap
6 from Components.config import config, ConfigBoolean, configfile
8 from Tools.Directories import resolveFilename, SCOPE_PLUGINS, SCOPE_SKIN_IMAGE
9 from enigma import eListboxPythonMultiContent, gFont, RT_HALIGN_LEFT
10 from Tools.LoadPixmap import LoadPixmap
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,42" font="Regular;14" transparent="1" />
18 <widget source="parent.list" render="Label" position="6,25" size="120,21" font="Regular;16">
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(Wizard):
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="wizard.png" position="40,50" zPosition="10" size="110,174" transparent="1" alphatest="on"/>
43 <widget name="portpic" pixmap="%s" position="50,300" zPosition="10" size="150,150" transparent="1" alphatest="on"/>
44 <widget name="rc" pixmap="rc.png" position="500,600" zPosition="10" size="154,475" transparent="1" alphatest="on"/>
45 <widget name="arrowdown" pixmap="arrowdown.png" position="0,0" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
46 <widget name="arrowup" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
47 <widget name="arrowup2" pixmap="arrowup.png" position="-100,-100" zPosition="11" size="37,70" transparent="1" alphatest="on"/>
48 </screen>""" % (resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/Scart.png"))
50 def __init__(self, session):
51 # FIXME anyone knows how to use relative paths from the plugin's directory?
52 self.xmlfile = resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/videowizard.xml")
55 Wizard.__init__(self, session, showSteps = False, showStepSlider = False)
56 self["wizard"] = Pixmap()
57 self["rc"] = MovingPixmap()
58 self["portpic"] = Pixmap()
59 self["arrowdown"] = MovingPixmap()
60 self["arrowup"] = MovingPixmap()
61 self["arrowup2"] = MovingPixmap()
68 def createSummary(self):
69 print "++++++++++++***++**** VideoWizard-createSummary"
70 from Screens.Wizard import WizardSummary
71 return VideoWizardSummary
76 def listInputChannels(self):
79 for port in self.hw.getPortList():
80 if self.hw.isPortUsed(port):
81 list.append((port,port))
82 list.sort(key = lambda x: x[0])
83 print "listInputChannels:", list
86 def inputSelectionMade(self, index):
87 print "inputSelectionMade:", index
89 self.inputSelect(index)
91 def inputSelectionMoved(self):
92 print "input selection moved:", self.selection
93 self.inputSelect(self.selection)
94 if self["portpic"].instance is not None:
95 self["portpic"].instance.setPixmapFromFile(resolveFilename(SCOPE_PLUGINS, "SystemPlugins/Videomode/" + self.selection + ".png"))
97 def inputSelect(self, port):
98 print "inputSelect:", port
99 modeList = self.hw.getModeList(self.selection)
100 print "modeList:", modeList
101 self.hw.setMode(port = port, mode = modeList[0][0], rate = modeList[0][1][0])
105 print "modes for port", self.port
106 for mode in self.hw.getModeList(self.port):
108 list.append((mode[0], mode[0]))
109 print "modeslist:", list
112 def modeSelectionMade(self, index):
113 print "modeSelectionMade:", index
115 self.modeSelect(index)
117 def modeSelectionMoved(self):
118 print "mode selection moved:", self.selection
119 self.modeSelect(self.selection)
121 def modeSelect(self, mode):
122 ratesList = self.listRates(mode)
123 print "ratesList:", ratesList
124 self.hw.setMode(port = self.port, mode = mode, rate = ratesList[0][0])
126 def listRates(self, querymode = None):
127 if querymode is None:
128 querymode = self.mode
130 print "modes for port", self.port, "and mode", querymode
131 for mode in self.hw.getModeList(self.port):
133 if mode[0] == querymode:
135 list.append((rate, rate))
138 def rateSelectionMade(self, index):
139 print "rateSelectionMade:", index
141 self.rateSelect(index)
143 def rateSelectionMoved(self):
144 print "rate selection moved:", self.selection
145 self.rateSelect(self.selection)
147 def rateSelect(self, rate):
148 self.hw.setMode(port = self.port, mode = self.mode, rate = rate)
150 def showTestCard(self, selection = None):
151 if selection is None:
152 selection = self.selection
153 print "set config.misc.showtestcard to", {'yes': True, 'no': False}[selection]
154 if selection == "yes":
155 config.misc.showtestcard.value = True
157 config.misc.showtestcard.value = False