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 --- configure.ac | 1 + lib/python/Components/Converter/Makefile.am | 2 +- lib/python/Components/Converter/SensorToText.py | 12 ++++ lib/python/Components/FanControl.py | 76 ++++++++++++++++++++++ lib/python/Components/Makefile.am | 2 +- lib/python/Components/Sensors.py | 72 ++++++++++++++++++++ lib/python/Components/Sources/Makefile.am | 2 +- lib/python/Components/Sources/Sensor.py | 27 ++++++++ lib/python/Plugins/SystemPlugins/Makefile.am | 3 +- .../SystemPlugins/TempFanControl/Makefile.am | 5 ++ .../SystemPlugins/TempFanControl/__init__.py | 0 .../Plugins/SystemPlugins/TempFanControl/plugin.py | 62 ++++++++++++++++++ 12 files changed, 260 insertions(+), 4 deletions(-) create mode 100644 lib/python/Components/Converter/SensorToText.py create mode 100644 lib/python/Components/FanControl.py create mode 100644 lib/python/Components/Sensors.py create mode 100644 lib/python/Components/Sources/Sensor.py 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 diff --git a/configure.ac b/configure.ac index 5e403deb..18801002 100755 --- a/configure.ac +++ b/configure.ac @@ -155,6 +155,7 @@ lib/python/Plugins/SystemPlugins/FrontprocessorUpgrade/meta/Makefile lib/python/Plugins/SystemPlugins/Hotplug/Makefile lib/python/Plugins/SystemPlugins/Hotplug/meta/Makefile lib/python/Plugins/SystemPlugins/Makefile +lib/python/Plugins/SystemPlugins/TempFanControl/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/Makefile lib/python/Plugins/SystemPlugins/NetworkWizard/meta/Makefile lib/python/Plugins/SystemPlugins/NFIFlash/Makefile diff --git a/lib/python/Components/Converter/Makefile.am b/lib/python/Components/Converter/Makefile.am index 75c8a08e..3b6fd3e8 100644 --- a/lib/python/Components/Converter/Makefile.am +++ b/lib/python/Components/Converter/Makefile.am @@ -6,4 +6,4 @@ install_PYTHON = \ ConditionalShowHide.py ServicePosition.py ValueRange.py RdsInfo.py Streaming.py \ StaticMultiList.py ServiceTime.py MovieInfo.py MenuEntryCompare.py StringListSelection.py \ ValueBitTest.py TunerInfo.py ConfigEntryTest.py TemplatedMultiContent.py ProgressToText.py \ - Combine.py + Combine.py SensorToText.py diff --git a/lib/python/Components/Converter/SensorToText.py b/lib/python/Components/Converter/SensorToText.py new file mode 100644 index 00000000..ab87ee2e --- /dev/null +++ b/lib/python/Components/Converter/SensorToText.py @@ -0,0 +1,12 @@ +from Components.Converter.Converter import Converter + +class SensorToText(Converter, object): + def __init__(self, arguments): + Converter.__init__(self, arguments) + + def getText(self): + return "%d %s" % (self.source.getValue(), self.source.getUnit()) + + text = property(getText) + + \ No newline at end of file diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py new file mode 100644 index 00000000..d7986c25 --- /dev/null +++ b/lib/python/Components/FanControl.py @@ -0,0 +1,76 @@ +import os + +from Components.config import config, ConfigSubList, ConfigSubsection, ConfigSlider +from Tools.BoundFunction import boundFunction + +class FanControl: + # ATM there's only support for one fan + def __init__(self): + if os.path.exists("/proc/stb/fp/fan_vlt") or os.path.exists("/proc/stb/fp/fan_pwm") or os.path.exists("/proc/stb/fp/fan_speed"): + self.fancount = 1 + else: + self.fancount = 0 + self.createConfig() + + def createConfig(self): + def setVlt(fancontrol, fanid, configElement): + fancontrol.setVoltage(fanid, configElement.value) + def setPWM(fancontrol, fanid, configElement): + fancontrol.setPWM(fanid, configElement.value) + + config.fans = ConfigSubList() + for fanid in range(self.getFanCount()): + default_vlt = self.getVoltage(fanid) + default_pwm = self.getPWM(fanid) + fan = ConfigSubsection() + fan.vlt = ConfigSlider(default = default_vlt, increment = 10, limits = (0, 255)) + fan.pwm = ConfigSlider(default = default_vlt, increment = 10, limits = (0, 255)) + fan.vlt.addNotifier(boundFunction(setVlt, self, fanid)) + fan.pwm.addNotifier(boundFunction(setPWM, self, fanid)) + config.fans.append(fan) + + def getConfig(self, fanid): + return config.fans[fanid] + + def getFanCount(self): + return self.fancount + + def hasRPMSensor(self, fanid): + return os.path.exists("/proc/stb/fp/fan_speed") + + def hasFanControl(self, fanid): + return os.path.exists("/proc/stb/fp/fan_vlt") or os.path.exists("/proc/stb/fp/fan_pwm") + + def getFanSpeed(self, fanid): + f = open("/proc/stb/fp/fan_speed", "r") + value = int(f.readline().strip()[:-4]) + f.close() + return value + + def getVoltage(self, fanid): + f = open("/proc/stb/fp/fan_vlt", "r") + value = int(f.readline().strip(), 16) + f.close() + return value + + def setVoltage(self, fanid, value): + if value > 255: + return + f = open("/proc/stb/fp/fan_vlt", "w") + f.write("%x" % value) + f.close() + + def getPWM(self, fanid): + f = open("/proc/stb/fp/fan_pwm", "r") + value = int(f.readline().strip(), 16) + f.close() + return value + + def setPWM(self, fanid, value): + if value > 255: + return + f = open("/proc/stb/fp/fan_pwm", "w") + f.write("%x" % value) + f.close() + +fancontrol = FanControl() \ No newline at end of file diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am index 34710fa1..b5ef0688 100755 --- a/lib/python/Components/Makefile.am +++ b/lib/python/Components/Makefile.am @@ -19,4 +19,4 @@ install_PYTHON = \ Element.py Playlist.py ParentalControl.py ParentalControlList.py \ Ipkg.py SelectionList.py Scanner.py SystemInfo.py DreamInfoHandler.py \ Task.py language_cache.py Console.py ResourceManager.py TuneTest.py \ - Keyboard.py + Keyboard.py Sensors.py FanControl.py diff --git a/lib/python/Components/Sensors.py b/lib/python/Components/Sensors.py new file mode 100644 index 00000000..7f63455b --- /dev/null +++ b/lib/python/Components/Sensors.py @@ -0,0 +1,72 @@ +from Components.FanControl import fancontrol + +class Sensors: + # (type, name, unit, directory) + TYPE_TEMPERATURE = 0 + # (type, name, unit, fanid) + TYPE_FAN_RPM = 1 + + def __init__(self): + # (type, name, unit, sensor_specific_dict/list) + self.sensors_list = [] + self.addSensors() + + def getSensorsCount(self, type = None): + if type is None: + return len(self.sensors_list) + count = 0 + for sensor in self.sensors_list: + if sensor[0] == type: + count += 1 + return count + + # returns a list of sensorids of type "type" + def getSensorsList(self, type = None): + if type is None: + return range(len(self.sensors_list)) + list = [] + for sensorid in range(len(self.sensors_list)): + if self.sensors_list[sensorid][0] == type: + list.append(sensorid) + return list + + + def getSensorType(self, sensorid): + return self.sensors_list[sensorid][0] + + def getSensorName(self, sensorid): + return self.sensors_list[sensorid][1] + + def getSensorValue(self, sensorid): + value = -1 + sensor = self.sensors_list[sensorid] + if sensor[0] == self.TYPE_TEMPERATURE: + f = open("%s/value" % sensor[3], "r") + value = int(f.readline().strip()) + f.close() + elif sensor[0] == self.TYPE_FAN_RPM: + value = fancontrol.getFanSpeed(sensor[3]) + return value + + def getSensorUnit(self, sensorid): + return self.sensors_list[sensorid][2] + + def addSensors(self): + import os + if os.path.exists("/proc/stb/sensors"): + for dirname in os.listdir("/proc/stb/sensors"): + if dirname.find("temp", 0, 4) == 0: + f = open("/proc/stb/sensors/%s/name" % dirname, "r") + name = f.readline().strip() + f.close() + + f = open("/proc/stb/sensors/%s/unit" % dirname, "r") + unit = f.readline().strip() + f.close() + + self.sensors_list.append((self.TYPE_TEMPERATURE, name, unit, "/proc/stb/sensors/%s" % dirname)) + for fanid in range(fancontrol.getFanCount()): + if fancontrol.hasRPMSensor(fanid): + self.sensors_list.append((self.TYPE_FAN_RPM, _("fan"), "rpm", fanid)) + +sensors = Sensors() \ No newline at end of file diff --git a/lib/python/Components/Sources/Makefile.am b/lib/python/Components/Sources/Makefile.am index 6ef8cac6..436d31be 100644 --- a/lib/python/Components/Sources/Makefile.am +++ b/lib/python/Components/Sources/Makefile.am @@ -4,4 +4,4 @@ install_PYTHON = \ __init__.py Clock.py EventInfo.py Source.py List.py CurrentService.py \ FrontendStatus.py Boolean.py Config.py ServiceList.py RdsDecoder.py StreamService.py \ StaticText.py CanvasSource.py ServiceEvent.py Event.py FrontendInfo.py TunerInfo.py \ - RecordState.py Progress.py + RecordState.py Progress.py Sensor.py diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py new file mode 100644 index 00000000..3f6c8f0f --- /dev/null +++ b/lib/python/Components/Sources/Sensor.py @@ -0,0 +1,27 @@ +from Components.Sensors import sensors + +from enigma import eTimer + +from Source import Source + +class SensorSource(Source): + def __init__(self, update_interval = 500, sensorid = 0): + self.update_interval = update_interval + self.sensorid = sensorid + Source.__init__(self) + + self.update_timer = eTimer() + self.update_timer.callback.append(self.updateValue) + self.update_timer.start(self.update_interval) + + def getValue(self): + return sensors.getSensorValue(self.sensorid) + + def getUnit(self): + return sensors.getSensorUnit(self.sensorid) + + def updateValue(self): + self.changed((self.CHANGED_POLL,)) + + def destroy(self): + self.update_timer.callback.remove(self.updateValue) diff --git a/lib/python/Plugins/SystemPlugins/Makefile.am b/lib/python/Plugins/SystemPlugins/Makefile.am index a8b187dc..9cc538f3 100755 --- a/lib/python/Plugins/SystemPlugins/Makefile.am +++ b/lib/python/Plugins/SystemPlugins/Makefile.am @@ -3,7 +3,8 @@ installdir = $(pkglibdir)/python/Plugins/SystemPlugins SUBDIRS = SoftwareManager FrontprocessorUpgrade PositionerSetup Satfinder \ SkinSelector SatelliteEquipmentControl Videomode VideoTune Hotplug \ DefaultServicesScanner NFIFlash DiseqcTester CommonInterfaceAssignment \ - CrashlogAutoSubmit CleanupWizard VideoEnhancement WirelessLan NetworkWizard + CrashlogAutoSubmit CleanupWizard VideoEnhancement WirelessLan NetworkWizard \ + TempFanControl install_PYTHON = \ __init__.py 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 From 710b3ea19993c9fc15e38a57101494eb962c606c Mon Sep 17 00:00:00 2001 From: thedoc Date: Thu, 10 Dec 2009 14:52:36 +0100 Subject: support up to 8 fan/temp sensors --- lib/python/Components/Converter/SensorToText.py | 2 + lib/python/Components/FanControl.py | 4 +- lib/python/Components/Sensors.py | 2 +- lib/python/Components/Sources/Sensor.py | 16 ++-- .../Plugins/SystemPlugins/TempFanControl/plugin.py | 96 ++++++++++++++++++++-- 5 files changed, 102 insertions(+), 18 deletions(-) diff --git a/lib/python/Components/Converter/SensorToText.py b/lib/python/Components/Converter/SensorToText.py index ab87ee2e..fb156faf 100644 --- a/lib/python/Components/Converter/SensorToText.py +++ b/lib/python/Components/Converter/SensorToText.py @@ -5,6 +5,8 @@ class SensorToText(Converter, object): Converter.__init__(self, arguments) def getText(self): + if self.source.getValue() is None: + return "" return "%d %s" % (self.source.getValue(), self.source.getUnit()) text = property(getText) diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index d7986c25..7a402272 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -23,8 +23,8 @@ class FanControl: default_vlt = self.getVoltage(fanid) default_pwm = self.getPWM(fanid) fan = ConfigSubsection() - fan.vlt = ConfigSlider(default = default_vlt, increment = 10, limits = (0, 255)) - fan.pwm = ConfigSlider(default = default_vlt, increment = 10, limits = (0, 255)) + fan.vlt = ConfigSlider(default = 16, increment = 5, limits = (0, 255)) + fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) fan.vlt.addNotifier(boundFunction(setVlt, self, fanid)) fan.pwm.addNotifier(boundFunction(setPWM, self, fanid)) config.fans.append(fan) diff --git a/lib/python/Components/Sensors.py b/lib/python/Components/Sensors.py index 7f63455b..8898a030 100644 --- a/lib/python/Components/Sensors.py +++ b/lib/python/Components/Sensors.py @@ -67,6 +67,6 @@ class Sensors: self.sensors_list.append((self.TYPE_TEMPERATURE, name, unit, "/proc/stb/sensors/%s" % dirname)) for fanid in range(fancontrol.getFanCount()): if fancontrol.hasRPMSensor(fanid): - self.sensors_list.append((self.TYPE_FAN_RPM, _("fan"), "rpm", fanid)) + self.sensors_list.append((self.TYPE_FAN_RPM, _("Fan %d") % (fanid + 1), "rpm", fanid)) sensors = Sensors() \ No newline at end of file diff --git a/lib/python/Components/Sources/Sensor.py b/lib/python/Components/Sources/Sensor.py index 3f6c8f0f..e927bbf4 100644 --- a/lib/python/Components/Sources/Sensor.py +++ b/lib/python/Components/Sources/Sensor.py @@ -5,17 +5,20 @@ from enigma import eTimer from Source import Source class SensorSource(Source): - def __init__(self, update_interval = 500, sensorid = 0): + def __init__(self, update_interval = 500, sensorid = None): self.update_interval = update_interval self.sensorid = sensorid Source.__init__(self) - self.update_timer = eTimer() - self.update_timer.callback.append(self.updateValue) - self.update_timer.start(self.update_interval) + if sensorid is not None: + self.update_timer = eTimer() + self.update_timer.callback.append(self.updateValue) + self.update_timer.start(self.update_interval) def getValue(self): - return sensors.getSensorValue(self.sensorid) + if self.sensorid is not None: + return sensors.getSensorValue(self.sensorid) + return None def getUnit(self): return sensors.getSensorUnit(self.sensorid) @@ -24,4 +27,5 @@ class SensorSource(Source): self.changed((self.CHANGED_POLL,)) def destroy(self): - self.update_timer.callback.remove(self.updateValue) + if self.sensorid is not None: + self.update_timer.callback.remove(self.updateValue) diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 60af03cb..b5762529 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 @@ -13,10 +14,70 @@ class TempFanControl(Screen, ConfigListScreen): skin = """ - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -25,15 +86,32 @@ class TempFanControl(Screen, ConfigListScreen): 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) + + 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)) ConfigListScreen.__init__(self, self.list, session = self.session) #self["config"].list = self.list #self["config"].setList(self.list) -- cgit v1.2.3 From 9d1fc274f19c85ef8b1cf143bca2ff0ef5218b86 Mon Sep 17 00:00:00 2001 From: thedoc Date: Thu, 10 Dec 2009 17:27:34 +0100 Subject: remove unneeded variables --- lib/python/Components/FanControl.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/lib/python/Components/FanControl.py b/lib/python/Components/FanControl.py index 7a402272..cc133ac0 100644 --- a/lib/python/Components/FanControl.py +++ b/lib/python/Components/FanControl.py @@ -20,8 +20,6 @@ class FanControl: config.fans = ConfigSubList() for fanid in range(self.getFanCount()): - default_vlt = self.getVoltage(fanid) - default_pwm = self.getPWM(fanid) fan = ConfigSubsection() fan.vlt = ConfigSlider(default = 16, increment = 5, limits = (0, 255)) fan.pwm = ConfigSlider(default = 0, increment = 5, limits = (0, 255)) -- cgit v1.2.3 From a5b6110e64df2cfe9ded031dbaa5816b9cdd1cb7 Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 11 Dec 2009 12:39:26 +0100 Subject: add color buttons to TempFanControl --- .../Plugins/SystemPlugins/TempFanControl/plugin.py | 25 +++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index b5762529..22332620 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -12,8 +12,17 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - - + + + + + + + + + + + @@ -80,7 +89,6 @@ class TempFanControl(Screen, ConfigListScreen): - """ def __init__(self, session, args = None): @@ -91,6 +99,11 @@ class TempFanControl(Screen, ConfigListScreen): 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] @@ -116,10 +129,12 @@ class TempFanControl(Screen, ConfigListScreen): #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): -- cgit v1.2.3 From 74378b3ebe7dc0548cb4e4b6a0d54b0e871c0264 Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 11 Dec 2009 13:00:46 +0100 Subject: some widget resizing in TempFanControl plugin --- lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 22332620..5dfacd8a 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -12,7 +12,7 @@ from Components.FanControl import fancontrol class TempFanControl(Screen, ConfigListScreen): skin = """ - + @@ -22,7 +22,7 @@ class TempFanControl(Screen, ConfigListScreen): - + -- cgit v1.2.3 From 84b36922b357db78b354ea85be700e2dbd15e5d0 Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 11 Dec 2009 13:24:23 +0100 Subject: move TempFanControl plugin into system menu --- lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 5dfacd8a..01c276a4 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -146,10 +146,16 @@ class TempFanControl(Screen, ConfigListScreen): fancontrol.getConfig(0).vlt.load() fancontrol.getConfig(0).pwm.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) + return PluginDescriptor(name = "Temperature and Fan control", description = _("Temperature and Fan control"), where = PluginDescriptor.WHERE_MENU, fnc = startMenu) \ No newline at end of file -- cgit v1.2.3 From 48070d1e3868f6c7e5d61002f2b707249be5d016 Mon Sep 17 00:00:00 2001 From: thedoc Date: Fri, 11 Dec 2009 13:43:50 +0100 Subject: save/revert all available fan configs, not just for fan 1 --- lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py index 01c276a4..38e343f9 100644 --- a/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py +++ b/lib/python/Plugins/SystemPlugins/TempFanControl/plugin.py @@ -138,13 +138,15 @@ class TempFanControl(Screen, ConfigListScreen): }, -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() 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() self.close() def main(session, **kwargs): -- cgit v1.2.3