[modules/sensors] Minor cosmetic changes + screenshot
Cosmetic changes: * replace all single ticks with double ticks * add vim line Added screenshot for sensors module.
This commit is contained in:
parent
870130b8c3
commit
2052f58dde
2 changed files with 5 additions and 3 deletions
|
@ -20,9 +20,9 @@ class Module(bumblebee.engine.Module):
|
||||||
super(Module, self).__init__(engine, config,
|
super(Module, self).__init__(engine, config,
|
||||||
bumblebee.output.Widget(full_text=self.temperature)
|
bumblebee.output.Widget(full_text=self.temperature)
|
||||||
)
|
)
|
||||||
self._temperature = 'unknown'
|
self._temperature = "unknown"
|
||||||
pattern = self.parameter("match", "temp1_input")
|
pattern = self.parameter("match", "temp1_input")
|
||||||
pattern_string = r'^\s*{}:\s*([\d.]+)$'.format(pattern)
|
pattern_string = r"^\s*{}:\s*([\d.]+)$".format(pattern)
|
||||||
self._match_number = int(self.parameter("match_number", "-1"))
|
self._match_number = int(self.parameter("match_number", "-1"))
|
||||||
self._pattern = re.compile(pattern_string, re.MULTILINE)
|
self._pattern = re.compile(pattern_string, re.MULTILINE)
|
||||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd="xsensors")
|
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE, cmd="xsensors")
|
||||||
|
@ -30,7 +30,7 @@ class Module(bumblebee.engine.Module):
|
||||||
def get_temp(self):
|
def get_temp(self):
|
||||||
temperatures = bumblebee.util.execute("sensors -u")
|
temperatures = bumblebee.util.execute("sensors -u")
|
||||||
matching_temp = self._pattern.findall(temperatures)
|
matching_temp = self._pattern.findall(temperatures)
|
||||||
temperature = 'unknown'
|
temperature = "unknown"
|
||||||
if matching_temp:
|
if matching_temp:
|
||||||
temperature = matching_temp[self._match_number]
|
temperature = matching_temp[self._match_number]
|
||||||
|
|
||||||
|
@ -41,3 +41,5 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
self._temperature = self.get_temp()
|
self._temperature = self.get_temp()
|
||||||
|
|
||||||
|
# vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
|
||||||
|
|
BIN
screenshots/sensors.png
Normal file
BIN
screenshots/sensors.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Loading…
Reference in a new issue