def run(self): t = self.globalClock.getFrameTime() timeDelta = t - self.globalClock.getRealTime() self.globalClock.setRealTime(t) messenger.send('resetClock', [timeDelta]) if self.resumeFunc != None: self.resumeFunc() if self.stepping: self.step() else: self.running = True while self.running: try: if len(self._frameProfileQueue): numFrames, session, callback = self._frameProfileQueue.pop( ) def _profileFunc(numFrames=numFrames): self._doProfiledFrames(numFrames) session.setFunc(_profileFunc) session.run() _profileFunc = None if callback: callback() session.release() else: self.step() except KeyboardInterrupt: self.stop() except SystemExit: self.stop() raise except IOError as ioError: code, message = self._unpackIOError(ioError) if code == 4: self.stop() else: raise except Exception as e: if self.extendedExceptions: self.stop() print_exc_plus() else: if ExceptionVarDump.wantStackDumpLog and ExceptionVarDump.dumpOnExceptionInit: ExceptionVarDump._varDump__print(e) raise except: if self.extendedExceptions: self.stop() print_exc_plus() else: raise self.mgr.stopThreads() return
def run(self): t = self.globalClock.getFrameTime() timeDelta = t - self.globalClock.getRealTime() self.globalClock.setRealTime(t) messenger.send('resetClock', [timeDelta]) if self.resumeFunc != None: self.resumeFunc() if self.stepping: self.step() else: self.running = True while self.running: try: if len(self._frameProfileQueue): numFrames, session, callback = self._frameProfileQueue.pop() def _profileFunc(numFrames = numFrames): self._doProfiledFrames(numFrames) session.setFunc(_profileFunc) session.run() _profileFunc = None if callback: callback() session.release() else: self.step() except KeyboardInterrupt: self.stop() except IOError as ioError: code, message = self._unpackIOError(ioError) if code == 4: self.stop() else: raise except Exception as e: if self.extendedExceptions: self.stop() print_exc_plus() else: if ExceptionVarDump.wantStackDumpLog and ExceptionVarDump.dumpOnExceptionInit: ExceptionVarDump._varDump__print(e) raise except: if self.extendedExceptions: self.stop() print_exc_plus() else: raise self.mgr.stopThreads() return
def run(self): """Starts the task manager running. Does not return until an exception is encountered (including KeyboardInterrupt). """ if PandaSystem.getPlatform() == 'emscripten': return # Set the clock to have last frame's time in case we were # Paused at the prompt for a long time t = self.globalClock.getFrameTime() timeDelta = t - self.globalClock.getRealTime() self.globalClock.setRealTime(t) messenger.send("resetClock", [timeDelta]) if self.resumeFunc is not None: self.resumeFunc() if self.stepping: self.step() else: self.running = True while self.running: try: if len(self._frameProfileQueue) > 0: numFrames, session, callback = self._frameProfileQueue.pop(0) def _profileFunc(numFrames=numFrames): self._doProfiledFrames(numFrames) session.setFunc(_profileFunc) session.run() _profileFunc = None if callback: callback() session.release() else: self.step() except KeyboardInterrupt: self.stop() except SystemExit: self.stop() raise except IOError as ioError: code, message = self._unpackIOError(ioError) # Since upgrading to Python 2.4.1, pausing the execution # often gives this IOError during the sleep function: # IOError: [Errno 4] Interrupted function call # So, let's just handle that specific exception and stop. # All other IOErrors should still get raised. # Only problem: legit IOError 4s will be obfuscated. if code == 4: self.stop() else: raise except Exception as e: if self.extendedExceptions: self.stop() print_exc_plus() else: from direct.showbase import ExceptionVarDump if ExceptionVarDump.wantStackDumpLog and \ ExceptionVarDump.dumpOnExceptionInit: ExceptionVarDump._varDump__print(e) raise except: if self.extendedExceptions: self.stop() print_exc_plus() else: raise self.mgr.stopThreads()
def run(self): """Starts the task manager running. Does not return until an exception is encountered (including KeyboardInterrupt). """ if PandaSystem.getPlatform() == 'emscripten': return # Set the clock to have last frame's time in case we were # Paused at the prompt for a long time t = self.globalClock.getFrameTime() timeDelta = t - self.globalClock.getRealTime() self.globalClock.setRealTime(t) messenger.send("resetClock", [timeDelta]) if self.resumeFunc != None: self.resumeFunc() if self.stepping: self.step() else: self.running = True while self.running: try: if len(self._frameProfileQueue): numFrames, session, callback = self._frameProfileQueue.pop() def _profileFunc(numFrames=numFrames): self._doProfiledFrames(numFrames) session.setFunc(_profileFunc) session.run() _profileFunc = None if callback: callback() session.release() else: self.step() except KeyboardInterrupt: self.stop() except SystemExit: self.stop() raise except IOError as ioError: code, message = self._unpackIOError(ioError) # Since upgrading to Python 2.4.1, pausing the execution # often gives this IOError during the sleep function: # IOError: [Errno 4] Interrupted function call # So, let's just handle that specific exception and stop. # All other IOErrors should still get raised. # Only problem: legit IOError 4s will be obfuscated. if code == 4: self.stop() else: raise except Exception as e: if self.extendedExceptions: self.stop() print_exc_plus() else: if (ExceptionVarDump.wantStackDumpLog and ExceptionVarDump.dumpOnExceptionInit): ExceptionVarDump._varDump__print(e) raise except: if self.extendedExceptions: self.stop() print_exc_plus() else: raise self.mgr.stopThreads()