]> Pileus Git - ~andy/csm213a-hw/blobdiff - vis/visual.py
Finish up
[~andy/csm213a-hw] / vis / visual.py
index f2deed65d24ffe7b16e87525ef3d4d0ebdac8e94..737e2d9a3b61cc3fd08b3c58a3601cfb2ff47e6d 100644 (file)
@@ -17,7 +17,7 @@ else:
 
 class Visual:
        FRAMES_PER_SEC = 60 # hz
-       RATES_PER_SEC  = 10 # hz
+       RATES_PER_SEC  = 1  # hz
 
        def __init__(self, config, device, logger):
                def get_objects(names):
@@ -61,14 +61,14 @@ class Visual:
                if act.get_active():
                        self.status(self.device.connect())
                else:
-                       self.status(self.device.disconnect())
+                       self.device.disconnect()
                return True
 
        def on_xively(self, act):
                if act.get_active():
                        self.status(self.logger.connect())
                else:
-                       self.status(self.logger.disconnect())
+                       self.logger.disconnect()
                return True
 
        def on_flush(self, act):
@@ -224,7 +224,8 @@ class Visual:
 
        # Private methods
        def status(self, msg):
+               status = self.builder.get_object("status")
+               status.pop(context_id=0)
                if not msg:
                        return
-               status = self.builder.get_object("status")
                status.push(text=('Error: ' + msg), context_id=0)