Commit eb2ad768 authored by Wolfgang Rohdewald's avatar Wolfgang Rohdewald
Browse files

Statesaver: call restoreState/Geometry only if available

parent 01cbb91a
......@@ -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'):
elif name.endswith('Geometry'):
elif canRestore(name, 'Geometry'):
# legacy
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment