Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Games
Kajongg
Commits
5e01f656
Commit
5e01f656
authored
May 06, 2021
by
Wolfgang Rohdewald
Browse files
pylint: rename Board.hasFocus to Board.hasLogicalFocus
because it should not override QGraphicsItem.hasFocus
parent
86d5a9c9
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/board.py
View file @
5e01f656
...
...
@@ -251,7 +251,7 @@ class Board(QGraphicsRectItem, StrMixin):
if
self
.
_focusTile
and
self
.
_focusTile
.
tile
in
Debug
.
focusable
:
logDebug
(
'%s: new focus uiTile %s from %s'
%
(
self
.
name
,
self
.
_focusTile
.
tile
if
self
.
_focusTile
else
'None'
,
stack
(
''
)[
-
1
]))
if
self
.
hasFocus
:
if
self
.
has
Logical
Focus
:
self
.
scene
().
focusBoard
=
self
def
setEnabled
(
self
,
enabled
):
...
...
@@ -268,14 +268,17 @@ class Board(QGraphicsRectItem, StrMixin):
return
sorted
((
x
for
x
in
self
.
uiTiles
if
x
.
focusable
),
key
=
lambda
x
:
x
.
sortKey
(
sortDir
))
@
property
def
hasFocus
(
self
):
def
has
Logical
Focus
(
self
):
"""defines if this board should show a focusRect
if another board has focus, setting this to False does
not change scene.focusBoard"""
not change scene.focusBoard
Up to May 2021, this was called hasFocus, overriding QGraphicsItem.hasFocus
but pylint did not like that."""
return
self
.
scene
()
and
self
.
scene
().
focusBoard
==
self
and
self
.
_focusTile
@
hasFocus
.
setter
def
hasFocus
(
self
,
value
):
@
has
Logical
Focus
.
setter
def
has
Logical
Focus
(
self
,
value
):
"""set focus on this board"""
if
isAlive
(
self
):
scene
=
self
.
scene
()
...
...
@@ -517,7 +520,7 @@ class Board(QGraphicsRectItem, StrMixin):
self
.
placeTile
(
uiTile
)
uiTile
.
update
()
self
.
computeRect
()
if
self
.
hasFocus
:
if
self
.
has
Logical
Focus
:
self
.
scene
().
focusBoard
=
self
def
focusRectWidth
(
self
):
# pylint: disable=no-self-use
...
...
@@ -669,7 +672,7 @@ class SelectorBoard(CourtBoard):
self
.
__placeAvailable
(
myTile
)
myTile
.
focusable
=
True
senderHand
.
deselect
(
uiMeld
)
(
senderHand
if
senderHand
.
uiTiles
else
self
).
hasFocus
=
True
(
senderHand
if
senderHand
.
uiTiles
else
self
).
has
Logical
Focus
=
True
self
.
_noPen
()
animate
()
...
...
@@ -823,7 +826,7 @@ class FittingView(QGraphicsView):
uiTile
=
board
.
mapMouseTile
(
tiles
[
0
])
if
uiTile
.
focusable
:
board
.
focusTile
=
uiTile
board
.
hasFocus
=
True
board
.
has
Logical
Focus
=
True
if
hasattr
(
Internal
.
scene
,
'clientDialog'
):
if
Internal
.
scene
.
clientDialog
:
Internal
.
scene
.
clientDialog
.
buttons
[
0
].
setFocus
()
...
...
@@ -941,7 +944,7 @@ class DiscardBoard(CourtBoard):
uiTile
.
dark
=
False
uiTile
.
focusable
=
False
self
.
focusTile
=
uiTile
self
.
hasFocus
=
True
self
.
has
Logical
Focus
=
True
self
.
lastDiscarded
=
uiTile
def
dropEvent
(
self
,
event
):
...
...
src/handboard.py
View file @
5e01f656
...
...
@@ -342,7 +342,7 @@ class PlayingHandBoard(HandBoard):
if
focusCandidates
:
self
.
focusTile
=
focusCandidates
[
0
]
Internal
.
scene
.
handSelectorChanged
(
self
)
self
.
hasFocus
=
bool
(
adding
)
self
.
has
Logical
Focus
=
bool
(
adding
)
@
Board
.
focusTile
.
setter
def
focusTile
(
self
,
uiTile
):
# pylint: disable=arguments-differ
...
...
src/scene.py
View file @
5e01f656
...
...
@@ -84,7 +84,7 @@ class FocusRect(QGraphicsRectItem, StrMixin):
self
.
setPos
(
board
.
focusTile
.
pos
)
game
=
Internal
.
scene
.
game
self
.
setVisible
(
board
.
isVisible
()
and
bool
(
board
.
focusTile
)
and
board
.
isEnabled
()
and
board
.
hasFocus
and
bool
(
game
)
and
not
game
.
autoPlay
)
and
board
.
isEnabled
()
and
board
.
has
Logical
Focus
and
bool
(
game
)
and
not
game
.
autoPlay
)
def
__str__
(
self
):
...
...
@@ -455,7 +455,7 @@ class ScoringScene(GameScene):
def
__init__
(
self
,
parent
=
None
):
self
.
scoringDialog
=
None
super
().
__init__
(
parent
)
self
.
selectorBoard
.
hasFocus
=
True
self
.
selectorBoard
.
has
Logical
Focus
=
True
@
GameScene
.
game
.
setter
def
game
(
self
,
value
):
# pylint: disable=arguments-differ
...
...
@@ -539,7 +539,7 @@ class ScoringScene(GameScene):
currIdx
=
0
while
tabItems
[
currIdx
]
!=
currentBoard
and
currIdx
<
len
(
tabItems
)
-
2
:
currIdx
+=
1
tabItems
[
currIdx
+
1
].
hasFocus
=
True
tabItems
[
currIdx
+
1
].
has
Logical
Focus
=
True
return
True
return
False
...
...
src/scoring.py
View file @
5e01f656
...
...
@@ -244,7 +244,7 @@ class ScoringHandBoard(HandBoard):
self
.
uiMelds
.
append
(
uiMeld
)
self
.
player
.
addMeld
(
uiMeld
.
meld
)
self
.
sync
()
self
.
hasFocus
=
senderBoard
==
self
or
not
senderBoard
.
uiTiles
self
.
has
Logical
Focus
=
senderBoard
==
self
or
not
senderBoard
.
uiTiles
self
.
checkTiles
()
senderBoard
.
autoSelectTile
()
senderBoard
.
checkTiles
()
...
...
@@ -514,7 +514,7 @@ class ScoringGame(Game):
if
not
self
.
finished
():
selector
=
Internal
.
scene
.
selectorBoard
selector
.
refill
()
selector
.
hasFocus
=
True
selector
.
has
Logical
Focus
=
True
self
.
wall
.
build
(
shuffleFirst
=
False
)
def
nextScoringHand
(
self
):
...
...
src/visible.py
View file @
5e01f656
...
...
@@ -122,7 +122,7 @@ class VisiblePlayingPlayer(VisiblePlayer, PlayingPlayer):
def
getsFocus
(
self
,
unusedResults
=
None
):
"""give this player focus on his handBoard"""
self
.
handBoard
.
setEnabled
(
True
)
self
.
handBoard
.
hasFocus
=
True
self
.
handBoard
.
has
Logical
Focus
=
True
def
popupMsg
(
self
,
msg
):
"""shows a yellow message from player"""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment