From: daid Date: Wed, 30 Jul 2014 07:25:13 +0000 (+0200) Subject: Change the preferences path for windows to see if that solves a problem with windows... X-Git-Tag: 14.09~13 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=7decfbc216dc8876c6a00767b3cb3b2dc7bc18e2;p=cura.git Change the preferences path for windows to see if that solves a problem with windows 8. Enable french and german languages. --- diff --git a/Cura/gui/app.py b/Cura/gui/app.py index 10cbd597..33996fa8 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -119,18 +119,14 @@ class CuraApp(wx.App): #If we haven't run it before, run the configuration wizard. if profile.getMachineSetting('machine_type') == 'unknown': - if platform.system() == "Windows": - exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl')) - else: - #Check if we need to copy our examples - exampleFile = os.path.expanduser('~/CuraExamples/UltimakerRobot_support.stl') - if not os.path.isfile(exampleFile): - try: - os.makedirs(os.path.dirname(exampleFile)) - except: - pass - for filename in glob.glob(os.path.normpath(os.path.join(resources.resourceBasePath, 'example', '*.*'))): - shutil.copy(filename, os.path.join(os.path.dirname(exampleFile), os.path.basename(filename))) + otherCuraInstalls = profile.getAlternativeBasePaths() + otherCuraInstalls.sort() + if len(otherCuraInstalls) > 0: + profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini')) + profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini')) + #Check if we need to copy our examples + exampleFile = os.path.normpath(os.path.join(resources.resourceBasePath, 'example', 'UltimakerRobot_support.stl')) + self.loadFiles = [exampleFile] if self.splash is not None: self.splash.Show(False) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index 05d74278..e9ab99eb 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -597,10 +597,7 @@ def getBasePath(): :return: The path in which the current configuration files are stored. This depends on the used OS. """ if platform.system() == "Windows": - basePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) - #If we have a frozen python install, we need to step out of the library.zip - if hasattr(sys, 'frozen'): - basePath = os.path.normpath(os.path.join(basePath, "..")) + basePath = os.path.normpath(os.path.expanduser('~/.cura/%s' % version.getVersion(False))) elif platform.system() == "Darwin": basePath = os.path.expanduser('~/Library/Application Support/Cura/%s' % version.getVersion(False)) else: @@ -625,6 +622,18 @@ def getAlternativeBasePaths(): path = os.path.join(basePath, subPath, 'Cura') if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != getBasePath(): paths.append(path) + + #Check the old base path, which was in the application directory. + oldBasePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "..")) + basePath = os.path.normpath(os.path.join(oldBasePath, "..")) + for subPath in os.listdir(basePath): + path = os.path.join(basePath, subPath) + if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != oldBasePath: + paths.append(path) + path = os.path.join(basePath, subPath, 'Cura') + if os.path.isdir(path) and os.path.isfile(os.path.join(path, 'preferences.ini')) and path != oldBasePath: + paths.append(path) + return paths def getDefaultProfilePath(): diff --git a/Cura/util/resources.py b/Cura/util/resources.py index 2c9f116f..a644815f 100644 --- a/Cura/util/resources.py +++ b/Cura/util/resources.py @@ -65,8 +65,8 @@ def setupLocalization(selectedLanguage = None): def getLanguageOptions(): return [ ['en', 'English'], - # ['de', 'Deutsch'], - # ['fr', 'French'], + ['de', 'Deutsch'], + ['fr', 'French'], # ['nl', 'Nederlands'], # ['es', 'Spanish'], # ['po', 'Polish']