- now every version of FlatCAM beta creates it's own set of Preferences files
This commit is contained in:
@@ -7,6 +7,10 @@ CHANGELOG for FlatCAM beta
|
|||||||
|
|
||||||
=================================================
|
=================================================
|
||||||
|
|
||||||
|
5.04.2021
|
||||||
|
|
||||||
|
- now every version of FlatCAM beta creates it's own set of Preferences files
|
||||||
|
|
||||||
4.04.2021
|
4.04.2021
|
||||||
|
|
||||||
- fixed drill file import from FreePCB
|
- fixed drill file import from FreePCB
|
||||||
|
|||||||
@@ -1004,7 +1004,9 @@ class PreferencesUIManager:
|
|||||||
|
|
||||||
self.save_defaults(silent=False)
|
self.save_defaults(silent=False)
|
||||||
# load the defaults so they are updated into the app
|
# load the defaults so they are updated into the app
|
||||||
self.defaults.load(filename=os.path.join(self.data_path, 'current_defaults.FlatConfig'), inform=self.inform)
|
self.defaults.load(filename=os.path.join(self.data_path,
|
||||||
|
'current_defaults_%s.FlatConfig' % self.defaults.version),
|
||||||
|
inform=self.inform)
|
||||||
|
|
||||||
settgs = QSettings("Open Source", "FlatCAM")
|
settgs = QSettings("Open Source", "FlatCAM")
|
||||||
|
|
||||||
@@ -1102,7 +1104,8 @@ class PreferencesUIManager:
|
|||||||
self.save_toolbar_view()
|
self.save_toolbar_view()
|
||||||
|
|
||||||
# Save the options to disk
|
# Save the options to disk
|
||||||
filename = os.path.join(data_path, "current_defaults.FlatConfig")
|
filename = os.path.join(data_path, "current_defaults_%s.FlatConfig" % self.defaults.version)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.defaults.write(filename=filename)
|
self.defaults.write(filename=filename)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
13
app_Main.py
13
app_Main.py
@@ -525,6 +525,7 @@ class App(QtCore.QObject):
|
|||||||
|
|
||||||
# create tools_db.FlatDB file if there is none
|
# create tools_db.FlatDB file if there is none
|
||||||
db_path = self.tools_database_path()
|
db_path = self.tools_database_path()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
f = open(db_path)
|
f = open(db_path)
|
||||||
f.close()
|
f.close()
|
||||||
@@ -588,7 +589,8 @@ class App(QtCore.QObject):
|
|||||||
# ############################################################################################################
|
# ############################################################################################################
|
||||||
self.defaults = FlatCAMDefaults(beta=self.beta, version=self.version)
|
self.defaults = FlatCAMDefaults(beta=self.beta, version=self.version)
|
||||||
|
|
||||||
current_defaults_path = os.path.join(self.data_path, "current_defaults.FlatConfig")
|
# current_defaults_path = os.path.join(self.data_path, "current_defaults.FlatConfig")
|
||||||
|
current_defaults_path = self.defaults_path()
|
||||||
if user_defaults:
|
if user_defaults:
|
||||||
self.defaults.load(filename=current_defaults_path, inform=self.inform)
|
self.defaults.load(filename=current_defaults_path, inform=self.inform)
|
||||||
|
|
||||||
@@ -1798,13 +1800,13 @@ class App(QtCore.QObject):
|
|||||||
# sys.exit(2)
|
# sys.exit(2)
|
||||||
|
|
||||||
def tools_database_path(self):
|
def tools_database_path(self):
|
||||||
return os.path.join(self.data_path, 'tools_db.FlatDB')
|
return os.path.join(self.data_path, 'tools_db_%s.FlatDB' % str(self.version))
|
||||||
|
|
||||||
def defaults_path(self):
|
def defaults_path(self):
|
||||||
return os.path.join(self.data_path, 'current_defaults.FlatConfig')
|
return os.path.join(self.data_path, 'current_defaults_%s.FlatConfig' % str(self.version))
|
||||||
|
|
||||||
def factory_defaults_path(self):
|
def factory_defaults_path(self):
|
||||||
return os.path.join(self.data_path, 'factory_defaults.FlatConfig')
|
return os.path.join(self.data_path, 'factory_defaults_%s.FlatConfig' % str(self.version))
|
||||||
|
|
||||||
def recent_files_path(self):
|
def recent_files_path(self):
|
||||||
return os.path.join(self.data_path, 'recent.json')
|
return os.path.join(self.data_path, 'recent.json')
|
||||||
@@ -9600,8 +9602,9 @@ class MenuFileHandlers(QtCore.QObject):
|
|||||||
# Clear project filename
|
# Clear project filename
|
||||||
self.app.project_filename = None
|
self.app.project_filename = None
|
||||||
|
|
||||||
|
default_file = self.app.defaults_path()
|
||||||
# Load the application defaults
|
# Load the application defaults
|
||||||
self.defaults.load(filename=os.path.join(self.app.data_path, 'current_defaults.FlatConfig'), inform=self.inform)
|
self.defaults.load(filename=default_file, inform=self.inform)
|
||||||
|
|
||||||
# Re-fresh project options
|
# Re-fresh project options
|
||||||
self.app.on_options_app2project()
|
self.app.on_options_app2project()
|
||||||
|
|||||||
Reference in New Issue
Block a user