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