From 67858ed10ece500b2cf68dafb39886a0b873ec4c Mon Sep 17 00:00:00 2001 From: thedoc Date: Mon, 7 Dec 2009 22:38:20 +0100 Subject: first working version of TempFanControl plugin with Sensors and FanControl component --- .../SystemPlugins/TempFanControl/Makefile.am | 5 ++ .../SystemPlugins/TempFanControl/__init__.py | 0 .../Plugins/SystemPlugins/TempFanControl/plugin.py | 62 ++++++++++++++++++++++ 3 files changed, 67 insertions(+) create mode 100644 lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am create mode 100644 lib/python/Plugins/SystemPlugins/TempFanControl/__init__.py create mode 100644 lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py (limited to 'lib/python/Plugins/SystemPlugins/TempFanControl') diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am new file mode 100644 index 00000000..78ff11c3 --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/Makefile.am @@ -0,0 +1,5 @@ +installdir = $(LIBDIR)/enigma2/python/Plugins/SystemPlugins/TempFanControl + +install_PYTHON = \ + __init__.py \ + plugin.py diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/__init__.py b/lib/python/Plugins/SystemPlugins/TempFanControl/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py new file mode 100644 index 00000000..60af03cb --- /dev/null +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -0,0 +1,62 @@ +from Components.ActionMap import ActionMap +from Components.Sensors import sensors +from Components.Sources.Sensor import SensorSource +from Components.ConfigList import ConfigListScreen +from Components.config import getConfigListEntry + +from Screens.Screen import Screen + +from Plugins.Plugin import PluginDescriptor +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) + + 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)) + ConfigListScreen.__init__(self, self.list, session = self.session) + #self["config"].list = self.list + #self["config"].setList(self.list) + + self["actions"] = ActionMap(["OkCancelActions"], + { + "ok": self.save, + "cancel": self.revert + }, -1) + + def save(self): + fancontrol.getConfig(0).vlt.save() + fancontrol.getConfig(0).pwm.save() + self.close() + + def revert(self): + fancontrol.getConfig(0).vlt.load() + fancontrol.getConfig(0).pwm.load() + self.close() + +def main(session, **kwargs): + session.open(TempFanControl) + +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 -- cgit v1.2.3