Exemple #1
0
 def pause(self):
     logging.debug("--------------pause-------------")
     self._timer.stop()
     buttleData = ButtleDataSingleton().get()
     if buttleData.getVideoIsPlaying():
         buttleData.setVideoIsPlaying(False)
         # close processGraph and delete it
         buttleData.getProcessGraph().endSequence()
         buttleData.setProcessGraph(None)
     self.framePlayerChanged.emit()
Exemple #2
0
 def pause(self):
     logging.debug("--------------pause-------------")
     self._timer.stop()
     buttleData = ButtleDataSingleton().get()
     if buttleData.getVideoIsPlaying():
         buttleData.setVideoIsPlaying(False)
         # close processGraph and delete it
         buttleData.getProcessGraph().endSequence()
         buttleData.setProcessGraph(None)
     self.framePlayerChanged.emit()
Exemple #3
0
 def stop(self):
     logging.debug("--------------stop-------------")
     self._timer.stop()
     buttleData = ButtleDataSingleton().get()
     # if a video is reading, we need to close the processGraph
     if buttleData.getVideoIsPlaying():
         buttleData.setVideoIsPlaying(False)
         # close processGraph and delete it
         buttleData.getProcessGraph().endSequence()
         buttleData.setProcessGraph(None)
         # return to the beginning of the video
     self._frame = 0
     self.framePlayerChanged.emit()
Exemple #4
0
 def stop(self):
     logging.debug("--------------stop-------------")
     self._timer.stop()
     buttleData = ButtleDataSingleton().get()
     # if a video is reading, we need to close the processGraph
     if buttleData.getVideoIsPlaying():
         buttleData.setVideoIsPlaying(False)
         # close processGraph and delete it
         buttleData.getProcessGraph().endSequence()
         buttleData.setProcessGraph(None)
         # return to the beginning of the video
     self._frame = 0
     self.framePlayerChanged.emit()
Exemple #5
0
    def computeNode(self, node, frame):
        """
            Computes the node (displayed in the viewer) at the frame indicated.
        """
        buttleData = ButtleDataSingleton().get()
        graphTuttle = buttleData.getGraph().getGraphTuttle()

        #Get the output where we save the result
        self._tuttleImageCache = tuttle.MemoryCache()

        if buttleData.getVideoIsPlaying():  # if a video is playing
            processGraph = buttleData.getProcessGraph()
            processGraph.setupAtTime(frame)
            processGraph.processAtTime(self._tuttleImageCache, frame)
        else:  # if it's an image only
            processOptions = tuttle.ComputeOptions(int(frame))
            processGraph = tuttle.ProcessGraph(processOptions, graphTuttle,
                                               [node])
            processGraph.setup()
            timeRange = tuttle.TimeRange(frame, frame,
                                         1)  # buttleData.getTimeRange()
            processGraph.beginSequence(timeRange)
            processGraph.setupAtTime(frame)
            processGraph.processAtTime(self._tuttleImageCache, frame)
            processGraph.endSequence()

        self._computedImage = self._tuttleImageCache.get(0)

        #Add the computedImage to the map
        hashMap = tuttle.NodeHashContainer()
        graphTuttle.computeGlobalHashAtTime(hashMap, frame)
        hasCode = hashMap.getHash(node, frame)
        #Max 15 computedImages saved in memory
        if hasCode not in buttleData._mapNodeNameToComputedImage.keys(
        ) and len(buttleData._mapNodeNameToComputedImage) < 15:
            buttleData._mapNodeNameToComputedImage.update(
                {hasCode: self._computedImage})
        elif hasCode not in buttleData._mapNodeNameToComputedImage.keys(
        ) and len(buttleData._mapNodeNameToComputedImage) >= 15:
            #Delete a computed image from the memory (random)
            buttleData._mapNodeNameToComputedImage.popitem()
            buttleData._mapNodeNameToComputedImage.update(
                {hasCode: self._computedImage})

        return self._computedImage
Exemple #6
0
    def computeNode(self, node, frame):
        """
            Computes the node (displayed in the viewer) at the frame indicated.
        """
        buttleData = ButtleDataSingleton().get()
        graphTuttle = buttleData.getGraph().getGraphTuttle()

        #Get the output where we save the result
        self._tuttleImageCache = tuttle.MemoryCache()

        if buttleData.getVideoIsPlaying():  # if a video is playing
            processGraph = buttleData.getProcessGraph()
            processGraph.setupAtTime(frame)
            processGraph.processAtTime(self._tuttleImageCache, frame)
        else:  # if it's an image only
            processOptions = tuttle.ComputeOptions(int(frame))
            processGraph = tuttle.ProcessGraph(processOptions, graphTuttle, [node])
            processGraph.setup()
            timeRange = tuttle.TimeRange(frame, frame, 1)  # buttleData.getTimeRange()
            processGraph.beginSequence(timeRange)
            processGraph.setupAtTime(frame)
            processGraph.processAtTime(self._tuttleImageCache, frame)
            processGraph.endSequence()

        self._computedImage = self._tuttleImageCache.get(0)

        #Add the computedImage to the map
        hashMap = tuttle.NodeHashContainer()
        graphTuttle.computeGlobalHashAtTime(hashMap, frame)
        hasCode = hashMap.getHash(node, frame)
        #Max 15 computedImages saved in memory
        if hasCode not in buttleData._mapNodeNameToComputedImage.keys() and len(buttleData._mapNodeNameToComputedImage) < 15:
            buttleData._mapNodeNameToComputedImage.update({hasCode: self._computedImage})
        elif hasCode not in buttleData._mapNodeNameToComputedImage.keys() and len(buttleData._mapNodeNameToComputedImage) >= 15:
            #Delete a computed image from the memory (random)
            buttleData._mapNodeNameToComputedImage.popitem()
            buttleData._mapNodeNameToComputedImage.update({hasCode: self._computedImage})

        return self._computedImage