[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kajongg/sid] src: rename all "tiles" attributes holding a list of uiTile to "uiTiles"
From: Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date: 2013-10-31 21:21:11
Message-ID: E1Vbzfz-0002lj-B2 () scm ! kde ! org
[Download RAW message or body]
Git commit 81c92c524c5b24be399c76bc41042c170285c62c by Wolfgang Rohdewald.
Committed on 31/10/2013 at 10:39.
Pushed by wrohdewald into branch 'sid'.
rename all "tiles" attributes holding a list of uiTile to "uiTiles"
M +16 -16 src/board.py
M +8 -8 src/handboard.py
M +1 -1 src/humanclient.py
M +2 -2 src/playfield.py
M +3 -3 src/scoring.py
M +3 -3 src/tilesetselector.py
M +1 -1 src/visible.py
http://commits.kde.org/kajongg/81c92c524c5b24be399c76bc41042c170285c62c
diff --git a/src/board.py b/src/board.py
index 9d8dd08..3c86a4b 100644
--- a/src/board.py
+++ b/src/board.py
@@ -160,7 +160,7 @@ class Board(QGraphicsRectItem):
arrows = [Qt.Key_Left, Qt.Key_Down, Qt.Key_Up, Qt.Key_Right]
def __init__(self, width, height, tileset, boardRotation=0):
QGraphicsRectItem.__init__(self)
- self.tiles = []
+ self.uiTiles = []
self.isHandBoard = False
self._focusTile = None
self.__prevPos = 0
@@ -186,9 +186,9 @@ class Board(QGraphicsRectItem):
def hide(self):
"""remove all uiTile references so they can be garbage collected"""
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
uiTile.hide()
- self.tiles = []
+ self.uiTiles = []
self._focusTile = None
if isAlive(self):
QGraphicsRectItem.hide(self)
@@ -249,7 +249,7 @@ class Board(QGraphicsRectItem):
the next list element.
respect board orientation: Right Arrow should always move right
relative to the screen, not relative to the board"""
- return sorted([x for x in self.tiles if x.focusable], key=lambda x: \
x.sortKey(sortDir)) + return sorted([x for x in self.uiTiles if x.focusable], \
key=lambda x: x.sortKey(sortDir))
@property
def hasFocus(self):
@@ -297,7 +297,7 @@ class Board(QGraphicsRectItem):
# Original Call.
oldPos = self.focusTile.xoffset, self.focusTile.yoffset
tiles = list(x for x in tiles if (x.xoffset, x.yoffset) != oldPos or x \
== self.focusTile)
- assert tiles, [str(x) for x in self.tiles]
+ assert tiles, [str(x) for x in self.uiTiles]
tiles.append(tiles[0])
self.focusTile = tiles[tiles.index(self.focusTile)+1]
@@ -346,13 +346,13 @@ class Board(QGraphicsRectItem):
def tileAt(self, xoffset, yoffset, level=0):
"""if there is a uiTile at this place, return it"""
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
if (uiTile.xoffset, uiTile.yoffset, uiTile.level) == (xoffset, yoffset, \
level): return uiTile
def tilesByElement(self, element):
"""returns all child items holding a uiTile for element"""
- return list(x for x in self.tiles if x.tile == element)
+ return list(x for x in self.uiTiles if x.tile == element)
def rotatedLightSource(self):
"""the light source we need for the original uiTile before it is rotated"""
@@ -445,7 +445,7 @@ class Board(QGraphicsRectItem):
def showShadows(self, value):
"""set active lightSource"""
if self._showShadows != value:
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
uiTile.setClippingFlags()
self._reload(self.tileset, showShadows=value)
@@ -491,7 +491,7 @@ class Board(QGraphicsRectItem):
child.tileset = tileset
child.lightSource = lightSource
child.showShadows = showShadows
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
self.placeTile(uiTile)
uiTile.update()
self.computeRect()
@@ -569,11 +569,11 @@ class Board(QGraphicsRectItem):
def addUITile(self, uiTile):
"""add uiTile to this board"""
- self.tiles.append(uiTile)
+ self.uiTiles.append(uiTile)
def removeUITile(self, uiTile):
"""remove uiTile from this board"""
- self.tiles.remove(uiTile)
+ self.uiTiles.remove(uiTile)
if self.currentFocusTile == uiTile:
self.focusTile = None
@@ -607,7 +607,7 @@ class CourtBoard(Board):
yScaleFactor = yAvail / yNeeded
QGraphicsRectItem.setPos(self, newSceneX, newSceneY)
Board.setScale(self, min(xScaleFactor, yScaleFactor))
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
uiTile.board.placeTile(uiTile)
class SelectorBoard(CourtBoard):
@@ -624,9 +624,9 @@ class SelectorBoard(CourtBoard):
def load(self, game):
"""load the tiles according to game.ruleset"""
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
uiTile.setBoard(None)
- self.tiles = []
+ self.uiTiles = []
self.allSelectorTiles = list(UITile(x) for x in elements.all(game.ruleset))
self.refill()
@@ -667,7 +667,7 @@ class SelectorBoard(CourtBoard):
self.__placeAvailable(myTile)
myTile.focusable = True
senderHand.deselect(meld)
- (senderHand if senderHand.tiles else self).hasFocus = True
+ (senderHand if senderHand.uiTiles else self).hasFocus = True
self._noPen()
animate()
@@ -699,7 +699,7 @@ class SelectorBoard(CourtBoard):
# pylint: disable=too-many-locals
assert isinstance(uiTile, UITile)
wantedTile = uiTile.tile
- for selectorTile in self.tiles:
+ for selectorTile in self.uiTiles:
selectorTile.tile = selectorTile.tile.lower()
lowerName = wantedTile.lower()
upperName = wantedTile.upper()
diff --git a/src/handboard.py b/src/handboard.py
index dacf166..d21d4dd 100644
--- a/src/handboard.py
+++ b/src/handboard.py
@@ -145,7 +145,7 @@ class HandBoard(Board):
def lowerHalfTiles(self):
"""returns a list with all single tiles of the lower half melds without \
boni"""
- return list(x for x in self.tiles if x.yoffset > 0 and not x.isBonus())
+ return list(x for x in self.uiTiles if x.yoffset > 0 and not x.isBonus())
def newLowerMelds(self):
"""a list of melds for the hand as it should look after sync"""
@@ -247,9 +247,9 @@ class HandBoard(Board):
adding tiles: their board is where they come from. Those tiles
are already in the Player tile lists.
The sender board must not be self, see ScoringPlayer.moveMeld"""
- if not self.tiles and not adding:
+ if not self.uiTiles and not adding:
return
- allTiles = self.tiles[:]
+ allTiles = self.uiTiles[:]
if adding:
allTiles.extend(adding)
self.calcPlaces(allTiles)
@@ -262,7 +262,7 @@ class HandBoard(Board):
physConcealed = list()
for tile in self.player.bonusTiles:
logExposed.append(tile)
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
if uiTile.yoffset == 0 or uiTile.isBonus():
physExposed.append(uiTile.tile)
else:
@@ -384,7 +384,7 @@ class ScoringHandBoard(HandBoard):
self.uiMelds.append(uiMeld)
self.player.addMeld(newMeld)
self.sync()
- self.hasFocus = senderBoard == self or not senderBoard.tiles
+ self.hasFocus = senderBoard == self or not senderBoard.uiTiles
self.checkTiles()
senderBoard.autoSelectTile()
senderBoard.checkTiles()
@@ -413,7 +413,7 @@ class ScoringHandBoard(HandBoard):
def showMoveHelper(self, visible=None):
"""show help text In empty HandBoards"""
if visible is None:
- visible = not self.tiles
+ visible = not self.uiTiles
if self.__moveHelper and not isAlive(self.__moveHelper):
return
if visible:
@@ -452,7 +452,7 @@ class PlayingHandBoard(HandBoard):
def sync(self, adding=None):
"""place all tiles in HandBoard"""
- allTiles = self.tiles[:]
+ allTiles = self.uiTiles[:]
if adding:
allTiles.extend(adding)
newPlaces = self.calcPlaces(allTiles)
@@ -544,5 +544,5 @@ class PlayingHandBoard(HandBoard):
# thus minimizing tile movement within the hand
lastDiscard = matchingTiles[-1]
Internal.field.discardBoard.discardTile(lastDiscard)
- for uiTile in self.tiles:
+ for uiTile in self.uiTiles:
uiTile.focusable = False
diff --git a/src/humanclient.py b/src/humanclient.py
index cb5e6ad..914bbcd 100644
--- a/src/humanclient.py
+++ b/src/humanclient.py
@@ -228,7 +228,7 @@ class ClientDialog(QDialog):
result = [x for x in self.buttons if x.message == answer][0]
result.setFocus()
if answer in [Message.Discard, Message.OriginalCall]:
- for uiTile in game.myself.handBoard.tiles:
+ for uiTile in game.myself.handBoard.uiTiles:
if uiTile.tile == parameter:
game.myself.handBoard.focusTile = uiTile
return result
diff --git a/src/playfield.py b/src/playfield.py
index 5905b0a..f330a0c 100644
--- a/src/playfield.py
+++ b/src/playfield.py
@@ -440,7 +440,7 @@ class ScoringGame(Game):
if isAlive(field):
field.setWindowTitle('Kajongg')
if field:
- field.selectorBoard.tiles = []
+ field.selectorBoard.uiTiles = []
field.selectorBoard.allSelectorTiles = []
if isAlive(field.centralScene):
field.centralScene.removeTiles()
@@ -773,7 +773,7 @@ class PlayField(KXmlGuiWindow):
return True
if key == Qt.Key_Tab and self.game:
tabItems = [self.selectorBoard]
- tabItems.extend(list(p.handBoard for p in self.game.players if \
p.handBoard.tiles)) + tabItems.extend(list(p.handBoard for p in \
self.game.players if p.handBoard.uiTiles)) tabItems.append(tabItems[0])
currentBoard = uiTile.board
currIdx = 0
diff --git a/src/scoring.py b/src/scoring.py
index 46d9ca9..d3c3597 100644
--- a/src/scoring.py
+++ b/src/scoring.py
@@ -925,7 +925,7 @@ class ScoringDialog(QWidget):
if pBox.rule.name == ruleBox.rule.name:
pBox.setChecked(False)
try:
- newState = bool(self.game.winner.handBoard.tiles)
+ newState = bool(self.game.winner.handBoard.uiTiles)
except AttributeError:
newState = False
self.lblLastTile.setEnabled(newState)
@@ -972,7 +972,7 @@ class ScoringDialog(QWidget):
for idx, player in enumerate(self.game.players):
self.spValues[idx].blockSignals(True) # we do not want that change to \
call computeScores again
self.wonBoxes[idx].blockSignals(True) # we do not want that change to \
call computeScores again
- if player.handBoard and player.handBoard.tiles:
+ if player.handBoard and player.handBoard.uiTiles:
self.spValues[idx].setEnabled(False)
self.nameLabels[idx].setBuddy(self.wonBoxes[idx])
for loop in range(10):
@@ -1007,7 +1007,7 @@ class ScoringDialog(QWidget):
lastTiles = set()
winnerTiles = []
if self.game.winner and self.game.winner.handBoard:
- winnerTiles = self.game.winner.handBoard.tiles
+ winnerTiles = self.game.winner.handBoard.uiTiles
pairs = []
for meld in self.game.winner.hand.melds:
if len(meld) < 4:
diff --git a/src/tilesetselector.py b/src/tilesetselector.py
index 1829b84..d36b236 100644
--- a/src/tilesetselector.py
+++ b/src/tilesetselector.py
@@ -43,7 +43,7 @@ class TilesetSelector( QtGui.QWidget):
self.tileView = FittingView()
self.tileView.setScene(self.tileScene)
self.tileset = Tileset(Preferences.tilesetName)
- self.tiles = [UITile('w'+s) for s in WINDS.lower()]
+ self.uiTiles = [UITile('w'+s) for s in WINDS.lower()]
self.board = Board(2, 2, self.tileset)
self.board.showShadows = True
self.tileScene.addItem(self.board)
@@ -51,8 +51,8 @@ class TilesetSelector( QtGui.QWidget):
layout = QHBoxLayout(self.tilesetPreview)
layout.addWidget(self.tileView)
for idx, offsets in enumerate([(0, 0), (0, 1), (1, 0), (1, 1)]):
- self.tiles[idx].setBoard(self.board, *offsets) # pylint: \
disable=star-args
- self.tiles[idx].focusable = False
+ self.uiTiles[idx].setBoard(self.board, *offsets) # pylint: \
disable=star-args + self.uiTiles[idx].focusable = False
self.setUp()
def setUp(self):
diff --git a/src/visible.py b/src/visible.py
index 4f9abe0..0d211b2 100644
--- a/src/visible.py
+++ b/src/visible.py
@@ -137,7 +137,7 @@ class VisiblePlayingPlayer(PlayingPlayer):
"""used for robbing the kong"""
PlayingPlayer.robTile(self, tile)
tile = tile.lower()
- hbTiles = self.handBoard.tiles
+ hbTiles = self.handBoard.uiTiles
lastDiscard = [x for x in hbTiles if x.tile == tile][-1]
lastDiscard.tile = lastDiscard.tile.upper()
Internal.field.discardBoard.lastDiscarded = lastDiscard
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic