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. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Wed, 17 Nov 2021 09:20:16 +0100
branchwxPython4
changeset 3389 da4f9cbec3b9
parent 3388 6cde1a3ded58
child 3391 0ae5a15efa18
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.
BeremizIDE.py
--- 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