chiark / gitweb /
Merge branch 'master' of github.com:daid/Cura
[cura.git] / Cura / util / profile.py
index 4742c5e9320e62d56b02c5168fbc6907d90e0560..9304706267dcd9d7566fc51c1e063d6a380f0cff 100644 (file)
@@ -3,7 +3,7 @@ from __future__ import division
 #Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.\r
 import __init__\r
 \r
-import ConfigParser, os, traceback, math, re, zlib, base64, time\r
+import ConfigParser, os, traceback, math, re, zlib, base64, time, sys\r
 \r
 #########################################################\r
 ## Default settings when none are found.\r
@@ -59,7 +59,6 @@ profileDefaultSettings = {
        'enable_raft': 'False',\r
        'cool_min_feedrate': '5',\r
        'bridge_speed': '100',\r
-       'bridge_material_amount': '100',\r
        'raft_margin': '5',\r
        'raft_base_material_amount': '100',\r
        'raft_interface_material_amount': '100',\r
@@ -171,7 +170,11 @@ preferencesDefaultSettings = {
 \r
 ## Profile functions\r
 def getDefaultProfilePath():\r
-       return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../current_profile.ini"))\r
+       basePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))\r
+       #If we have a frozen python install, we need to step out of the library.zip\r
+       if hasattr(sys, 'frozen'):\r
+               basePath = os.path.normpath(os.path.join(basePath, ".."))\r
+       return os.path.normpath(os.path.join(basePath, "current_profile.ini"))\r
 \r
 def loadGlobalProfile(filename):\r
        #Read a configuration file as global config\r
@@ -273,7 +276,11 @@ global globalPreferenceParser
 globalPreferenceParser = None\r
 \r
 def getPreferencePath():\r
-       return os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), "../preferences.ini"))\r
+       basePath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))\r
+       #If we have a frozen python install, we need to step out of the library.zip\r
+       if hasattr(sys, 'frozen'):\r
+               basePath = os.path.normpath(os.path.join(basePath, ".."))\r
+       return os.path.normpath(os.path.join(basePath, "preferences.ini"))\r
 \r
 def getPreferenceFloat(name):\r
        try:\r