Skip to content
GitLab
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
eb2ad768
Commit
eb2ad768
authored
May 05, 2021
by
Wolfgang Rohdewald
Browse files
Statesaver: call restoreState/Geometry only if available
parent
01cbb91a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/statesaver.py
View file @
eb2ad768
...
...
@@ -42,11 +42,13 @@ class StateSaver(QObject):
def
__restore
(
widget
,
name
):
"""decode the saved string"""
# pylint: disable=unsubscriptable-object
def
canRestore
(
name
,
what
):
return
name
.
endswith
(
what
)
and
hasattr
(
widget
,
'restore'
+
what
)
state
=
QByteArray
.
fromHex
(
Internal
.
Preferences
[
name
].
encode
())
if
state
:
if
name
.
endswith
(
'State'
):
if
canRestore
(
name
,
'State'
):
widget
.
restoreState
(
state
)
elif
name
.
endswith
(
'Geometry'
):
elif
canRestore
(
name
,
'Geometry'
):
widget
.
restoreGeometry
(
state
)
else
:
# legacy
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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