- fixed the warning that old preferences found even for new installation

- in Paint Tool fixed the message to select a polygon when using the Selection: Single Polygon being overwritten by the "Grid disabled" message
This commit is contained in:
Marius Stanciu
2020-06-01 03:45:34 +03:00
committed by Marius
parent 440d0dde02
commit c1fb0b5cdb
6 changed files with 25 additions and 21 deletions

View File

@@ -697,13 +697,15 @@ class FlatCAMDefaults:
}
@classmethod
def save_factory_defaults(cls, file_path: str):
def save_factory_defaults(cls, file_path: str, version: float):
"""Writes the factory defaults to a file at the given path, overwriting any existing file."""
# Delete any existing factory defaults file
if os.path.isfile(file_path):
os.chmod(file_path, stat.S_IRWXO | stat.S_IWRITE | stat.S_IWGRP)
os.remove(file_path)
cls.factory_defaults['version'] = version
try:
# recreate a new factory defaults file and save the factory defaults data into it
f_f_def_s = open(file_path, "w")
@@ -784,8 +786,8 @@ class FlatCAMDefaults:
if defaults is None:
return
# Perform migration if necessary
if self.__is_old_defaults(defaults):
# 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)
else: