Ejemplo n.º 1
0
 def run(self):
     while True:
         while not _chunkQueue.isEmpty():
             popq = _chunkQueue.pop()
             popq['class'].generateChunk(popq['chunkcords'], popq['parentnode'], popq['chunks'])
             Thread.sleep(0.04)
         Thread.sleep(0.04)
Ejemplo n.º 2
0
 def run(self):
     while True:
         while not _chunkQueue.isEmpty():
             popq = _chunkQueue.pop()
             popq['class'].generateChunk(popq['chunkcords'],
                                         popq['parentnode'], popq['chunks'])
             Thread.sleep(0.04)
         Thread.sleep(0.04)
Ejemplo n.º 3
0
    def downloadDescFile(self, http):
        """ Downloads the desc file for this particular package,
        synchronously, and then reads it.  Returns true on success,
        false on failure. """

        for token in self.downloadDescFileGenerator(http):
            if token != self.stepContinue:
                break
            Thread.considerYield()

        return (token == self.stepComplete)
Ejemplo n.º 4
0
    def downloadDescFile(self, http):
        """ Downloads the desc file for this particular package,
        synchronously, and then reads it.  Returns true on success,
        false on failure. """

        for token in self.downloadDescFileGenerator(http):
            if token != self.stepContinue:
                break
            Thread.considerYield()

        return (token == self.stepComplete)
Ejemplo n.º 5
0
    def __getLock(self):
        self.notify.info('Acquiring Panda lock for the first time.')
        from pandac.PandaModules import Thread, Mutex
        self.__dict__.setdefault('lock', Mutex('Messenger'))
        self.lock.acquire()
        self.acquire = self.lock.acquire
        self.notify.info('Waiting for cheesy lock to be released.')
        while self.locked:
            Thread.forceYield()

        self.notify.info('Got cheesy lock.')
Ejemplo n.º 6
0
    def downloadPackage(self, http):
        """ Downloads the package file, synchronously, then
        uncompresses and unpacks it.  Returns true on success, false
        on failure.

        This assumes that self.installPlans has already been filled
        in, which will have been done by self.__readDescFile().
        """

        for token in self.downloadPackageGenerator(http):
            if token != self.stepContinue:
                break
            Thread.considerYield()

        return (token == self.stepComplete)
Ejemplo n.º 7
0
    def downloadPackage(self, http):
        """ Downloads the package file, synchronously, then
        uncompresses and unpacks it.  Returns true on success, false
        on failure.

        This assumes that self.installPlans has already been filled
        in, which will have been done by self.__readDescFile().
        """

        for token in self.downloadPackageGenerator(http):
            if token != self.stepContinue:
                break
            Thread.considerYield()

        return (token == self.stepComplete)
Ejemplo n.º 8
0
        def __getLock(self):
            # Now that we've started Panda, it's safe to import the Mutex
            # class, which becomes our actual lock.
            # From now on, this lock will be used.

            self.notify.info("Acquiring Panda lock for the first time.")

            from pandac.PandaModules import Thread, Mutex
            self.__dict__.setdefault('lock', Mutex('Messenger'))
            self.lock.acquire()

            self.acquire = self.lock.acquire

            # Wait for the cheesy lock to be released before we return.
            self.notify.info("Waiting for cheesy lock to be released.")
            while self.locked:
                Thread.forceYield()
            self.notify.info("Got cheesy lock.")
Ejemplo n.º 9
0
        def __getLock(self):
            # Now that we've started Panda, it's safe to import the Mutex
            # class, which becomes our actual lock.
            # From now on, this lock will be used.

            self.notify.info("Acquiring Panda lock for the first time.")

            from pandac.PandaModules import Thread, Mutex
            self.__dict__.setdefault('lock', Mutex('Messenger'))
            self.lock.acquire()

            self.acquire = self.lock.acquire

            # Wait for the cheesy lock to be released before we return.
            self.notify.info("Waiting for cheesy lock to be released.")
            while self.locked:
                Thread.forceYield()
            self.notify.info("Got cheesy lock.")
Ejemplo n.º 10
0
	def updateWithNewImage(self):
		posX = base.camera.getX()  + MAPSIZE/2
		posY = base.camera.getY()  + MAPSIZE/2
		if self.terrain2.getRoot().isHidden():
			self.terrain2.setHeightfield(self.myImage)
			self.terrain2.setFocalPoint(posX, posY)
			if Thread.isThreadingSupported():
				thread.start_new_thread(self.updateWithNewImageThread,(self.terrain2,1))
			else:
				self.updateWithNewImageThread(self.terrain2)
			self.terrain1.getRoot().hide()
			self.terrain2.getRoot().show()
			print "done"
		else:
			self.terrain1.setHeightfield(self.myImage)
			self.terrain1.setFocalPoint(posX, posY)
			if Thread.isThreadingSupported():
				thread.start_new_thread(self.updateWithNewImageThread,(self.terrain1,1))
			else:
				self.updateWithNewImageThread(self.terrain1)
			self.terrain2.getRoot().hide()
			self.terrain1.getRoot().show()
			print "done2"
Ejemplo n.º 11
0
    def objectClicked(self):
        mpos = base.mouseWatcherNode.getMouse()
        self.pickerRay.setFromLens(base.camNode, mpos.getX(), mpos.getY())
 
        self.myTraverser.traverse(render)
        # Assume for simplicity's sake that myHandler is a CollisionHandlerQueue.
        if self.myHandler.getNumEntries() > 0:
            for i in range(self.myHandler.getNumEntries()):
                entry = self.myHandler.getEntry(i)
            self.myHandler.sortEntries()
            pickedObj = self.myHandler.getEntry(0).getIntoNodePath()
            pickedObj = pickedObj.findNetTag('myObjectTag')
            parent = pickedObj.getParent(Thread.getCurrentThread())
            if parent.getNetTag('state') == "in":
                self.AnimateOut(parent)
            elif parent.getNetTag('state') == "out":
                self.AnimateIn(parent)