1
0
mirror of https://github.com/gryf/pywmtemp.git synced 2025-12-19 12:18:02 +01:00

Added new submethod for creating strings.

This commit is contained in:
2022-05-01 15:23:40 +02:00
parent edae2233a5
commit 54b863ece1

View File

@@ -207,9 +207,10 @@ class SensorDockApp(wmdocklib.DockApp):
position = 1 position = 1
if count == 0: if count == 0:
for item in self.conf['readings']: # suport up to two reading. all surplus entries will be
string, offset = self.get_reading(item) # ignored.
self.add_string(string, 1, position) for item in self.conf.get('readings', [])[:2]:
self._put_string(item, position)
position += self.char_height position += self.char_height
count += 1 count += 1
@@ -274,6 +275,17 @@ class SensorDockApp(wmdocklib.DockApp):
self._history[item.get('name')] = [0 for _ in self._history[item.get('name')] = [0 for _ in
range(self.graph_width)] range(self.graph_width)]
def _put_string(self, item, position):
temp, displacement = self.get_reading(item)
name = item.get('name', '').upper()
name = name[:4]
if displacement:
name = ''.join([chr(ord(i) + displacement)
for i in name])
self.add_string(name, 1, position)
self.add_string(temp, 34, position)
def main(): def main():
parser = argparse.ArgumentParser() parser = argparse.ArgumentParser()