[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [kajongg/sid] src: New: Board/ScoringHandBoard._mapMouseTile
From: Wolfgang Rohdewald <wolfgang () rohdewald ! de>
Date: 2013-10-31 21:21:14
Message-ID: E1Vbzg2-0002lj-Kw () scm ! kde ! org
[Download RAW message or body]
Git commit 20bdb451ebc6eef9ff2203cb464694091bf219ac by Wolfgang Rohdewald.
Committed on 31/10/2013 at 15:08.
Pushed by wrohdewald into branch 'sid'.
New: Board/ScoringHandBoard._mapMouseTile
removes scoring game specific code from the general class Board
M +8 -6 src/board.py
M +5 -0 src/handboard.py
http://commits.kde.org/kajongg/20bdb451ebc6eef9ff2203cb464694091bf219ac
diff --git a/src/board.py b/src/board.py
index 93aa02b..0c24631 100644
--- a/src/board.py
+++ b/src/board.py
@@ -296,6 +296,11 @@ class Board(QGraphicsRectItem):
tiles.append(tiles[0])
self.focusTile = tiles[tiles.index(self.focusTile)+1]
+ def _mapMouseTile(self, uiTile): # pylint: disable=no-self-use
+ """map the pressed tile to the wanted tile. For melds, this would
+ be the first tile no matter which one is pressed"""
+ return uiTile
+
def _uiMeldWithTile(self, uiTile): # pylint: disable=no-self-use
"""returns the UI Meld with uiTile. A Board does not know about melds,
so default is to return a Meld with only uiTile"""
@@ -807,15 +812,12 @@ class FittingView(QGraphicsView):
if event.modifiers() & Qt.ShiftModifier:
for uiTile in tiles:
kprint('%s: board.level:%s' % (str(uiTile), uiTile.board.level))
- uiTile = tiles[0]
- board = uiTile.board
- isRemote = board.isHandBoard and board.player and not board.player.game.isScoringGame()
- if board.isHandBoard and not isRemote and not uiTile.isBonus():
- uiTile = uiTile.board.uiMeldWithTile(uiTile)[0]
+ board = tiles[0].board
+ uiTile = board.mapMouseTile(tiles[0])
if uiTile.focusable:
board.focusTile = uiTile
board.hasFocus = True
- if isRemote:
+ if Internal.field.clientDialog:
Internal.field.clientDialog.buttons[0].setFocus()
self.tilePressed = uiTile
else:
diff --git a/src/handboard.py b/src/handboard.py
index 1275954..78872a5 100644
--- a/src/handboard.py
+++ b/src/handboard.py
@@ -322,6 +322,11 @@ class ScoringHandBoard(HandBoard):
result.append(meld2)
return result
+ def _mapMouseTile(self, uiTile):
+ """map the pressed tile to the wanted tile. For melds, this would
+ be the first tile no matter which one is pressed"""
+ return self.uiMeldWithTile(uiTile)[0]
+
def _uiMeldWithTile(self, uiTile):
"""returns the meld with uiTile"""
for myMeld in self.uiMelds:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic