chiark / gitweb /
Fix to add initial model file(s) to MRU list
authorsmorloc <smorloc@gmail.com>
Sat, 19 Jan 2013 02:26:02 +0000 (21:26 -0500)
committersmorloc <smorloc@gmail.com>
Sat, 19 Jan 2013 02:40:36 +0000 (21:40 -0500)
.gitignore
Cura/gui/mainWindow.py

index 65f3bfa8c2b6f1cf4abb344179e12397524d36d0..989d8494f3d20d69dc23dc80d38c63d15633bbc1 100644 (file)
@@ -12,6 +12,7 @@ Printrun
 .DS_Store
 Cura/current_profile.ini
 Cura/preferences.ini
+Cura/mru_filelist.ini
 cura.sh
 pypy
 python
@@ -25,3 +26,5 @@ scripts/darwin/build/*
 scripts/darwin/Cura.dmg.sparseimage
 scripts/win32/dist/*
 log.txt
+output.txt
+*.bak
index 16e61fa3e78540c599114387fc5aa9b9d93c8e7a..1a0d7d1694dc9216dfe44c0a9920b29d1c53636c 100644 (file)
@@ -202,6 +202,10 @@ class mainWindow(wx.Frame):
                if len(self.filelist) > 0:
                        self.preview3d.loadModelFiles(self.filelist)
 
+                       # Update the Model MRU
+                       for idx in xrange(0, len(self.filelist)):
+                               self.addToModelMRU(self.filelist[idx])
+
                self.updateProfileToControls()
 
                self.SetBackgroundColour(self.normalSettingsPanel.GetBackgroundColour())
@@ -285,12 +289,10 @@ class mainWindow(wx.Frame):
                profile.putPreference('lastFile', ';'.join(self.filelist))
                self.preview3d.loadModelFiles(self.filelist, True)
                self.preview3d.setViewMode("Normal")
+               
                # Update the Model MRU
                for idx in xrange(0, len(self.filelist)):
-                       self.modelFileHistory.AddFileToHistory(self.filelist[idx])
-               self.config.SetPath("/ModelMRU")
-               self.modelFileHistory.Save(self.config)
-               self.config.Flush()
+                       self.addToModelMRU(self.filelist[idx])
 
        def OnDropFiles(self, files):
                self._loadModels(files)
@@ -349,6 +351,12 @@ class mainWindow(wx.Frame):
                filelist = [ path ]
                self._loadModels(filelist)
 
+       def addToModelMRU(self, file):
+               self.modelFileHistory.AddFileToHistory(file)
+               self.config.SetPath("/ModelMRU")
+               self.modelFileHistory.Save(self.config)
+               self.config.Flush()
+       
        def OnProfileMRU(self, e):
                fileNum = e.GetId() - self.ID_MRU_PROFILE1
                path = self.profileFileHistory.GetHistoryFile(fileNum)
@@ -361,6 +369,12 @@ class mainWindow(wx.Frame):
                profile.loadGlobalProfile(path)
                self.updateProfileToControls()
 
+       def addToProfileMRU(self, file):
+               self.profileFileHistory.AddFileToHistory(file)
+               self.config.SetPath("/ProfileMRU")
+               self.profileFileHistory.Save(self.config)
+               self.config.Flush()                     
+
        def removeSliceProgress(self, spp):
                self.progressPanelList.remove(spp)
                newSize = self.GetSize()
@@ -391,10 +405,7 @@ class mainWindow(wx.Frame):
                        self.updateProfileToControls()
 
                        # Update the Profile MRU
-                       self.profileFileHistory.AddFileToHistory(profileFile)
-                       self.config.SetPath("/ProfileMRU")
-                       self.profileFileHistory.Save(self.config)
-                       self.config.Flush()                     
+                       self.addToProfileMRU(profileFile)
                dlg.Destroy()
 
        def OnLoadProfileFromGcode(self, e):