chiark / gitweb /
Try to load settings from a previous cura if no preferences are found.
authordaid <daid303@gmail.com>
Mon, 24 Jun 2013 07:47:04 +0000 (09:47 +0200)
committerdaid <daid303@gmail.com>
Mon, 24 Jun 2013 07:47:04 +0000 (09:47 +0200)
Cura/gui/app.py
Cura/gui/mainWindow.py
Cura/util/profile.py
Cura/util/sliceEngine.py

index 048d03d3ed5d6a0a199c906a2121a8152c58416f..c250d510024173507823585ef87b9d182a7ef73b 100644 (file)
@@ -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":
index 47f94967d5cbcbbfb6156f6c425d3b024ddb269c..ddf5ce7471a982d11f2a2194b6dd6971fcb61156 100644 (file)
@@ -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...')
index a1fc68eca668bba009703b840e4470ec826bdb30..d5e9e63b3a793ac7a7ae8d04b25138ba6cadcefc 100644 (file)
@@ -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')
 
index aa3d95dbf2bf11835d8a0b659600419b3186fb8f..94d1b778576c60db450a92c6310a40fa552e5263 100644 (file)
@@ -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: