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 =3D tiles[tiles.index(self.focusTile)+1] = + def _mapMouseTile(self, uiTile): # pylint: disable=3Dno-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=3Dno-self-use """returns the UI Meld with uiTile. A Board does not know about me= lds, 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.boa= rd.level)) - uiTile =3D tiles[0] - board =3D uiTile.board - isRemote =3D board.isHandBoard and board.player and not board.= player.game.isScoringGame() - if board.isHandBoard and not isRemote and not uiTile.isBonus(): - uiTile =3D uiTile.board.uiMeldWithTile(uiTile)[0] + board =3D tiles[0].board + uiTile =3D board.mapMouseTile(tiles[0]) if uiTile.focusable: board.focusTile =3D uiTile board.hasFocus =3D True - if isRemote: + if Internal.field.clientDialog: Internal.field.clientDialog.buttons[0].setFocus() self.tilePressed =3D 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: