X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FPlugins%2FSystemPlugins%2FTempFanControl%2Fplugin.py;h=48f871f95048782ca1ae7807a53396f1f8642bd9;hp=60af03cb6b03bcc102bcb62d4afbec252f7cdb74;hb=e1cd84473da2da0d23f4cea1d4143f17a8fb5a2c;hpb=67858ed10ece500b2cf68dafb39886a0b873ec4c diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 60af03c..48f871f 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -1,6 +1,7 @@ from Components.ActionMap import ActionMap from Components.Sensors import sensors from Components.Sources.Sensor import SensorSource +from Components.Sources.StaticText import StaticText from Components.ConfigList import ConfigListScreen from Components.config import getConfigListEntry @@ -11,52 +12,159 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - - - + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - """ - + def __init__(self, session, args = None): Screen.__init__(self, session) - id = sensors.getSensorsList(sensors.TYPE_TEMPERATURE)[0] - self["SensorTemp"] = SensorSource(sensorid = id) - id = sensors.getSensorsList(sensors.TYPE_FAN_RPM)[0] - self["SensorFan"] = SensorSource(sensorid = id, update_interval = 100) + templist = sensors.getSensorsList(sensors.TYPE_TEMPERATURE) + tempcount = len(templist) + fanlist = sensors.getSensorsList(sensors.TYPE_FAN_RPM) + fancount = len(fanlist) + + self["red"] = StaticText(_("Cancel")) + self["green"] = StaticText(_("OK")) + self["yellow"] = StaticText("") + self["blue"] = StaticText("") + + for count in range(8): + if count < tempcount: + id = templist[count] + self["SensorTempText%d" % count] = StaticText(sensors.getSensorName(id)) + self["SensorTemp%d" % count] = SensorSource(sensorid = id) + else: + self["SensorTempText%d" % count] = StaticText("") + self["SensorTemp%d" % count] = SensorSource() + + if count < fancount: + id = fanlist[count] + self["SensorFanText%d" % count] = StaticText(sensors.getSensorName(id)) + self["SensorFan%d" % count] = SensorSource(sensorid = id) + else: + self["SensorFanText%d" % count] = StaticText("") + self["SensorFan%d" % count] = SensorSource() self.list = [] - if fancontrol.getFanCount() > 0: - self.list.append(getConfigListEntry(_("Fan Voltage"), fancontrol.getConfig(0).vlt)) - self.list.append(getConfigListEntry(_("Fan PWM"), fancontrol.getConfig(0).pwm)) + for count in range(fancontrol.getFanCount()): + self.list.append(getConfigListEntry(_("Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt)) + self.list.append(getConfigListEntry(_("Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm)) + self.list.append(getConfigListEntry(_("Standby Fan %d Voltage") % (count + 1), fancontrol.getConfig(count).vlt_standby)) + self.list.append(getConfigListEntry(_("Standby Fan %d PWM") % (count + 1), fancontrol.getConfig(count).pwm_standby)) + ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) + self["config"].l.setSeperation(300) - self["actions"] = ActionMap(["OkCancelActions"], + self["actions"] = ActionMap(["OkCancelActions", "ColorActions"], { "ok": self.save, - "cancel": self.revert + "cancel": self.revert, + "red": self.revert, + "green": self.save }, -1) - + def save(self): - fancontrol.getConfig(0).vlt.save() - fancontrol.getConfig(0).pwm.save() + for count in range(fancontrol.getFanCount()): + fancontrol.getConfig(count).vlt.save() + fancontrol.getConfig(count).pwm.save() + fancontrol.getConfig(count).vlt_standby.save() + fancontrol.getConfig(count).pwm_standby.save() self.close() - + def revert(self): - fancontrol.getConfig(0).vlt.load() - fancontrol.getConfig(0).pwm.load() + for count in range(fancontrol.getFanCount()): + fancontrol.getConfig(count).vlt.load() + fancontrol.getConfig(count).pwm.load() + fancontrol.getConfig(count).vlt_standby.load() + fancontrol.getConfig(count).pwm_standby.load() self.close() def main(session, **kwargs): session.open(TempFanControl) +def startMenu(menuid): + if menuid != "system": + return [] + return [(_("Temperature and Fan control"), main, "tempfancontrol", 80)] + def Plugins(**kwargs): - return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_EXTENSIONSMENU, fnc = main) - \ No newline at end of file + return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_MENU, needsRestart = False, fnc = startMenu) +