Exemple #1
0
    def _enter(self):

        g_KbManager.push()

        g_KbManager.bindKey('d', self.__trackerSetDebugImages, 'tracker set debug images')
        g_KbManager.bindKey('b', self.__bigCamImage, 'big cam image')
        g_KbManager.bindKey('up', self.__keyFuncUP, 'select parameter up')
        g_KbManager.bindKey('down', self.__keyFuncDOWN, 'select parameter down')
        g_KbManager.bindKey('left', self.__keyFuncLEFT, 'value up')
        g_KbManager.bindKey('right', self.__keyFuncRIGHT, 'value down')
        g_KbManager.bindKey('page up', self.__keyFuncPAGEUp, 'value up * 10')
        g_KbManager.bindKey('page down', self.__keyFuncPAGEDown, 'value down * 10')
        g_KbManager.bindKey('s', self.__trackerSaveConfig, 'save configuration')
        g_KbManager.bindKey('g', self.__toggleGUI, 'toggle GUI')
        g_KbManager.bindKey('c', self.__startCoordCalibration,
                            'start geometry calibration')
        g_KbManager.bindKey('w', self.__saveTrackerIMG, 'SAVE trager image')
        g_KbManager.bindKey('h', self.appStarter.tracker.resetHistory, 'RESET history')

        self.appStarter.showTrackerImage()
        self.mainNode.active = True
        self.tracker.setDebugImages(True, True)
        avg.fadeIn(self.mainNode, 400, 1)
        Bitmap = self.tracker.getImage(avg.IMG_DISTORTED)  # Why is this needed?
        self.__onFrameID = player.subscribe(player.ON_FRAME, self.__onFrame)
        #grandparent = self.parentNode.getParent()
        #if grandparent:
        #    grandparent.reorderChild(grandparent.indexOf(self.parentNode), grandparent.getNumChildren()-1)
        self.displayParams()
        if self.hideMainNodeTimeout:
            player.clearInterval(self.hideMainNodeTimeout)
Exemple #2
0
 def enter(self):
     self.game.hideScore()
     self.node.sensitive = True
     avg.fadeIn(self.node, config.STATE_FADE_TIME)
     g_player.setTimeout(20000, self.__back)
     self.eventID = self.node.subscribe(avg.Node.CURSOR_DOWN,
             lambda event: self.__back())
Exemple #3
0
    def __init__(self, graph, getValue):
        self._getValue = getValue    
        self._xSkip = 2     
        self._curUsage = 0
         
        self._rootNode = g_Player.getRootNode()
        size = avg.Point2D(self._rootNode.width-20, self._rootNode.height/6)
        
        self._node = g_Player.createNode("""
            <div opacity="0" sensitive="False" x="10" y="10" size="%(size)s"> 
                <rect strokewidth="0" fillopacity="0.6" fillcolor="FFFFFF" 
                        size="%(size)s"/>
                <words x="10" y="%(wordsheight0)i" color="000080"/>
                <words x="10" y="%(wordsheight1)i" color="000080"/>
                <polyline color="008000"/>
                <polyline color="000080"/>
                <words x="10" y="0" color="000080"/>
            </div>""" 
            % {'size': str(size), 'wordsheight0':size.y-22, 'wordsheight1':size.y-39})
        
        self._graphSize = size-avg.Point2D(20, 20)
        self._rootNode.appendChild(self._node)
        self._textNode0 = self._node.getChild(1)
        self._textNode1 = self._node.getChild(2)
        self._maxLineNode = self._node.getChild(3)
        self._lineNode = self._node.getChild(4)
        self.__graphText = self._node.getChild(5)
        self.__graphText.text = graph

        self._setup()
        avg.fadeIn(self._node, 300)
