X-Git-Url: https://git.cweiske.de/enigma2.git/blobdiff_plain/67858ed10ece500b2cf68dafb39886a0b873ec4c..43f543871592eda0489f6dcbf3ad901309aaa9f9:/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 60af03cb..c8af9cdd 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,158 @@ 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["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, fnc = startMenu) +