IDE: Tutorial/Example menu was broken, probably after a merge. Menu (and corresponding code) was duplicated. Also, path of project beeing open was the same for all menu entries.
--- a/BeremizIDE.py Tue Nov 16 20:10:50 2021 +0100
+++ b/BeremizIDE.py Wed Nov 17 09:20:16 2021 +0100
@@ -264,29 +264,7 @@
projectpath = os.path.join(exemples_dir, dirname)
- def OpenExemple(event):
- if self.CTR is not None and not self.CheckSaveBeforeClosing():
- return
-
- self.OpenProject(projectpath)
- if not self.CTR.CheckProjectPathPerm():
- self.ResetView()
-
- self.Bind(wx.EVT_MENU, OpenExemple, item)
- parent.AppendSeparator()
- parent.AppendMenu(wx.ID_ANY, _("&Tutorials and Examples"), self.TutorialsProjectsMenu)
-
- exemples_dir = Bpath("exemples")
- project_list = sorted(os.listdir(exemples_dir))
-
- for idx, dirname in enumerate(project_list):
- text = u'&%d: %s' % (idx + 1, dirname)
-
- item = self.TutorialsProjectsMenu.Append(wx.ID_ANY, text, '')
-
- projectpath = os.path.join(exemples_dir, dirname)
-
- def OpenExemple(event):
+ def OpenExemple(event, projectpath=projectpath):
if self.CTR is not None and not self.CheckSaveBeforeClosing():
return