Exemple #4
0
 def showInfo(self):
     for button in self.level.a:
         button.bg.sensitive = False
         avg.fadeOut(button.bg, 1000)
         avg.fadeOut(button.true, 1000)
         avg.fadeOut(button.false, 1000)
     avg.fadeIn(self.level.info, 1000)
 def MouseOverPic(self,event):
     # Mouse over -> pic change to presspic
     if self.intern_solved:
         pass
     else:                                   # solange das Level noch nicht geloest wurde, also noch nicht gruen ist -> wird es gelb wenn man darueber geht
         event.node.href = self.presspic
         avg.fadeIn(self, 700)
Exemple #6
0
 def alert(self):
     if not self.alert == None:
         self.alert.abort()
         avg.fadeOut(200, self.alert)
     self.alert = newAlert
     self.alert.start(self.alertEnd)
     avg.fadeIn(200, self.alert)
Exemple #7
0
 def alert(self):
     if not self.alert == None:
         self.alert.abort()
         avg.fadeOut(200, self.alert)
     self.alert = newAlert
     self.alert.start(self.alertEnd)
     avg.fadeIn(200, self.alert)
Exemple #8
0
 def setEnabled(self, enabled):
     if enabled:
         avg.fadeIn(self, 1000)
         self.sensitive = True
     else:
         self.opacity = 0
         self.sensitive = False
Exemple #9
0
 def _enter(self):
     
     g_KbManager.push()
     
     g_KbManager.bindKey('d', self.__trackerSetDebugImages, 'tracker set debug images')
     g_KbManager.bindKey('b', self.__bigCamImage, 'big cam image')
     g_KbManager.bindKey('up', self.__keyFuncUP, 'select parameter up')
     g_KbManager.bindKey('down', self.__keyFuncDOWN, 'select parameter down')
     g_KbManager.bindKey('left', self.__keyFuncLEFT, 'value up')
     g_KbManager.bindKey('right', self.__keyFuncRIGHT, 'value down')
     g_KbManager.bindKey('page up', self.__keyFuncPAGEUp, 'value up * 10')
     g_KbManager.bindKey('page down', self.__keyFuncPAGEDown, 'value down * 10')
     g_KbManager.bindKey('s', self.__trackerSaveConfig, 'save configuration')
     g_KbManager.bindKey('g', self.__toggleGUI, 'toggle GUI')
     g_KbManager.bindKey('c', self.__startCoordCalibration,
             'start geometry calibration')
     g_KbManager.bindKey('w', self.__saveTrackerIMG, 'SAVE trager image')
     g_KbManager.bindKey('h', self.appStarter.tracker.resetHistory, 'RESET history')
     
     self.appStarter.showTrackerImage()
     self.mainNode.active=True
     self.tracker.setDebugImages(True, True)
     avg.fadeIn(self.mainNode, 400, 1)
     Bitmap = self.tracker.getImage(avg.IMG_DISTORTED)  # Why is this needed?
     self.__onFrameID = player.subscribe(player.ON_FRAME, self.__onFrame)
     #grandparent = self.parentNode.getParent()
     #if grandparent:
     #    grandparent.reorderChild(grandparent.indexOf(self.parentNode), grandparent.getNumChildren()-1)
     self.displayParams()
     if self.hideMainNodeTimeout:
         player.clearInterval(self.hideMainNodeTimeout)
Exemple #10
0
 def startScroll(self, event):
     # startet das Scrollen
     avg.fadeIn(self.help, 500)          # Hilfetext wird eingeblendet (, dass man das Bild in die Mitte ziehen kann um es zu vergroessern)
     ny = self.scroll.pos.y
     y = event.pos.y
     if self.captureHolder is None:
         self.captureHolder = event.cursorid
         self.dragOffset = ny - y                # Verschiebung nur in der y-Achse
Exemple #11
0
 def __stopIdleDemo(self):
     self.__gameDiv.unsubscribe(self.__demoDownHandlerID)
     player.unsubscribe(player.ON_FRAME, self.__onIdleFrame)
     avg.fadeIn(self.__gameDiv, 200)
     self.__ctrlDiv.sensitive = True
     for p in self.__idlePlayers:
         p.setDead()
     self.__restartIdleTimer()
Exemple #12
0
 def onButtonPressed(self):
     if not (self.isFading):
         if self.runningVideo == 0:
             avg.fadeIn(self.videoNodes[1], self.__duration)
         else:
             avg.fadeOut(self.videoNodes[1], self.__duration)
         player.setTimeout(self.__duration, self.fadeEnd)
         self.runningVideo = (self.runningVideo + 1) % 2
         self.isFading = True
 def blinking(self):
     # Blinken:
     self.opacity = 0            # zur Sicherheit
     self.href = self.presspic   #  "      "
     self.startanimOn = True     # Animation ist an
     if self.i <= 2:             # i = index 
         avg.fadeIn(self, 1000).setStopCallback(self.blinkingCont)   # 0, 1, 2 - > 3 mal einblenden -> jedes mal nach der Animation zu blinkingCont
     else:
         avg.fadeIn(self, 1000).setStopCallback(self.blinkingOff)    # 4. mal einblenden -> danach zu blinkingOff
Exemple #14
0
 def showCursor(self, show):
     if show:
         avg.fadeIn(self.__cursorNode, 200)
         if self.__loupe:
             avg.fadeIn(self.__loupeCursorNode, 200)
     else:
         avg.fadeOut(self.__cursorNode, 200)
         if self.__loupe:
             avg.fadeOut(self.__loupeCursorNode, 200)
Exemple #15
0
 def showCursor(self, show):
     if show:
         avg.fadeIn(self.__cursorNode, 200)
         if self.__loupe:
             avg.fadeIn(self.__loupeCursorNode, 200)
     else:
         avg.fadeOut(self.__cursorNode, 200)
         if self.__loupe:
             avg.fadeOut(self.__loupeCursorNode, 200)
Exemple #16
0
 def onButtonPressed(self):
     if not (self.isFading):
         if self.runningVideo == 0:
             avg.fadeIn(self.videoNodes[1], self.__duration)
         else:
             avg.fadeOut(self.videoNodes[1], self.__duration)
         player.setTimeout(self.__duration, self.fadeEnd)
         self.runningVideo = (self.runningVideo + 1) % 2
         self.isFading = True
Exemple #17
0
 def _setReady(self):
     self.__node.pos = self.__startPos
     self.__heading = Point2D(self.__startHeading)
     self.__body.r = g_gridSize
     self.__body.strokewidth = 1
     self.__body.opacity = 1
     self.__nodeAnim.start()
     avg.fadeIn(self, 200)
     self.__createLine()
Exemple #18
0
    def _onUp(self, event):
        def gone(self):
            BaseTouchVisualization._onUp(self, event)
            self.unlink(True)
            del self

        avg.fadeIn(self.__circle, 100, 1)
        avg.LinearAnim(self.__circle, "size", 100, self.__circle.size, (4, 4)).start()
        avg.LinearAnim(self.__circle, "pos", 100, self.__circle.pos, (-2, -2)).start()
        g_Player.setTimeout(100, lambda: gone(self))
Exemple #19
0
 def startContent(self, content):
     newContent = self.__oldContent
     oldContent = self.__oldContent
     newContent = content
     self.stopContent()
     self.__activeContent = newContent
     if newContent:
         print "starting %s" % newContent
         self.state(self.PLAYING)
         avg.fadeIn(newContent, 600)
Exemple #20
0
 def isFound(self, event):
     # wenn die Fehler-Stelle im Bild angetippt wird, wird ein roter Kreis an dieser Stelle eingeblendet
     avg.fadeIn(event.node, 500)
     avg.LinearAnim(event.node, "pos", 500, (event.node.pos.x +event.node.size.x/2, event.node.pos.y+event.node.size.y/2), (event.node.pos.x,event.node.pos.y) ).start()
     avg.LinearAnim(event.node, "size", 500, (0,0), (event.node.size.x,event.node.size.y) ).start()
     self.level.mistakecounter = self.level.mistakecounter +1            # Fehlercounter wird um 1 erhoeht
     #self.level.mistakefound.text = str(self.level.mistakecounter)
     self.level.mistakedisplay.text = "Fehler "+ str(self.level.mistakecounter) + "/"+ str(self.level.mistakesum)
     self.found = True           # found feld wird auf true gesetzt (spaeter wichitg fuer Abrage ob alle Fehler gefunden sind)
     self.sensitive = False      # Fehler wird "deaktiviert" damit der Counter nicht durch eine Stelle immer wieder erhoeht werden kann
Exemple #21
0
 def click(self, event):
     if self.TorF:
         avg.fadeIn(self.true, 500, 1).setStopCallback(self.showInfo)   # Button wird gruen
         self.level.solved = True        # feld von Level (parent) wird auf true gesetzt
         self.menue.changePic()          # Menue: Solarzelle wird gruen
         if self.hide:                   # blednet Seitenleiste ein
             self.level.slideIn()
     else:
         avg.fadeIn(self.false, 500, 1)  # Button wird rot
         self.level.qFalse = self.level.qFalse + 1   # Frage falsch beantwortet -> Conter wird erhoeht
Exemple #22
0
 def startContent(self, content):
     newContent = self.__oldContent
     oldContent = self.__oldContent
     newContent = content
     self.stopContent()
     self.__activeContent = newContent
     if newContent:
         print "starting %s" % newContent
         self.state(self.PLAYING)
         avg.fadeIn(newContent, 600)
Exemple #23
0
 def restart():
     for p in self.__activePlayers:
         p.setDead(False)
     avg.fadeIn(self.__winsDiv, 200)
     self.__winsDiv.sensitive = True
     self.__activateIdleTimer()
     if forceClearWins:
         self.__clearButton.activate()
     else:
         self.__preStart()
Exemple #24
0
    def _onUp(self, event):
        
        def gone(self):
            BaseTouchVisualization._onUp(self, event)
            self.unlink(True)
            del self

        avg.fadeIn(self.__circle, 100, 1)
        avg.LinearAnim(self.__circle, "size", 100, self.__circle.size, (4,4)).start()
        avg.LinearAnim(self.__circle, "pos", 100, self.__circle.pos, (-2,-2)).start()
        player.setTimeout(100, lambda: gone(self))
Exemple #25
0
    def reset(self):
        self.direction = random()*2.0-1 # from -1.0 to 1.0
        self.direction *= math.pi/5
        if (random() > 0.5): # 50% -> shoot left
            self.direction += math.pi

        self.speed = config.BASE_BALL_SPEED
        self.sleepStartTime = g_player.getFrameTime()
        self.node.opacity = 0
        self.goto(self.startx, self.starty)
        avg.fadeIn(self.node, 1500, 1.0)
Exemple #26
0
 def __onDown(self, event):
     try:
         self.__button.setEventCapture(event.cursorid)
     except RuntimeError:
         pass
     else:
         self.__cursorId = event.cursorid
         self.__buttonInitialPos = event.pos - self.__button.pos
         self.__button.activate(True)
         avg.fadeIn(self.__slider, 100)
         
         return True
Exemple #27
0
 def enter(self):
     self.timeout = g_player.setTimeout(5000, self.onTimeout)
     winnerField = g_player.getElementByID("winner")
     avg.fadeIn(winnerField, config.STATE_FADE_TIME)
     winner_left = g_player.getElementByID("winner_left")
     winner_right = g_player.getElementByID("winner_right")
     if self.game.getWinner() == 0:
         winner_left.opacity = 1
         winner_right.opacity = 0
     else:
         winner_left.opacity = 0
         winner_right.opacity = 1
