From: smorloc Date: Sat, 19 Jan 2013 02:26:02 +0000 (-0500) Subject: Fix to add initial model file(s) to MRU list X-Git-Tag: 13.03~92^2~1 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=5037032a6f4c1f444a3cf2569714c2fcf7b0a2c3;hp=41308e226c8158353b54539033d04d81aaf2a4c9;p=cura.git Fix to add initial model file(s) to MRU list --- diff --git a/.gitignore b/.gitignore index 65f3bfa8..989d8494 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/Cura/gui/mainWindow.py b/Cura/gui/mainWindow.py index 16e61fa3..1a0d7d16 100644 --- a/Cura/gui/mainWindow.py +++ b/Cura/gui/mainWindow.py @@ -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):