Added File menu, even in non-solo mode.
authoretisserant
Thu, 10 Jul 2008 18:52:03 +0200
changeset 220 127d1323e5e0
parent 219 ca1f1d3734f9
child 221 25f2b4924347
Added File menu, even in non-solo mode.
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()