From: daid Date: Mon, 24 Jun 2013 07:47:04 +0000 (+0200) Subject: Try to load settings from a previous cura if no preferences are found. X-Git-Tag: 13.06.4~15 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=1977da4161bcb2524e784b8b1ababc6cd440ce42;p=cura.git Try to load settings from a previous cura if no preferences are found. --- diff --git a/Cura/gui/app.py b/Cura/gui/app.py index 048d03d3..c250d510 100644 --- a/Cura/gui/app.py +++ b/Cura/gui/app.py @@ -44,6 +44,16 @@ class CuraApp(wx.App): from Cura.util import resources from Cura.util import version + #If we do not have preferences yet, try to load it from a previous Cura install + if profile.getPreference('machine_type') == 'unknown': + try: + otherCuraInstalls = profile.getAlternativeBasePaths() + otherCuraInstalls.sort() + profile.loadPreferences(os.path.join(otherCuraInstalls[-1], 'preferences.ini')) + profile.loadProfile(os.path.join(otherCuraInstalls[-1], 'current_profile.ini')) + except: + print sys.exc_info() + #If we haven't run it before, run the configuration wizard. if profile.getPreference('machine_type') == 'unknown': if platform.system() == "Windows": diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 47f94967..ddf5ce74 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -63,6 +63,8 @@ class mainWindow(wx.Frame): self.Bind(wx.EVT_MENU, lambda e: self.scene.showPrintWindow(), i) i = self.fileMenu.Append(-1, 'Save GCode...') self.Bind(wx.EVT_MENU, lambda e: self.scene.showSaveGCode(), i) + i = self.fileMenu.Append(-1, 'Show slice engine log...') + self.Bind(wx.EVT_MENU, lambda e: self.scene._showSliceLog(), i) self.fileMenu.AppendSeparator() i = self.fileMenu.Append(-1, 'Open Profile...') diff --git a/Cura/util/profile.py b/Cura/util/profile.py index a1fc68ec..d5e9e63b 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -398,6 +398,18 @@ def getBasePath(): os.makedirs(basePath) return basePath +def getAlternativeBasePaths(): + paths = [] + basePath = os.path.normpath(os.path.join(getBasePath(), '..')) + 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 != getBasePath(): + 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 != getBasePath(): + paths.append(path) + return paths + def getDefaultProfilePath(): return os.path.join(getBasePath(), 'current_profile.ini') diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index aa3d95db..94d1b778 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -211,6 +211,7 @@ class Slicer(object): pluginError = profile.runPostProcessingPlugins(self._exportFilename) if pluginError is not None: print pluginError + self._sliceLog.append(pluginError) self._callback(1.0, True) else: for line in self._sliceLog: