Example #1
0
 def get_last_status(cls, callback):
     ctx = AlertContext.current()
     if cls.is_retrieving: return
     cls.is_retrieving = False
     cls.callback = callback
     thread = Thread(target = cls.connect_and_retrieve_status)
     thread.start()
Example #2
0
 def connect_and_retrieve_status(cls):
     ctx = AlertContext.current()
     try:
         cls.is_retrieving = True
         time.sleep(3)
         conn = httplib.HTTPConnection(ctx.skink_address)
         url = "/status?_=%d" % random.randint(1,10000000)
         conn.request("GET", url)
         r1 = conn.getresponse()
         json = r1.read()
         json = json.decode('utf-8','replace')
     except Exception, message:
         #intentionally swallow since it does not matter why the connection was refused.
         cls.is_retrieving = False
         return
Example #3
0
 def __init__(self):
     self.initialize()
     self.ctx = AlertContext.current()
     self.resources = Resources()
     self.resources.preload()
     self.is_failing = False
Example #4
0
 def __init__(self):
     self.ctx = AlertContext.current()
Example #5
0
 def __init__(self, game):
     self.game = game
     self.ctx = AlertContext.current()