- made sure that the Preferences files are deleted on new version install, while the application is in Beta status

This commit is contained in:
Marius Stanciu 2020-07-21 13:07:47 +03:00 committed by Marius
parent 687efd1fc0
commit 676645d6f5
3 changed files with 11 additions and 3 deletions

View File

@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
- Excellon UI: fixed plot checkbox performing an extra plot function which was not required
- Excellon UI: added a column which will color each row/tool of that column in the color used when checking Multicolor checkbox
- Excellon UI: made sure that when the Multicolor checkbox is unchecked, the color is updated in the Color column of the tools table
- made sure that the Preferences files are deleted on new version install, while the application is in Beta status
20.07.2020

View File

@ -420,7 +420,7 @@ class App(QtCore.QObject):
# ############################################################################################################
# ################################# DEFAULTS - PREFERENCES STORAGE ###########################################
# ############################################################################################################
self.defaults = FlatCAMDefaults()
self.defaults = FlatCAMDefaults(beta=self.beta)
self.defaults["root_folder_path"] = self.app_home

View File

@ -770,7 +770,7 @@ class FlatCAMDefaults:
except Exception as e:
log.error("save_factory_defaults() -> %s" % str(e))
def __init__(self, callback=lambda x: None):
def __init__(self, callback=lambda x: None, beta=True):
"""
:param callback: A method called each time that one of the values are changed in the self.defaults LouDict
@ -781,6 +781,7 @@ class FlatCAMDefaults:
self.current_defaults.update(self.factory_defaults)
self.old_defaults_found = False
self.beta = beta
self.defaults.set_change_callback(callback)
# #### Pass-through to the defaults LoudDict #####
@ -840,7 +841,13 @@ class FlatCAMDefaults:
# Perform migration if necessary but only if the defaults dict is not empty
if self.__is_old_defaults(defaults) and defaults:
self.old_defaults_found = True
defaults = self.__migrate_old_defaults(defaults=defaults)
# while the app is in Beta status, delete the older Preferences files
if self.beta is False:
defaults = self.__migrate_old_defaults(defaults=defaults)
else:
# wipeout the old defaults
self.reset_to_factory_defaults(defaults=defaults)
else:
self.old_defaults_found = False