From kde-commits Fri Jul 31 23:04:33 2009 From: Wolfgang Rohdewald Date: Fri, 31 Jul 2009 23:04:33 +0000 To: kde-commits Subject: playground/games/kmj Message-Id: <1249081473.496014.11386.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=124908148707691 SVN commit 1005399 by wrohdewald: moving tiles with keyboard: only shift modifier is allowed M +2 -0 Changelog M +7 -2 src/playfield.py --- trunk/playground/games/kmj/Changelog #1005398:1005399 @@ -8,6 +8,8 @@ - do not require sipconfig module anymore - remove patterns from manual - many pylintifications +- moving tiles with keyboard ESWNX: ignore key if another modifier than Shift + is found: CTRL-N must not move to north but start a new game 21 Jul 2009 Release 0.3.1 - convert all rules to regular expressions and remove Pattern code. --- trunk/playground/games/kmj/src/playfield.py #1005398:1005399 @@ -316,7 +316,7 @@ view.horizontalHeader().setStretchLastSection(True) view.verticalScrollBar().setValue(view.verticalScrollBar().maximum()) - +# TODO: explainview und scoretable auch toggeln, wie EnterHand class ExplainView(QListView): """show a list explaining all score computations""" def __init__(self, game, parent=None): @@ -1264,6 +1264,11 @@ def keyPressEvent(self, event): """navigate in the selectorboard""" + mod = event.modifiers() + if not mod in (Qt.NoModifier, Qt.ShiftModifier): + # no other modifier is allowed + KXmlGuiWindow.keyPressEvent(self, event) + return key = event.key() tile = self.centralScene.focusItem() currentBoard = tile.board if isinstance(tile, Tile) else None @@ -1281,7 +1286,7 @@ receiver.sendTile(tile) else: receiver = self.playerByWind(WINDS[moveCommands.index(wind)]).handBoard - receiver.sendTile(tile, self.centralView, lowerHalf=event.modifiers() & Qt.ShiftModifier) + receiver.sendTile(tile, self.centralView, lowerHalf=mod & Qt.ShiftModifier) if not currentBoard.allTiles(): self.centralView.scene().setFocusItem(receiver.focusTile) return