Exemple #28
0
 def onStructureCollision(self, structure):
     
     deletedelements = structure.removeElementsInArea(self.position, self.explosionRadius )
     self._scorePointsForRemovedCrystal(deletedelements)
     
     node = avg.CircleNode(parent = self._root.getParent(),
                           pos=self.position,
                           r=self.explosionRadius,
                           color="FF0000",
                           
                           )
     avg.fadeIn(node, 200, 1, lambda: avg.fadeOut(node, 500, node.unlink(True) ))
     self.delete()
Exemple #29
0
 def show(self):
     s = self.getMediaSize()
     assert s.x and s.y
     # initial size and position (scaled to screen size and centered)
     self.size = scaleMax(s, self.parent.size)
     self.pos = (self.parent.size - self.size) * 0.5
     # random final size and position (center moved by (dx, dy) and scaled up accordingly)
     dx = float(randint(-ANIM_MAX_MOVE, ANIM_MAX_MOVE))
     dy = float(randint(-ANIM_MAX_MOVE, ANIM_MAX_MOVE))
     size = scaleMin(s, self.size + avg.Point2D(abs(dx), abs(dy)) * 2.0)
     pos = self.pos + avg.Point2D(dx, dy) + (self.size - size) * 0.5
     # start in-transition
     avg.fadeIn(self, TRANS_INTERVAL)
     # start move/scale animation
     avg.ParallelAnim([
             avg.LinearAnim(self, 'size', ANIM_INTERVAL, self.size, size),
             avg.LinearAnim(self, 'pos', ANIM_INTERVAL, self.pos, pos)]).start()
Exemple #30
0
 def nextContent(self):
     newContent = self.__oldContent
     oldContent = self.__oldContent
     print 'content : %d %s' % (len(self.content), self.content)
     if(len(self.content) == 0):
         print 'nothing found'
         g_player.setTimeout(1000, self.nextContent)
     elif(len(self.content) == 1):
         print 'only one object'
         newContent = self.content[0]
     else:
         print 'random content: old %s : new %s ' % (oldContent, newContent)
         while newContent == oldContent:
             print '1content chosen %s ' % newContent
             newContent = random.choice(self.content)
             print '2content chosen %s ' % newContent
     self.__activeContent = newContent
     if newContent:
         self.state(self.PLAYING)
         avg.fadeIn(newContent, 600)
Exemple #31
0
 def nextContent(self):
     newContent = self.__oldContent
     oldContent = self.__oldContent
     print 'content : %d %s' % (len(self.content), self.content)
     if (len(self.content) == 0):
         print 'nothing found'
         g_player.setTimeout(1000, self.nextContent)
     elif (len(self.content) == 1):
         print 'only one object'
         newContent = self.content[0]
     else:
         print 'random content: old %s : new %s ' % (oldContent, newContent)
         while newContent == oldContent:
             print '1content chosen %s ' % newContent
             newContent = random.choice(self.content)
             print '2content chosen %s ' % newContent
     self.__activeContent = newContent
     if newContent:
         self.state(self.PLAYING)
         avg.fadeIn(newContent, 600)
Exemple #32
0
    def testFadeIn(self):
        def onStop():
            self.__onStopCalled = True

        self.initScene()
        self.__node.opacity = 0.5
        self.__onStopCalled = False
        self.start(False,
                   (lambda: avg.fadeIn(self.__node, 200, 1, onStop),
                    lambda: self.compareImage("testFadeIn1"),
                    lambda: self.compareImage("testFadeIn2"),
                    lambda: self.compareImage("testFadeIn3"),
                    lambda: self.assert_(self.__onStopCalled),
                    lambda: self.assertEqual(avg.getNumRunningAnims(), 0)))
        self.__anim = None
