Пример #1
0
def entry():
    import sylphisexceptions
    global sde

    #sde = SDEThread()

    #global debugger
    #from Debugger import Debugger
    #debugger = Debugger()

    #global rpcs
    #rpcs = rpcserver.CRPCServer(('127.0.0.1', 8000))
    #rpcs.register_instance(debugger)

    #debugger.setIdleCall(rpcs.handle_request)
    #debugger.enable_trace()
    mthread.new("entry()", _entry)

    if 0:
        import profile
        print "profiling"
        p = profile.Profile()
        p.runcall(stackless.run)
        p.print_stats()
    else:
        retry = True
        while retry:
            try:
                stackless.run()
                retry = False
            except Exception, e:
                ## If there are more microthreads running
                ## don't terminate. Just print out the exception
                ## and continue scheduling
                if stackless.getruncount() <= 2:
                    retry = False
                traceback.print_exc()
Пример #2
0
def entry():
    import sylphisexceptions
    global sde

    #sde = SDEThread()

    #global debugger
    #from Debugger import Debugger
    #debugger = Debugger()
    
    #global rpcs
    #rpcs = rpcserver.CRPCServer(('127.0.0.1', 8000))
    #rpcs.register_instance(debugger)
    
    #debugger.setIdleCall(rpcs.handle_request)
    #debugger.enable_trace()
    mthread.new("entry()", _entry)
    
    if 0:
        import profile
        print "profiling"
        p = profile.Profile()
        p.runcall(stackless.run)
        p.print_stats()
    else:
        retry = True
        while retry:
            try:
                stackless.run()
                retry = False
            except Exception, e:
                ## If there are more microthreads running
                ## don't terminate. Just print out the exception
                ## and continue scheduling
                if stackless.getruncount() <= 2:
                    retry = False
                traceback.print_exc()
Пример #3
0
    def start(self):
        """
        This is always called after join() and right before the actor is about
        to enter the world. The basic setup that happens here is to reparent the
        main actor's node to the parent that is specified by the 'parent' specific.
        
        You should overide this, but always call the father.
        """
        parent = None
        bone = None
        if hasattr(self, 'parent'):
            name = string.split(self.parent, '.')
            parent = self.mCont.actors.getActorByName(name[0])
            if len(name) is 2:
                bone = name[1]
            print name[0]
        if parent is None:
            parentNode = self.mScene.getRootSceneNode()
        else:
            parentNode = parent.node
        if hasattr(self, 'node'):
            n = self.node
            tr = parentNode.getPosition()
            #print "Parent :", tr.x, tr.y, tr.z
            n.move(-tr)
            if bone != None:
                try:
                    parentNode.addChildAtBone(bone, n)
                except AttributeError:
                    n.move(tr) # Move back
                    self.mScene.getRootSceneNode().addChild(n)
                    return
            else:
                try:
                    parentNode.addChild(n)
                except AttributeError:
                    n.move(tr) # Move back
                    self.mScene.getRootSceneNode().addChild(n)

        name = self.name
#        if self.__class__.handleEvent != CSimpleActor.handleEvent:
#            if hasattr(self, 'eventThread'):
#                raise "Double start"
#            self.eventThread = mthread.new(name + '(event loop)', self.eventLoop)
        if hasattr(self, 'run'):
            self.thread = mthread.new(name, self.run)

        self.__state__ = self.STATE_RUNNING
Пример #4
0
    def start(self):
        """
        This is always called after join() and right before the actor is about
        to enter the world. The basic setup that happens here is to reparent the
        main actor's node to the parent that is specified by the 'parent' specific.
        
        You should overide this, but always call the father.
        """
        parent = None
        bone = None
        if hasattr(self, 'parent'):
            name = string.split(self.parent, '.')
            parent = self.mCont.actors.getActorByName(name[0])
            if len(name) is 2:
                bone = name[1]
            print name[0]
        if parent is None:
            parentNode = self.mScene.getRootSceneNode()
        else:
            parentNode = parent.node
        if hasattr(self, 'node'):
            n = self.node
            tr = parentNode.getPosition()
            #print "Parent :", tr.x, tr.y, tr.z
            n.move(-tr)
            if bone != None:
                try:
                    parentNode.addChildAtBone(bone, n)
                except AttributeError:
                    n.move(tr)  # Move back
                    self.mScene.getRootSceneNode().addChild(n)
                    return
            else:
                try:
                    parentNode.addChild(n)
                except AttributeError:
                    n.move(tr)  # Move back
                    self.mScene.getRootSceneNode().addChild(n)

        name = self.name
        #        if self.__class__.handleEvent != CSimpleActor.handleEvent:
        #            if hasattr(self, 'eventThread'):
        #                raise "Double start"
        #            self.eventThread = mthread.new(name + '(event loop)', self.eventLoop)
        if hasattr(self, 'run'):
            self.thread = mthread.new(name, self.run)

        self.__state__ = self.STATE_RUNNING