def onInit(self): player.showCursor(True) self.videoListNode = avg.DivNode(parent=self) self.videoNodes = [] fileNames = os.listdir(self.__folder) i = 0 for fileName in fileNames: try: videoNode = avg.VideoNode(pos=(i * (self.__thumbWidth + 20), 0), href=self.__folder + '/' + fileName, loop=True, mipmap=True, enablesound=False, parent=self.videoListNode) videoNode.play() self.videoNodes.append(videoNode) size = videoNode.getMediaSize() height = (self.__thumbWidth * size.y) / size.x videoNode.size = (self.__thumbWidth, height) videoNode.subscribe(videoNode.CURSOR_DOWN, lambda event, videoNode=videoNode: self. chooseVideo(event, videoNode)) i += 1 except RuntimeError: pass self.subscribe(self.CURSOR_MOTION, self.onMouseMove) self.bigVideoNode = None
def __init__(self, appClass, resolution=DEFAULT_RESOLUTION, debugWindowSize=None, fakeFullscreen=False): resolution = Point2D(resolution) testMode = not 'AVG_DEPLOY' in os.environ if testMode and debugWindowSize is not None: debugWindowSize = Point2D(debugWindowSize) else: debugWindowSize = Point2D(0, 0) if fakeFullscreen: if os.name != 'nt': raise RuntimeError('Fakefullscreen is supported only on windows') elif not testMode: self.__enableFakeFullscreen() fullscreen = False else: fullscreen = not testMode player.enableMouse(not 'AVG_DISABLE_MOUSE' in os.environ) player.showCursor(testMode) self._setupBaseDivs(resolution) player.setResolution( fullscreen, int(debugWindowSize.x), int(debugWindowSize.y), 0 # color depth ) self._startApp(appClass)
def onInit(self): player.showCursor(True) self.videoListNode = avg.DivNode(parent=self) self.videoNodes = [] fileNames = os.listdir(self.__folder) i = 0 for fileName in fileNames: try: videoNode = avg.VideoNode( pos=(i*(self.__thumbWidth+20), 0), href=self.__folder+'/'+fileName, loop=True, mipmap=True, enablesound=False, parent = self.videoListNode) videoNode.play() self.videoNodes.append(videoNode) size = videoNode.getMediaSize() height = (self.__thumbWidth*size.y)/size.x videoNode.size = (self.__thumbWidth, height) videoNode.subscribe(videoNode.CURSOR_DOWN, lambda event, videoNode=videoNode: self.chooseVideo(event, videoNode)) i += 1 except RuntimeError: pass self.subscribe(self.CURSOR_MOTION, self.onMouseMove) self.bigVideoNode = None
def init(self): player.showCursor(True) self.__minCutoffSlider = LabledSlider(label="Minimum Cutoff", min=0.3, max=8.0, formatStr="%.1f", onChange=self.__onSliderMove, pos=(10,10), parent=self._parentNode) self.__cutoffSlopeSlider = LabledSlider(label="Cutoff Slope", min=0.0, max=0.05, formatStr="%.3f", onChange=self.__onSliderMove, pos=(10,50), parent=self._parentNode) self.__onSliderMove() self._parentNode.subscribe(avg.Node.CURSOR_DOWN, self.__onDown) self.__contact = None self.__rawContactCircle = avg.CircleNode(r=7*player.getPixelsPerMM(), color="FF0000", opacity=0, parent=self._parentNode) self.__filteredContactCircle = avg.CircleNode(r=7*player.getPixelsPerMM(), color="00FF00", opacity=0, parent=self._parentNode) self.__filters = None
def testBasics(self): def getFramerate(): framerate = player.getEffectiveFramerate() self.assert_(framerate > 0) self.assert_(player.getVideoRefreshRate() > 0) def invalidCreateNode(): avg.ImageNode(1, 2, 3) player.showCursor(0) self.assert_(not (player.isCursorShown())) player.showCursor(1) self.assert_(player.isCursorShown()) root = self.loadEmptyScene() avg.ImageNode(href="rgb24-65x65.png", parent=root) self.assertEqual(root.getChild(0).getParent(), root) self.assertEqual(root.getChild(0).parent, root) self.assertRaises(avg.Exception, invalidCreateNode) self.start(False, ( getFramerate, lambda: self.compareImage("testbasics"), lambda: player.setGamma(0.3, 0.3, 0.3), lambda: player.showCursor(0), lambda: self.assert_(not (player.isCursorShown())), lambda: player.showCursor(1), ))
def testBasics(self): def getFramerate(): framerate = player.getEffectiveFramerate() self.assert_(framerate > 0) self.assert_(player.getVideoRefreshRate() > 0) def invalidCreateNode(): avg.ImageNode(1, 2, 3) player.showCursor(0) self.assert_(not(player.isCursorShown())) player.showCursor(1) self.assert_(player.isCursorShown()) root = self.loadEmptyScene() avg.ImageNode(href="rgb24-65x65.png", parent=root) self.assertEqual(root.getChild(0).getParent(), root) self.assertEqual(root.getChild(0).parent, root) self.assertRaises(avg.Exception, invalidCreateNode) self.start(False, (getFramerate, lambda: self.compareImage("testbasics"), lambda: player.setGamma(0.3, 0.3, 0.3), lambda: player.showCursor(0), lambda: self.assert_(not(player.isCursorShown())), lambda: player.showCursor(1), ))
def testBasics(self): def getFramerate(): framerate = player.getEffectiveFramerate() self.assert_(framerate > 0) def invalidCreateNode(): avg.ImageNode(1, 2, 3) player.showCursor(0) player.showCursor(1) root = self.loadEmptyScene() avg.ImageNode(href="rgb24-65x65.png", parent=root) self.assertException(invalidCreateNode) self.start(False, (getFramerate, lambda: self.compareImage("testbasics"), lambda: player.setGamma(0.3, 0.3, 0.3), lambda: player.showCursor(0), lambda: player.showCursor(1), ))
def testBasics(self): def getFramerate(): framerate = player.getEffectiveFramerate() self.assert_(framerate > 0) def invalidCreateNode(): avg.ImageNode(1, 2, 3) player.showCursor(0) player.showCursor(1) root = self.loadEmptyScene() avg.ImageNode(href="rgb24-65x65.png", parent=root) self.assertRaises(RuntimeError, invalidCreateNode) self.start(False, ( getFramerate, lambda: self.compareImage("testbasics"), lambda: player.setGamma(0.3, 0.3, 0.3), lambda: player.showCursor(0), lambda: player.showCursor(1), ))
def setupPointer(self, instance): self._parentNode.appendChild(instance) instance.sensitive = False self.__pointer = instance player.showCursor(False)