# HG changeset patch # User etisserant # Date 1215708723 -7200 # Node ID 127d1323e5e0114f6a36c8a0be2b73a95169a11a # Parent ca1f1d3734f91a6974b86e24361c9a3959c68183 Added File menu, even in non-solo mode. diff -r ca1f1d3734f9 -r 127d1323e5e0 PLCOpenEditor.py --- a/PLCOpenEditor.py Tue Jul 01 11:13:22 2008 +0200 +++ b/PLCOpenEditor.py Thu Jul 10 18:52:03 2008 +0200 @@ -201,28 +201,30 @@ event(self, function) def _init_coll_MenuBar_Menus(self, parent): - if self.ModeSolo: - parent.Append(menu=self.FileMenu, title=u'File') + parent.Append(menu=self.FileMenu, title=u'File') parent.Append(menu=self.EditMenu, title=u'Edit') parent.Append(menu=self.HelpMenu, title=u'Help') def _init_coll_FileMenu_Items(self, parent): - AppendMenu(parent, help='', id=wx.ID_NEW, - kind=wx.ITEM_NORMAL, text=u'New\tCTRL+N') - AppendMenu(parent, help='', id=wx.ID_OPEN, - kind=wx.ITEM_NORMAL, text=u'Open\tCTRL+O') + if self.ModeSolo: + AppendMenu(parent, help='', id=wx.ID_NEW, + kind=wx.ITEM_NORMAL, text=u'New\tCTRL+N') + AppendMenu(parent, help='', id=wx.ID_OPEN, + kind=wx.ITEM_NORMAL, text=u'Open\tCTRL+O') AppendMenu(parent, help='', id=wx.ID_CLOSE, kind=wx.ITEM_NORMAL, text=u'Close Tab\tCTRL+W') - AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL, - kind=wx.ITEM_NORMAL, text=u'Close Project') - parent.AppendSeparator() + if self.ModeSolo: + AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL, + kind=wx.ITEM_NORMAL, text=u'Close Project') + parent.AppendSeparator() AppendMenu(parent, help='', id=wx.ID_SAVE, kind=wx.ITEM_NORMAL, text=u'Save\tCTRL+S') - AppendMenu(parent, help='', id=wx.ID_SAVEAS, - kind=wx.ITEM_NORMAL, text=u'Save As...\tCTRL+SHIFT+S') - AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE, - kind=wx.ITEM_NORMAL, text=u'Generate Program\tCTRL+G') - parent.AppendSeparator() + if self.ModeSolo: + AppendMenu(parent, help='', id=wx.ID_SAVEAS, + kind=wx.ITEM_NORMAL, text=u'Save As...\tCTRL+SHIFT+S') + AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE, + kind=wx.ITEM_NORMAL, text=u'Generate Program\tCTRL+G') + parent.AppendSeparator() AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP, kind=wx.ITEM_NORMAL, text=u'Page Setup') AppendMenu(parent, help='', id=wx.ID_PREVIEW, @@ -232,9 +234,11 @@ parent.AppendSeparator() AppendMenu(parent, help='', id=wx.ID_PROPERTIES, kind=wx.ITEM_NORMAL, text=u'Properties') - parent.AppendSeparator() - AppendMenu(parent, help='', id=wx.ID_EXIT, - kind=wx.ITEM_NORMAL, text=u'Quit\tCTRL+Q') + if self.ModeSolo: + parent.AppendSeparator() + AppendMenu(parent, help='', id=wx.ID_EXIT, + kind=wx.ITEM_NORMAL, text=u'Quit\tCTRL+Q') + self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW) self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN) self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE) @@ -313,16 +317,12 @@ def _init_utils(self): self.MenuBar = wx.MenuBar() - if self.ModeSolo: - self.FileMenu = wx.Menu(title='') - else: - self.FileMenu = None + self.FileMenu = wx.Menu(title='') self.EditMenu = wx.Menu(title='') self.HelpMenu = wx.Menu(title='') self._init_coll_MenuBar_Menus(self.MenuBar) - if self.ModeSolo: - self._init_coll_FileMenu_Items(self.FileMenu) + self._init_coll_FileMenu_Items(self.FileMenu) self._init_coll_EditMenu_Items(self.EditMenu) self._init_coll_HelpMenu_Items(self.HelpMenu) @@ -862,7 +862,7 @@ preview = wx.PrintPreview(printout, printout2, data) if preview.Ok(): - preview_frame = wx.PreviewFrame(preview, frame, "Print preview") + preview_frame = wx.PreviewFrame(preview, self, "Print preview") preview_frame.Initialize()