680 recent_projects = map(DecodeFileSystemPath, |
680 recent_projects = map(DecodeFileSystemPath, |
681 self.GetConfigEntry("RecentProjects", [])) |
681 self.GetConfigEntry("RecentProjects", [])) |
682 except Exception: |
682 except Exception: |
683 recent_projects = [] |
683 recent_projects = [] |
684 |
684 |
685 while self.RecentProjectsMenu.GetMenuItemCount() > len(recent_projects): |
685 while self.RecentProjectsMenu.GetMenuItemCount() > 0: |
686 item = self.RecentProjectsMenu.FindItemByPosition(0) |
686 item = self.RecentProjectsMenu.FindItemByPosition(0) |
687 self.RecentProjectsMenu.RemoveItem(item) |
687 self.RecentProjectsMenu.RemoveItem(item) |
688 |
688 |
689 self.FileMenu.Enable(ID_FILEMENURECENTPROJECTS, len(recent_projects) > 0) |
689 self.FileMenu.Enable(ID_FILEMENURECENTPROJECTS, len(recent_projects) > 0) |
690 for idx, projectpath in enumerate(recent_projects): |
690 for idx, projectpath in enumerate(recent_projects): |
691 text = u'&%d: %s' % (idx + 1, projectpath) |
691 text = u'&%d: %s' % (idx + 1, projectpath) |
692 |
692 |
693 if idx < self.RecentProjectsMenu.GetMenuItemCount(): |
693 item = self.RecentProjectsMenu.Append(wx.ID_ANY, text, '') |
694 item = self.RecentProjectsMenu.FindItemByPosition(idx) |
|
695 item.SetItemLabel(text) |
|
696 self.Disconnect(id, id, wx.EVT_BUTTON._getEvtType()) |
|
697 else: |
|
698 item = self.RecentProjectsMenu.Append(wx.ID_ANY, text, '') |
|
699 self.Bind(wx.EVT_MENU, self.GenerateOpenRecentProjectFunction(projectpath), item) |
694 self.Bind(wx.EVT_MENU, self.GenerateOpenRecentProjectFunction(projectpath), item) |
700 |
695 |
701 def GenerateOpenRecentProjectFunction(self, projectpath): |
696 def GenerateOpenRecentProjectFunction(self, projectpath): |
702 def OpenRecentProject(event): |
697 def OpenRecentProject(event): |
703 if self.CTR is not None and not self.CheckSaveBeforeClosing(): |
698 if self.CTR is not None and not self.CheckSaveBeforeClosing(): |