- created a configuration file in the root/config/configuration.txt with a configuration line for portability. Set portable to True to run the app as portable

This commit is contained in:
Marius Stanciu 2019-08-15 02:47:09 +03:00
parent 5c75998dbb
commit beef671613
4 changed files with 23 additions and 4 deletions

View File

@ -101,9 +101,6 @@ class App(QtCore.QObject):
version = 8.94
version_date = "2019/08/31"
beta = True
# make this True is you want to create a portable app - that is, to save the settings files
# in the working directory
portable = True
# current date now
date = str(datetime.today()).rpartition('.')[0]
@ -209,7 +206,26 @@ class App(QtCore.QObject):
App.log.debug("Win32!")
else:
App.log.debug("Win64!")
if self.portable is False:
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:
try:
for line in f:
param = str(line).rpartition('=')
if param[0] == 'portable':
try:
portable = eval(param[2])
except NameError:
portable = False
except Exception as e:
log.debug('App.__init__() -->%s' % str(e))
return
except FileNotFoundError:
pass
if portable is False:
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__)))

View File

@ -17,6 +17,7 @@ CAD program, and create G-Code for Isolation routing.
- merged pull request from Mike Smith that add support for a new SVG element: <use>
- stored inside FlatCAM app the VisPy data files and at the first start the application will try to copy those files to the APPDATA (roaming) folder in case of running under Windows
- created an app 'switch' named 'self.portable' which when set True it will 'cx-freeze' an portable application
- created a configuration file in the root/config/configuration.txt with a configuration line for portability. Set portable to True to run the app as portable
14.08.2019

1
config/configuration.txt Normal file
View File

@ -0,0 +1 @@
portable=False

View File

@ -56,6 +56,7 @@ include_files.append(("locale", "lib/locale"))
include_files.append(("postprocessors", "lib/postprocessors"))
include_files.append(("share", "lib/share"))
include_files.append(("flatcamGUI/VisPyData", "lib/vispy"))
include_files.append(("config", "lib/config"))
include_files.append(("README.md", "README.md"))
include_files.append(("LICENSE", "LICENSE"))