def sensorQueueChanged(self): sensormanager = SoDB.getSensorManager() assert (sensormanager) interval = sensormanager.isTimerSensorPending() if interval: interval -= SbTime.getTimeOfDay() if interval.getValue() <= 0.0: interval.setValue(1.0 / 5000.0) if not self._timerqueuetimer.isActive(): # FIXME jkg: frodo changed this to time.getMsecValue() in C++ Quarter. test and apply. self._timerqueuetimer.start(interval.getMsecValue()) else: self._timerqueuetimer.setInterval(interval.getMsecValue()) elif self._timerqueuetimer.isActive(): self._timerqueuetimer.stop() if sensormanager.isDelaySensorPending(): self._idletimer.start(0) if not self._delaytimer.isActive(): time = SoDB.getDelaySensorTimeout() if time != SbTime.zero(): self._delaytimer.start(interval.getMsecValue()) else: if self._idletimer.isActive(): self._idletimer.stop() if self._delaytimer.isActive(): self._delaytimer.stop()
def __init__(self): QObject.__init__(self, None) self._mainthreadid = QThread.currentThreadId() self._signalthread = SignalThread() QObject.connect(self._signalthread, SIGNAL("triggerSignal()"), self.sensorQueueChanged) self._idletimer = QTimer() self._delaytimer = QTimer() self._timerqueuetimer = QTimer() self._idletimer.setSingleShot(True) self._delaytimer.setSingleShot(True) self._timerqueuetimer.setSingleShot(True) self.connect(self._idletimer, SIGNAL("timeout()"), self.idleTimeout) self.connect(self._delaytimer, SIGNAL("timeout()"), self.delayTimeout) self.connect(self._timerqueuetimer, SIGNAL("timeout()"), self.timerQueueTimeout) SoDB.getSensorManager().setChangedCallback(self.sensorQueueChangedCB, self) SoDB.setRealTimeInterval(1.0 / 25.0) SoRenderManager.enableRealTimeUpdate(False)
def sensorQueueChanged(self): sensormanager = SoDB.getSensorManager() assert(sensormanager) interval = sensormanager.isTimerSensorPending() if interval: interval -= SbTime.getTimeOfDay() if interval.getValue() <= 0.0: interval.setValue(1.0/5000.0) if not self._timerqueuetimer.isActive(): # FIXME jkg: frodo changed this to time.getMsecValue() in C++ Quarter. test and apply. self._timerqueuetimer.start(interval.getMsecValue()) else: self._timerqueuetimer.setInterval(interval.getMsecValue()) elif self._timerqueuetimer.isActive(): self._timerqueuetimer.stop() if sensormanager.isDelaySensorPending(): self._idletimer.start(0) if not self._delaytimer.isActive(): time = SoDB.getDelaySensorTimeout() if time != SbTime.zero(): self._delaytimer.start(interval.getMsecValue()) else: if self._idletimer.isActive(): self._idletimer.stop() if self._delaytimer.isActive(): self._delaytimer.stop()
def loadFile(self, filename): in_ = SoInput() if (in_.openFile(str(filename.toLatin1()))): root = SoDB.readAll(in_) if (root): self.setSceneGraph(root) self.currentfile = filename self.setWindowTitle(filename) return True return False
def readFile(file): myInput = SoInput() myInput.openFile(file) return SoDB.readAll(myInput)
def readBuffer(texto): input = SoInput() input.setBuffer(texto) return SoDB.readAll(input)
def __del__(self): SoDB.getSensorManager().setChangedCallback(None, None) if self._signalthread.isRunning(): self._signalthread.stopThread() self._signalthread.wait()
def delayTimeout(self): SoDB.getSensorManager().processTimerQueue() SoDB.getSensorManager().processDelayQueue(False) self.sensorQueueChanged()
def timerQueueTimeout(self): SoDB.getSensorManager().processTimerQueue() self.sensorQueueChanged()
def idleTimeout(self): SoDB.getSensorManager().processTimerQueue() SoDB.getSensorManager().processDelayQueue(True) self.sensorQueueChanged()