Exemplo n.º 1
0
 def handleAnswer( self, message ):
     printMessage( message )
     self.n = self.n + 1
     print "N =", self.n
     if self.n == 2:
         self.boss.stopReadingBoth()
         main.shutDown()
Exemplo n.º 2
0
 def handleAnswer(self, message):
     printMessage(message)
     self.n = self.n + 1
     print "N =", self.n
     if self.n == 2:
         self.boss.stopReadingBoth()
         main.shutDown()
Exemplo n.º 3
0
    def tick(self):
        try:
            pyui.core.update()
            pyui.core.draw()
        except:
            #TODO: handle exceptions properly!
            print "Exception in pyui"
            raise
        
        main.addTimeout(self.tick, 0.001)
        
        if not getDesktop().running:
            main.shutDown()
            pyui.quit()

        now = time.time()
        if  now - self.last > 1:
            print "FPS:", self.frames
            self.frames = 0
            self.last = now
        self.frames = self.frames + 1
Exemplo n.º 4
0
    # make sure we can be shut down on windows.
    main.addTimeout(tick, 0.5)

    # create the boat frame
    w = pyui.boat.BoatReflectorFrame(reflector, 0,0,790, 570)

    # run the main loop
    last = 0
    frame = 0
    try:
        while pyui.update():
            pyui.draw()
            main.iterate()
            frame += 1
            now = time.time()
            if now - last > 2:
                print "FPS: ", int(frame/2)
                frame=0
                last=now
    except:
        print "ERROR:"
        traceback.print_exc()

    # done. quit now.
    pyui.quit()
    reactor.stop()
    main.iterate()
    main.iterate()
    main.shutDown()
    print "done Twisted shutdown"
Exemplo n.º 5
0
def gotNoObject(reason):
    print "no object:",reason
    main.shutDown()
Exemplo n.º 6
0
def gotEcho(echo):
    print 'server echoed:',echo
    main.shutDown()
Exemplo n.º 7
0
def failure(error):
    print "Failure...",error
    main.shutDown()
Exemplo n.º 8
0
def success(message):
    print "Message received:",message
    main.shutDown()
Exemplo n.º 9
0
def printFailure():
    print "error: could not resolve"
    main.shutDown()
Exemplo n.º 10
0
def printAnswer(answer):
    print answer
    main.shutDown()
Exemplo n.º 11
0
def printFailure():
    print "error: could not resolve"
    main.shutDown()
Exemplo n.º 12
0
def printAnswer(answer):
    print answer
    main.shutDown()
Exemplo n.º 13
0
def failure(error):
    print "Failure...", error
    main.shutDown()
Exemplo n.º 14
0
def success(message):
    print "Message received:", message
    main.shutDown()