From 676645d6f51f7c273b1e6ee719a7f3a904e88450 Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Tue, 21 Jul 2020 13:07:47 +0300 Subject: [PATCH] - made sure that the Preferences files are deleted on new version install, while the application is in Beta status --- CHANGELOG.md | 1 + app_Main.py | 2 +- defaults.py | 11 +++++++++-- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 400e5c44..e867c9bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app_Main.py b/app_Main.py index 4b36832e..ef8026f1 100644 --- a/app_Main.py +++ b/app_Main.py @@ -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 diff --git a/defaults.py b/defaults.py index f3f750fe..c782ffc4 100644 --- a/defaults.py +++ b/defaults.py @@ -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