chiark / gitweb /
Change the preferences path for windows to see if that solves a problem with windows...
authordaid <daid303@gmail.com>
Wed, 30 Jul 2014 07:25:13 +0000 (09:25 +0200)
committerdaid <daid303@gmail.com>
Wed, 30 Jul 2014 07:25:13 +0000 (09:25 +0200)
Cura/gui/app.py
Cura/util/profile.py
Cura/util/resources.py

index 10cbd597f4c34ee7323750ef5c83b864eab5e1d0..33996fa8edc819207d9ddf7f907b2fd38dba6de9 100644 (file)
@@ -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)
index 05d74278bbe1326bbf3e6c420b71b2495160da54..e9ab99ebe153d63f906aca6c46ffad7067a1ebf7 100644 (file)
@@ -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():
index 2c9f116f4b693198524094063460399764449f98..a644815fb7a120ecc3d99ae19722d866050cf08e 100644 (file)
@@ -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']