Fixed RecentProjectMenu in BeremizIDE.py broken by untested changes in wx.NewID_abuse_fix.
authorEdouard Tisserant
Thu, 28 Mar 2019 13:39:58 +0100
changeset 2571 d968d586ad16
parent 2570 1df8262b7d15
child 2572 9622418ac28c
Fixed RecentProjectMenu in BeremizIDE.py broken by untested changes in wx.NewID_abuse_fix.
BeremizIDE.py
--- a/BeremizIDE.py	Thu Mar 28 13:10:26 2019 +0100
+++ b/BeremizIDE.py	Thu Mar 28 13:39:58 2019 +0100
@@ -682,7 +682,7 @@
         except Exception:
             recent_projects = []
 
-        while self.RecentProjectsMenu.GetMenuItemCount() > len(recent_projects):
+        while self.RecentProjectsMenu.GetMenuItemCount() > 0:
             item = self.RecentProjectsMenu.FindItemByPosition(0)
             self.RecentProjectsMenu.RemoveItem(item)
 
@@ -690,12 +690,7 @@
         for idx, projectpath in enumerate(recent_projects):
             text = u'&%d: %s' % (idx + 1, projectpath)
 
-            if idx < self.RecentProjectsMenu.GetMenuItemCount():
-                item = self.RecentProjectsMenu.FindItemByPosition(idx)
-                item.SetItemLabel(text)
-                self.Disconnect(id, id, wx.EVT_BUTTON._getEvtType())
-            else:
-                item = self.RecentProjectsMenu.Append(wx.ID_ANY, text, '')
+            item = self.RecentProjectsMenu.Append(wx.ID_ANY, text, '')
             self.Bind(wx.EVT_MENU, self.GenerateOpenRecentProjectFunction(projectpath), item)
 
     def GenerateOpenRecentProjectFunction(self, projectpath):