- added an extra check if old preferences files are detected, a check if the type of the values is the same with the type in the current preferences file. If the type is not the same then the current type is preferred.

This commit is contained in:
Marius Stanciu
2020-04-23 02:43:26 +03:00
committed by Marius
parent 3735753a93
commit 1f36ed9369
2 changed files with 18 additions and 1 deletions

View File

@@ -3829,7 +3829,23 @@ class App(QtCore.QObject):
if 'version' not in defaults or defaults['version'] != self.defaults['version']:
for k, v in defaults.items():
if k in self.defaults and k != 'version':
self.defaults[k] = v
# check if the types are the same. Because some types (tuple, float, int etc)
# may be stored as strings we check their types.
try:
target = eval(self.defaults[k])
except NameError:
# it's an unknown string leave it as it is
target = deepcopy(self.defaults[k])
try:
source = eval(v)
except NameError:
# it's an unknown string leave it as it is
source = deepcopy(v)
if type(target) == type(source):
self.defaults[k] = v
# delete old factory defaults
try: