Merge pull request #1 from tobi-wan-kenobi/master
Bring fork up to date
This commit is contained in:
commit
c070d9b333
2 changed files with 11 additions and 5 deletions
|
@ -118,8 +118,10 @@ class Module(object):
|
||||||
|
|
||||||
def parameter(self, name, default=None):
|
def parameter(self, name, default=None):
|
||||||
"""Return the config parameter 'name' for this module"""
|
"""Return the config parameter 'name' for this module"""
|
||||||
|
module_name = "{}.{}".format(self.__module__.split(".")[-1], name)
|
||||||
name = "{}.{}".format(self.name, name)
|
name = "{}.{}".format(self.name, name)
|
||||||
value = self._config["config"].get(name, default)
|
value = self._config["config"].get(module_name, default)
|
||||||
|
value = self._config["config"].get(name, value)
|
||||||
if value == default:
|
if value == default:
|
||||||
try:
|
try:
|
||||||
value = self._configFile.get("module-parameters", name)
|
value = self._configFile.get("module-parameters", name)
|
||||||
|
|
|
@ -11,7 +11,7 @@ Parameters:
|
||||||
* sensors.match: (fallback) Line to match against output of 'sensors -u' (default: temp1_input)
|
* sensors.match: (fallback) Line to match against output of 'sensors -u' (default: temp1_input)
|
||||||
* sensors.match_pattern: (fallback) Line to match against before temperature is read (no default)
|
* sensors.match_pattern: (fallback) Line to match against before temperature is read (no default)
|
||||||
* sensors.match_number: (fallback) which of the matches you want (default -1: last match).
|
* sensors.match_number: (fallback) which of the matches you want (default -1: last match).
|
||||||

|
* sensors.show_freq: whether to show CPU frequency. (default: true)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
@ -35,6 +35,7 @@ class Module(bumblebee.engine.Module):
|
||||||
self._match_pattern = self.parameter("match_pattern", None)
|
self._match_pattern = self.parameter("match_pattern", None)
|
||||||
self._pattern = re.compile(r"^\s*{}:\s*([\d.]+)$".format(self.parameter("match", "temp1_input")), re.MULTILINE)
|
self._pattern = re.compile(r"^\s*{}:\s*([\d.]+)$".format(self.parameter("match", "temp1_input")), re.MULTILINE)
|
||||||
self._json = bumblebee.util.asbool(self.parameter("json", "false"))
|
self._json = bumblebee.util.asbool(self.parameter("json", "false"))
|
||||||
|
self._freq = bumblebee.util.asbool(self.parameter("show_freq", "true"))
|
||||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd="xsensors")
|
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd="xsensors")
|
||||||
self.determine_method()
|
self.determine_method()
|
||||||
|
|
||||||
|
@ -115,10 +116,13 @@ class Module(bumblebee.engine.Module):
|
||||||
return "{:0.01f} GHz".format(float(mhz)/1000.0)
|
return "{:0.01f} GHz".format(float(mhz)/1000.0)
|
||||||
|
|
||||||
def temperature(self, _):
|
def temperature(self, _):
|
||||||
|
if self._freq:
|
||||||
return u"{}°c @ {}".format(self._temperature, self._mhz)
|
return u"{}°c @ {}".format(self._temperature, self._mhz)
|
||||||
|
else:
|
||||||
|
return u"{}°c".format(self._temperature)
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
self._temperature = self.get_temp()
|
self._temperature = self.get_temp()
|
||||||
|
if self._freq:
|
||||||
self._mhz = self.get_mhz()
|
self._mhz = self.get_mhz()
|
||||||
|
|
||||||
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
Loading…
Reference in a new issue