mirror of
https://github.com/gryf/pywmtemp.git
synced 2025-12-18 11:40:17 +01:00
Refresh dockapp every 10ms, update it every second.
This commit is contained in:
22
pywmtemp.py
22
pywmtemp.py
@@ -146,21 +146,21 @@ class SensorDockApp(wmdocklib.DockApp):
|
||||
|
||||
def main_loop(self):
|
||||
|
||||
count = 0
|
||||
while True:
|
||||
self.check_for_events()
|
||||
|
||||
position = 1
|
||||
for item in self.conf['readings']:
|
||||
self.add_string(self.get_reading(item), 1, position)
|
||||
position += self.char_height
|
||||
while position < self.max_rows * self.char_height:
|
||||
self.add_string(' ' * self.max_chars_in_line, 1, position)
|
||||
position += self.char_height
|
||||
pywmgeneral.put_pixel(32, 32, int('ffff88', 16))
|
||||
pywmgeneral.put_pixel(33, 33, int('ffff88', 16))
|
||||
pywmgeneral.put_pixel(32, 33, int('ffff88', 16))
|
||||
pywmgeneral.put_pixel(33, 32, int('ffff88', 16))
|
||||
if count == 0:
|
||||
for item in self.conf['readings']:
|
||||
self.add_string(self.get_reading(item), 1, position)
|
||||
position += self.char_height
|
||||
|
||||
count += 1
|
||||
if count >= 10:
|
||||
count = 0
|
||||
self.redraw()
|
||||
time.sleep(0.5)
|
||||
time.sleep(0.1)
|
||||
|
||||
def get_reading(self, item):
|
||||
if 'fname' not in item:
|
||||
|
||||
Reference in New Issue
Block a user