239 class Beremiz(IDEFrame): |
239 class Beremiz(IDEFrame): |
240 |
240 |
241 def _init_utils(self): |
241 def _init_utils(self): |
242 self.ConfNodeMenu = wx.Menu(title='') |
242 self.ConfNodeMenu = wx.Menu(title='') |
243 self.RecentProjectsMenu = wx.Menu(title='') |
243 self.RecentProjectsMenu = wx.Menu(title='') |
|
244 self.TutorialsProjectsMenu = wx.Menu(title='') |
244 |
245 |
245 IDEFrame._init_utils(self) |
246 IDEFrame._init_utils(self) |
246 |
247 |
247 def _init_coll_FileMenu_Items(self, parent): |
248 def _init_coll_FileMenu_Items(self, parent): |
248 AppendMenu(parent, help='', id=wx.ID_NEW, |
249 AppendMenu(parent, help='', id=wx.ID_NEW, |
249 kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N') |
250 kind=wx.ITEM_NORMAL, text=_(u'New') + '\tCTRL+N') |
250 AppendMenu(parent, help='', id=wx.ID_OPEN, |
251 AppendMenu(parent, help='', id=wx.ID_OPEN, |
251 kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O') |
252 kind=wx.ITEM_NORMAL, text=_(u'Open') + '\tCTRL+O') |
252 parent.AppendMenu(ID_FILEMENURECENTPROJECTS, _("&Recent Projects"), self.RecentProjectsMenu) |
253 parent.AppendMenu(ID_FILEMENURECENTPROJECTS, _("&Recent Projects"), self.RecentProjectsMenu) |
|
254 parent.AppendSeparator() |
|
255 parent.Append(wx.ID_ANY, _("&Tutorials and Examples"), self.TutorialsProjectsMenu) |
|
256 |
|
257 exemples_dir = Bpath("exemples") |
|
258 project_list = sorted(os.listdir(exemples_dir)) |
|
259 |
|
260 for idx, dirname in enumerate(project_list): |
|
261 text = u'&%d: %s' % (idx + 1, dirname) |
|
262 |
|
263 item = self.TutorialsProjectsMenu.Append(wx.ID_ANY, text, '') |
|
264 |
|
265 projectpath = os.path.join(exemples_dir, dirname) |
|
266 |
|
267 def OpenExemple(event): |
|
268 if self.CTR is not None and not self.CheckSaveBeforeClosing(): |
|
269 return |
|
270 |
|
271 self.OpenProject(projectpath) |
|
272 if not self.CTR.CheckProjectPathPerm(): |
|
273 self.ResetView() |
|
274 |
|
275 self.Bind(wx.EVT_MENU, OpenExemple, item) |
253 parent.AppendSeparator() |
276 parent.AppendSeparator() |
254 AppendMenu(parent, help='', id=wx.ID_SAVE, |
277 AppendMenu(parent, help='', id=wx.ID_SAVE, |
255 kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S') |
278 kind=wx.ITEM_NORMAL, text=_(u'Save') + '\tCTRL+S') |
256 AppendMenu(parent, help='', id=wx.ID_SAVEAS, |
279 AppendMenu(parent, help='', id=wx.ID_SAVEAS, |
257 kind=wx.ITEM_NORMAL, text=_(u'Save as') + '\tCTRL+SHIFT+S') |
280 kind=wx.ITEM_NORMAL, text=_(u'Save as') + '\tCTRL+SHIFT+S') |