From 7eb0b837761d6c06f7f19a00ad5e6553f929afdb Mon Sep 17 00:00:00 2001 From: Marius Stanciu Date: Thu, 15 Aug 2019 22:39:51 +0300 Subject: [PATCH] - final fix for the VisPy data files; the defaults files are saved to the Config folder when the app is set to be portable --- FlatCAMApp.py | 20 +++++++------------- README.md | 1 + 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/FlatCAMApp.py b/FlatCAMApp.py index 155dc4f1..eea68969 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -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) diff --git a/README.md b/README.md index 8f243356..b3e9a6c0 100644 --- a/README.md +++ b/README.md @@ -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