def main(debug=False): try: from eventor.res import get_res_path icon_path=get_res_path() from eventor.agents.eventor_tray import TrayAgent _ta=TrayAgent(APP_NAME, icon_path, ICON_NAME, HELP_URL) import eventor.agents.adbus #@UnusedImport from eventor.agents.call import CallAgent _ca=CallAgent() _ca.start() _na=NotifierAgent(APP_NAME, ICON_NAME) _na.start() clk=Clock(TIME_BASE) gobject.timeout_add(TIME_BASE, clk.tick) import eventor.agents.receiver #@UnusedImport import eventor.agents.ipreg #@UnusedImport mswitch.publish("__main__", "debug", debug) gtk.main() except KeyboardInterrupt: mswitch.quit() sys.exit(1) except Exception,e: notify(APP_NAME, "There was an error: %s" % e) mswitch.quit() sys.exit(1)
def tick(self, *_): """ Performs message dispatch """ tick_min=False tick_hour=False tick_day=False tick_second = (self.tick_count % self.ticks_second) == 0 self.tick_count += 1 if tick_second: self.sec_count += 1 tick_min=(self.sec_count % 60)==0 if tick_min: self.min_count += 1 tick_hour=(self.min_count % 60)==0 if tick_hour: self.hour_count += 1 tick_day=(self.hour_count % 24)==0 if tick_day: self.day_count += 1 #print "tick! ", tick_second mswitch.publish("__main__", "__tick__", self.ticks_second, tick_second, tick_min, tick_hour, tick_day, self.sec_count, self.min_count, self.hour_count, self.day_count) #(src_agent, agent_name, agent_id, # interest_map, responsesInterestList, # iq, isq, processor, low_priority_burst_size=5) quit=process_queues(False, self, "__main__", "__main__", self.interests, self.responsesInterests, self.iq, self.isq, message_processor ) ## for gobject... just in case return True
def tick(self, *_): """ Performs message dispatch """ tick_min = False tick_hour = False tick_day = False tick_second = (self.tick_count % self.ticks_second) == 0 self.tick_count += 1 if tick_second: self.sec_count += 1 tick_min = (self.sec_count % 60) == 0 if tick_min: self.min_count += 1 tick_hour = (self.min_count % 60) == 0 if tick_hour: self.hour_count += 1 tick_day = (self.hour_count % 24) == 0 if tick_day: self.day_count += 1 #print "tick! ", tick_second mswitch.publish("__main__", "__tick__", self.ticks_second, tick_second, tick_min, tick_hour, tick_day, self.sec_count, self.min_count, self.hour_count, self.day_count) #(src_agent, agent_name, agent_id, # interest_map, responsesInterestList, # iq, isq, processor, low_priority_burst_size=5) quit = process_queues(False, self, "__main__", "__main__", self.interests, self.responsesInterests, self.iq, self.isq, message_processor) ## for gobject... just in case return True
def exit(self, *p): print "menu: exit" mswitch.publish(self, "__quit__")
def show(self, *_): print "menu: show" mswitch.publish(self, "__show__")
def exit(self, *p): mswitch.publish(self, "__quit__") gtk.main_quit()
def show(self, *_): mswitch.publish(self, "app_show")
def pub(self, msgType, *pargs, **kargs): mswitch.publish("__main__", msgType, *pargs, **kargs)