Bug with undefined menu items in File and Edit menus in Debug mode fixed
authorlbessard
Fri, 13 Feb 2009 14:45:19 +0100
changeset 309 aef88ffa5fbc
parent 308 bf1facfd1d36
child 310 ccb47adebe80
Bug with undefined menu items in File and Edit menus in Debug mode fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Mon Jan 19 17:09:11 2009 +0100
+++ b/PLCOpenEditor.py	Fri Feb 13 14:45:19 2009 +0100
@@ -767,20 +767,22 @@
                 self.FileMenu.Enable(wx.ID_CLOSE, False)
                 self.FileMenu.Enable(wx.ID_PREVIEW, False)
                 self.FileMenu.Enable(wx.ID_PRINT, False)
-            self.FileMenu.Enable(wx.ID_SAVE, True)
             self.FileMenu.Enable(wx.ID_PAGE_SETUP, True)
-            self.FileMenu.Enable(wx.ID_PROPERTIES, True)
+            if not self.Debug:
+                self.FileMenu.Enable(wx.ID_SAVE, True)
+                self.FileMenu.Enable(wx.ID_PROPERTIES, True)
             if self.ModeSolo:
                 self.FileMenu.Enable(wx.ID_CLOSE_ALL, True)
                 self.FileMenu.Enable(wx.ID_SAVEAS, True)
                 self.FileMenu.Enable(ID_PLCOPENEDITORFILEMENUGENERATE, True)
         else:
             self.FileMenu.Enable(wx.ID_CLOSE, False)
-            self.FileMenu.Enable(wx.ID_SAVE, False)
             self.FileMenu.Enable(wx.ID_PAGE_SETUP, False)
             self.FileMenu.Enable(wx.ID_PREVIEW, False)
             self.FileMenu.Enable(wx.ID_PRINT, False)
-            self.FileMenu.Enable(wx.ID_PROPERTIES, False)
+            if not self.Debug:
+                self.FileMenu.Enable(wx.ID_SAVE, False)
+                self.FileMenu.Enable(wx.ID_PROPERTIES, False)
             if self.ModeSolo:
                 self.FileMenu.Enable(wx.ID_CLOSE_ALL, False)
                 self.FileMenu.Enable(wx.ID_SAVEAS, False)
@@ -990,29 +992,30 @@
 
     def RefreshEditMenu(self):
         if self.Controler.HasOpenedProject():
-            undo, redo = self.Controler.GetBufferState()
-            self.EditMenu.Enable(wx.ID_UNDO, undo)
-            self.EditMenu.Enable(wx.ID_REDO, redo)
-        else:
-            self.EditMenu.Enable(wx.ID_UNDO, False)
-            self.EditMenu.Enable(wx.ID_REDO, False)
-        if self.Controler.HasOpenedProject():
             if self.TabsOpened.GetPageCount() > 0:
                 self.EditMenu.Enable(wx.ID_REFRESH, True)
             else:
                 self.EditMenu.Enable(wx.ID_REFRESH, False)
-            self.EditMenu.Enable(wx.ID_ADD, True)
-            self.EditMenu.Enable(wx.ID_DELETE, True)
+            if not self.Debug:
+                undo, redo = self.Controler.GetBufferState()
+                self.EditMenu.Enable(wx.ID_UNDO, undo)
+                self.EditMenu.Enable(wx.ID_REDO, redo)
+                self.EditMenu.Enable(wx.ID_ADD, True)
+                self.EditMenu.Enable(wx.ID_DELETE, True)
         else:
             self.EditMenu.Enable(wx.ID_REFRESH, False)
-            self.EditMenu.Enable(wx.ID_ADD, False)
-            self.EditMenu.Enable(wx.ID_DELETE, False)
-        self.EditMenu.Enable(wx.ID_CUT, True)
-        self.EditMenu.Enable(wx.ID_COPY, True)
-        if self.CopyBuffer is not None:
-            self.EditMenu.Enable(wx.ID_PASTE, True)
-        else:
-            self.EditMenu.Enable(wx.ID_PASTE, False)
+            if not self.Debug:
+                self.EditMenu.Enable(wx.ID_UNDO, False)
+                self.EditMenu.Enable(wx.ID_REDO, False)
+                self.EditMenu.Enable(wx.ID_ADD, False)
+                self.EditMenu.Enable(wx.ID_DELETE, False)
+        if not self.Debug:
+            self.EditMenu.Enable(wx.ID_CUT, True)
+            self.EditMenu.Enable(wx.ID_COPY, True)
+            if self.CopyBuffer is not None:
+                self.EditMenu.Enable(wx.ID_PASTE, True)
+            else:
+                self.EditMenu.Enable(wx.ID_PASTE, False)
 
     def OnRefreshMenu(self, event):
         selected = self.TabsOpened.GetSelection()