#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
'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
\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
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