- final fix for the VisPy data files; the defaults files are saved to the Config folder when the app is set to be portable

This commit is contained in:
Marius Stanciu 2019-08-15 22:39:51 +03:00
parent ca8a12610e
commit 7eb0b83776
2 changed files with 8 additions and 13 deletions

View File

@ -195,9 +195,11 @@ class App(QtCore.QObject):
self.main_thread = QtWidgets.QApplication.instance().thread()
# ################ ##
# # ## OS-specific # ##
# ################ ##
# #######################
# # ## OS-specific ######
# #######################
portable = False
# Folder for user settings.
if sys.platform == 'win32':
@ -207,7 +209,6 @@ class App(QtCore.QObject):
else:
App.log.debug("Win64!")
portable = False
config_file = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '\\config\\configuration.txt'
try:
with open(config_file, 'r') as f:
@ -226,9 +227,9 @@ class App(QtCore.QObject):
pass
if portable is False:
self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + '\FlatCAM'
self.data_path = shell.SHGetFolderPath(0, shellcon.CSIDL_APPDATA, None, 0) + '\\FlatCAM'
else:
self.data_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
self.data_path = os.path.dirname(os.path.dirname(os.path.realpath(__file__))) + '\\config'
self.os = 'windows'
else: # Linux/Unix/MacOS
@ -255,13 +256,6 @@ class App(QtCore.QObject):
f = open(self.data_path + '/current_defaults.FlatConfig')
f.close()
except IOError:
if sys.platform == 'win32':
# this happen only once, at the first launch of the app.
# I use this to copy the vispy data files to the APPDATA folder, for Windows
source_path = self.data_path + '\\vispy\\data'
target_path = os.getenv('APPDATA') + '\\vispy'
self.copy_and_overwrite(from_path=source_path, to_path=target_path)
App.log.debug('Creating empty current_defaults.FlatConfig')
f = open(self.data_path + '/current_defaults.FlatConfig', 'w')
json.dump({}, f)

View File

@ -23,6 +23,7 @@ CAD program, and create G-Code for Isolation routing.
- finished the Slot Array tool in Excellon Editor
- added the key shortcut handlers for Add Slot and Add Slot Array tools in Excellon Editor
- started to work on the Resize tool for the case of Excellon slots in Excellon Editor
- final fix for the VisPy data files; the defaults files are saved to the Config folder when the app is set to be portable
14.08.2019