Ejemplo n.º 1
0
 def OnTimer(self, event):
     client.keepAlive()
Ejemplo n.º 2
0
            if evt.type == ACTIVEEVENT:
                if evt.gain == 1 and evt.state == 6:
                    # pygame desktop window focus event
                    needsRefresh = True
            if evt.type == KEYUP and evt.key == K_F12:
                running = 0
                break
            if evt.type == KEYUP and evt.key == K_F9:
                forceKeepAlive = True
            evt = app.processEvent(evt)

        if app.needsUpdate() or isHWSurface or needsRefresh:
            needsRefresh = False
            update()
        # keep alive connection
        client.keepAlive(forceKeepAlive)

        # save DB every 4 hours in case of a computer crash
        # using "counter" to limit calls to time.clock() to approximately every 10-15 minutes
        if counter > 5000:
            # set this to zero so we don't display Update dialog
            counter = 0
            if time.clock() - lastSave > 14400:
                saveDB = True
        if saveDB:
            client.saveDB()
            lastSave = time.clock();

    except IClientException, e:
        client.reinitialize()
        gdata.app.setStatus(e.args[0])
Ejemplo n.º 3
0
	def OnTimer(self, event):
		client.keepAlive()
Ejemplo n.º 4
0
                                          or evt.key == K_RALT):
                key_alt = True

            if evt.type == KEYUP and evt.key == K_F9:
                forceKeepAlive = True
            evt = app.processEvent(evt)

        if (key_f4 and key_alt):
            running = 0
            break

        if app.needsUpdate() or isHWSurface or needsRefresh:
            needsRefresh = False
            update()
        # keep alive connection
        client.keepAlive(forceKeepAlive)

        # save DB every 4 hours in case of a computer crash
        # using "counter" to limit calls to time.clock() to approximately every 10-15 minutes
        if counter > 5000:
            counter = 0
            if time.clock() - lastSave > 14400:
                saveDB = True
        if saveDB:
            client.saveDB()
            lastSave = time.clock()
        counter += 1

    except IClientException, e:
        client.reinitialize()
        gdata.app.setStatus(e.args[0])