Beispiel #1
0
def run(argv=None):
    log.startLogging(sys.stdout)
    if argv is None:
        argv = sys.argv
    if len(argv) > 1:
        username = argv[1]
    else:
        username = None

    d = defer.Deferred()

    netclient = NetClient(
        d,
        username or 'jezebel',
    )
    bigctl = BigController(d, )
    bigview = BigView(bigctl)

    box.registerObserver(netclient)
    box.registerObserver(bigctl)

    reactor.callLater(0, netclient.connectPB, 'localhost', 9559)

    d.addCallback(finish, ).addErrback(finish, )

    reactor.run()

    box.unregisterObserver(netclient)
    box.unregisterObserver(bigctl)
Beispiel #2
0
def run(argv = None):
    log.startLogging(sys.stdout)
    if argv is None:
        argv = sys.argv
    if len(argv) > 1:
        username = argv[1]
    else:
        username = None

    d = defer.Deferred()

    
    netclient = NetClient(d, username or 'jezebel', )
    bigctl = BigController(d, )
    bigview = BigView(bigctl)

    box.registerObserver(netclient)
    box.registerObserver(bigctl)

    reactor.callLater(0, netclient.connectPB, 'localhost', 9559)

    d.addCallback(finish, ).addErrback(finish, )

    reactor.run()

    box.unregisterObserver(netclient)
    box.unregisterObserver(bigctl)
Beispiel #3
0
    def requestAvatar(self, username, mind, *interfaces):
        if pb.IPerspective not in interfaces:
            raise NotImplementedError
        if username in self.avatars:
            replaced = self.avatars[username]
            d = replaced.mind.callRemote('serverDisconnect',
                                         'replaced by new login')
            d.addErrback(lambda f: None)
            del self.avatars[username]
            del replaced
            log.msg('Avatar %s replaced by new login' % (username, ))

        avatar = Gameboy(username, mind, self.models)
        self.avatars[username] = avatar
        box.registerObserver(avatar)

        def dc():
            log.msg('Bye-bye, %s' % (avatar.username, ))
            del self.avatars[avatar.username]
            box.unregisterObserver(avatar)

        return (
            pb.IPerspective,
            avatar,
            dc,
        )
Beispiel #4
0
    def requestAvatar(self, username, mind, *interfaces):
        if pb.IPerspective not in interfaces:
            raise NotImplementedError
        if username in self.avatars:
            replaced = self.avatars[username]
            d = replaced.mind.callRemote('serverDisconnect', 
                                         'replaced by new login')
            d.addErrback(lambda f: None)
            del self.avatars[username]
            del replaced
            log.msg('Avatar %s replaced by new login' % (username,))


        avatar = Gameboy(username, mind, self.models)
        self.avatars[username] = avatar
        box.registerObserver(avatar)
        def dc():
            log.msg('Bye-bye, %s' % (avatar.username,))
            del self.avatars[avatar.username]
            box.unregisterObserver(avatar)
        return (pb.IPerspective, avatar, dc,)