file menu with Save implementation in c_ext plugin
authorEdouard Tisserant
Sat, 26 Mar 2011 22:53:10 +0100
changeset 584 f9be6e5cdd1b
parent 583 8eff490f83fc
child 586 720a0d30b678
file menu with Save implementation in c_ext plugin
plugins/c_ext/CFileEditor.py
--- a/plugins/c_ext/CFileEditor.py	Sat Mar 26 18:50:51 2011 +0100
+++ b/plugins/c_ext/CFileEditor.py	Sat Mar 26 22:53:10 2011 +0100
@@ -690,6 +690,7 @@
     def RefreshBuffer(self):
         self.Controler.BufferCFile()
         self.ParentWindow.RefreshTitle()
+        self.ParentWindow.RefreshFileMenu()
         self.ParentWindow.RefreshEditMenu()
 
     def RefreshView(self):
@@ -817,15 +818,23 @@
         self.Bind(wx.EVT_MENU, self.OnUndoMenu, id=wx.ID_UNDO)
         self.Bind(wx.EVT_MENU, self.OnRedoMenu, id=wx.ID_REDO)
     
+    def _init_coll_FileMenu_Items(self, parent):
+        AppendMenu(parent, help='', id=wx.ID_SAVE,
+              kind=wx.ITEM_NORMAL, text=u'Save\tCTRL+S')
+        self.Bind(wx.EVT_MENU, self.OnSaveMenu, id=wx.ID_SAVE)
+
     def _init_coll_MenuBar_Menus(self, parent):
+        parent.Append(menu=self.FileMenu, title=u'&File')
         parent.Append(menu=self.EditMenu, title=u'&Edit')
     
     def _init_utils(self):
         self.MenuBar = wx.MenuBar()
 
+        self.FileMenu = wx.Menu(title='')
         self.EditMenu = wx.Menu(title='')
         
         self._init_coll_MenuBar_Menus(self.MenuBar)
+        self._init_coll_FileMenu_Items(self.FileMenu)
         self._init_coll_EditMenu_Items(self.EditMenu)
         
     def _init_ctrls(self, prnt):
@@ -977,6 +986,12 @@
         self.RefreshEditMenu()
         
 #-------------------------------------------------------------------------------
+#                          File Project Menu Functions
+#-------------------------------------------------------------------------------
+    def RefreshFileMenu(self):
+        self.FileMenu.Enable(wx.ID_SAVE, True)
+    
+#-------------------------------------------------------------------------------
 #                      CFile Editor Panels Management Functions
 #-------------------------------------------------------------------------------