Beispiel #1
0
    def tick(self, *_):
        """
        Performs message dispatch
        """
        
        tick_second = (self.tick_count % self.ticks_second) == 0 
        self.tick_count += 1
        
        #print "tick! ", tick_second
        
        mswitch.publish("__main__", "tick", self.ticks_second, tick_second)
        
        while True:
            try:     
                envelope=self.isq.get(False)
                quit, mtype, handled=mdispatch(self, "__main__", envelope)
                if handled==False:
                    mswitch.publish(self.__class__, "__interest__", (mtype, False, self.isq))
            except Empty:
                break
            continue            
        
        burst=5
        
        while True:
            try:     
                envelope=self.iq.get(False)
                quit, mtype, handled=mdispatch(self, "__main__", envelope)
                if handled==False:
                    mswitch.publish(self.__class__, "__interest__", (mtype, False, self.iq))
                    
                burst -= 1
                if burst == 0:
                    break
            except Empty:
                break
            
            continue

        return True
Beispiel #2
0
 def _pub(self, serial, pin, value):
     try:
         mswitch.publish(self.__class__, "sensor", str(serial), int(pin), int(value))
         #print("Sensor: serial(%s) pin(%s) value(%s)" % (serial, pin, value))
     except Exception,e:
         print "!!! Dbus-ifk: exception: %s" % e
Beispiel #3
0
 def exit(self, *p):
     mswitch.publish("__app__", "__quit__")
     gtk.main_quit()