예제 #1
0
    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()
예제 #2
0
    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)
예제 #3
0
    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()
예제 #4
0
 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
예제 #5
0
파일: mdi.py 프로젝트: bleepbloop/Pivy
 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
예제 #6
0
    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)
예제 #7
0
def readFile(file):
    myInput = SoInput()
    myInput.openFile(file)
    return SoDB.readAll(myInput)
예제 #8
0
def readBuffer(texto):
    input = SoInput()
    input.setBuffer(texto)
    return SoDB.readAll(input)
예제 #9
0
    def __del__(self):
        SoDB.getSensorManager().setChangedCallback(None, None)

        if self._signalthread.isRunning():
            self._signalthread.stopThread()
            self._signalthread.wait()
예제 #10
0
 def delayTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     SoDB.getSensorManager().processDelayQueue(False)
     self.sensorQueueChanged()
예제 #11
0
 def timerQueueTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     self.sensorQueueChanged()
예제 #12
0
 def idleTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     SoDB.getSensorManager().processDelayQueue(True)
     self.sensorQueueChanged()
예제 #13
0
    def __del__(self):
        SoDB.getSensorManager().setChangedCallback(None, None)

        if self._signalthread.isRunning():
            self._signalthread.stopThread()
            self._signalthread.wait()
예제 #14
0
 def delayTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     SoDB.getSensorManager().processDelayQueue(False)
     self.sensorQueueChanged()
예제 #15
0
 def timerQueueTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     self.sensorQueueChanged()
예제 #16
0
 def idleTimeout(self):
     SoDB.getSensorManager().processTimerQueue()
     SoDB.getSensorManager().processDelayQueue(True)
     self.sensorQueueChanged()