예제 #1
0
 def setEnabled(self, enabled):
     """enable/disable this board"""
     if isAlive(self):
         # aborting a running game: the underlying C++ object might
         # already have been destroyed
         self.tileDragEnabled = enabled and \
         (self.player.game.isScoringGame() or self.player == self.player.game.myself)
         QGraphicsRectItem.setEnabled(self, enabled)
예제 #2
0
파일: board.py 프로젝트: jsj2008/kdegames
 def placeFocusRect(self):
     """show a blue rect around tile"""
     board = self._focusBoard
     if isAlive(board) and self.__focusRectVisible():
         rect = board.tileFaceRect()
         rect.setWidth(rect.width()*board.focusRectWidth())
         self.focusRect.setRect(rect)
         self.focusRect.setPos(board.focusTile.graphics.pos())
         self.focusRect.setRotation(board.sceneRotation())
         self.focusRect.setScale(board.scale())
         self.focusRect.show()
     else:
         self.focusRect.hide()
예제 #3
0
파일: board.py 프로젝트: jsj2008/kdegames
 def placeTile(self, tile):
     """places the tile in the scene. With direct=False, animate"""
     assert isinstance(tile, Tile)
     for pName, newValue in self.__tilePlace(tile).items():
         animation = tile.queuedAnimation(pName)
         if animation:
             curValue = animation.unpackValue(animation.endValue())
             if curValue != newValue:
                 # change a queued animation
                 animation.setEndValue(newValue)
         else:
             animation = tile.activeAnimation.get(pName, None)
             if isAlive(animation):
                 curValue = animation.unpackValue(animation.endValue())
             else:
                 curValue = tile.getValue(pName)
             if pName != 'scale' or abs(curValue - newValue) > 0.00001:
                 if curValue != newValue:
                     Animation(tile, pName, newValue)
예제 #4
0
def alive():
    alive = util.isAlive(session["game"],session["user"])
    return json.dumps(alive)