Exemple #33
0
    def testFadeIn(self):
        def onStop():
            self.__onStopCalled = True

        self.initScene()
        self.__node.opacity=0.5
        self.__onStopCalled = False
        self.start(False,
                (lambda: avg.fadeIn(self.__node, 200, 1, onStop),
                 lambda: self.compareImage("testFadeIn1"),
                 lambda: self.compareImage("testFadeIn2"),
                 lambda: self.compareImage("testFadeIn3"),
                 lambda: self.assert_(self.__onStopCalled),
                 lambda: self.assertEqual(avg.getNumRunningAnims(), 0)
                ))
        self.__anim = None
Exemple #34
0
 def doZoom(self, event):
     # Bild wird vergroessert und auf die richitge Position gesetzt + "x"-Schliessen-Button wird eingeblendet
     avg.EaseInOutAnim(event.node, "pos", 1000, event.node.pos, avg.Point2D(- 1170, 130+ (-self.scroll.pos.y)), 50, 1000).start()
     avg.EaseInOutAnim(event.node, "size", 1000, event.node.size, avg.Point2D(1070,690), 50, 1000).start()
     avg.fadeIn(self.close, 1000)
Exemple #35
0
 def setReady(self):
     avg.fadeIn(self.__textNode, 200)
     self.__idlePlayer.setReady()
Exemple #36
0
 def activate(self):
     self.__node.fillopacity = 0.2 # needs libavg-r4503 bugfix to avoid crash
     avg.fadeIn(self.__node, 200, 0.5)
     self.__node.sensitive = True
 def changePic(self):
     # die Zelle wird gruen
     self.opacity = 0            # zur Sicherheit, dass die Animation wirkich einblendent
     self.href= self.solvedpic   # zur Sicherheit, dass es das richtige Bild ist
     avg.fadeIn(self, 1000)      # blendet die gruene Solarzelle ein
     self.intern_solved = True   
Exemple #38
0
 def _enter(self):
     avg.fadeIn(self.game_node, 400, 1.0)
     self.enterStartState()
Exemple #39
0
 def __start_meets_future(self):
     # anim.LinearAnim(Player.getElementByID("meets_future"),
     # "opacity", 2000, 1.0, 0.0, 0, None)
     avg.fadeIn(self.__meets_future, 1000)
Exemple #40
0
 def blink(self):
     def reset():
         avg.fadeOut(self, 180)
     avg.fadeIn(self, 80, random.uniform(0.05, self.maxOpacity), reset)
Exemple #41
0
 def reset(self):
     self.__numLives = 3
     for img in self.__images:
         avg.fadeIn(img, 250)
Exemple #42
0
 def __start_where_past(self):
     avg.fadeIn(self.__where_past, 1000)
Exemple #43
0
 def __fadeInNukeAlert(self):
     self.__nukeAnim = avg.fadeIn(self.nukeAlert, 100, 1, self.__fadeOutNukeAlert)
Exemple #44
0
 def __start_url(self):
     avg.fadeIn(self.__www_cwars_com, 1000)
Exemple #45
0
 def _doTransIn(self, postCb):
     avg.fadeIn(self, self.TRANS_DURATION, 1, postCb)
Exemple #46
0
 def showButton(self):
     self.bg.sensitive = True
     avg.fadeIn(self.bg, 1000)
Exemple #47
0
 def __start_url(self):
     avg.fadeIn(self.__www_cwars_com, 1000)
Exemple #48
0
 def __start_where_past(self):
     avg.fadeIn(self.__where_past, 1000)
Exemple #49
0
 def reset(self):
     self.__numLives = 3
     for img in self.__images:
         avg.fadeIn(img, 250)
Exemple #50
0
 def playTeaser(self, text):
     self.__teaser.text = text
     avg.fadeIn(self.__teaser, 200, 1, self.__teaserTimer)
Exemple #51
0
 def __start_meets_future(self):
     # anim.LinearAnim(Player.getElementByID("meets_future"), 
     # "opacity", 2000, 1.0, 0.0, 0, None)
     avg.fadeIn(self.__meets_future, 1000)