1 from Screens.Screen import Screen
2 from Components.ConfigList import ConfigListScreen
3 from Components.config import config, getConfigListEntry, ConfigSubsection, ConfigSelection, ConfigInteger
4 from Components.ActionMap import ActionMap,NumberActionMap
5 from Screens.MessageBox import MessageBox
6 from Components.Sources.StaticText import StaticText
7 from Plugins.Plugin import PluginDescriptor
8 from Plugins.SystemPlugins.ManualFancontrol.InstandbyOn import instandbyon
10 class ManualFancontrol(Screen,ConfigListScreen):
12 <screen name="ManualFancontrol" position="center,center" size="560,300" title="Fancontrol Settings in Standby mode" >
13 <ePixmap pixmap="Vu_HD/buttons/red.png" position="10,10" size="25,25" alphatest="on" />
14 <ePixmap pixmap="Vu_HD/buttons/green.png" position="290,10" size="25,25" alphatest="on" />
15 <widget source="key_red" render="Label" position="40,10" zPosition="1" size="140,25" font="Regular;20" halign="center" valign="center" transparent="1" />
16 <widget source="key_green" render="Label" position="320,10" zPosition="1" size="140,25" font="Regular;20" halign="center" valign="center" transparent="1" />
17 <widget name="config" zPosition="2" position="5,50" size="550,200" scrollbarMode="showOnDemand" transparent="1" />
18 <widget source="current" render="Label" position="150,270" zPosition="1" size="280,30" font="Regular;20" halign="center" valign="center" transparent="1" />
21 def __init__(self,session):
22 Screen.__init__(self,session)
24 self.setup_title="TestSetupTitle"
25 self.session = session
26 self["shortcuts"] = ActionMap(["ShortcutActions", "SetupActions" ],
29 "cancel": self.keyCancel,
30 "red": self.keyCancel,
31 "green": self.keySave,
34 ConfigListScreen.__init__(self, self.list,session = self.session)
35 self["key_red"] = StaticText(_("Cancel"))
36 self["key_green"] = StaticText(_("Save"))
37 self["current"] = StaticText(_(" "))
40 def displayCurrentValue(self):
41 cur = self["config"].getCurrent()[0]
42 val = self["config"].getCurrent()[1].value
43 currrent_val = cur+" : "+str(val)
44 self["current"].setText(_(currrent_val))
47 def selectionChanged(self):
48 self.displayCurrentValue()
49 if self["config"].getCurrent() == self.pwmEntry:
50 instandbyon.setPWM(self["config"].getCurrent()[1].value)
53 ConfigListScreen.keyLeft(self)
55 self.selectionChanged()
58 ConfigListScreen.keyRight(self)
60 self.selectionChanged()
62 def createSetup(self):
64 self.standbyEntry = getConfigListEntry(_("FanOFF InStanby"), config.plugins.simplefancontrols.standbymode)
65 self.pwmEntry = getConfigListEntry(_("PWM value"), config.plugins.simplefancontrols.pwmvalue)
66 self.list.append( self.standbyEntry )
67 self.list.append( self.pwmEntry )
68 self["config"].list = self.list
69 self["config"].l.setList(self.list)
70 if not self.displayCurrentValue in self["config"].onSelectionChanged:
71 self["config"].onSelectionChanged.append(self.displayCurrentValue)
74 if self["config"].getCurrent() == self.standbyEntry:
78 ConfigListScreen.keySave(self)
81 ConfigListScreen.keyCancel(self)
83 def main(session, **kwargs):
84 session.open(ManualFancontrol)
86 def Plugins(**kwargs):
87 return [PluginDescriptor(name=_("Manual Fan control"), description="setup Fancontol inStandby mode", where = PluginDescriptor.WHERE_PLUGINMENU, needsRestart = True, fnc=main)]