Fixing bug conflict on tab selection between POU editor and Debug window of an instance of this same POU on Windows
authorlaurent
Wed, 21 Dec 2011 19:41:29 +0100
changeset 613 c487c54c1cfe
parent 612 fdb9501e5cc8
child 614 8c4b57808f9c
Fixing bug conflict on tab selection between POU editor and Debug window of an instance of this same POU on Windows
PLCOpenEditor.py
TextViewer.py
controls/EditorPanel.py
--- a/PLCOpenEditor.py	Wed Dec 21 19:38:26 2011 +0100
+++ b/PLCOpenEditor.py	Wed Dec 21 19:41:29 2011 +0100
@@ -477,7 +477,7 @@
         
             self.TabsOpened = wx.aui.AuiNotebook(self, ID_PLCOPENEDITORTABSOPENED, 
                   style=wx.aui.AUI_NB_DEFAULT_STYLE|wx.aui.AUI_NB_WINDOWLIST_BUTTON)
-            self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,
+            self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,
                     self.OnPouSelectedChanged)
             self.TabsOpened.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSE,
                     self.OnPageClose)
@@ -519,10 +519,10 @@
                   0), size=wx.Size(0, 0), style=0)
             self.TabsOpened.SetImageList(self.TabsImageList)
             if wx.VERSION >= (2, 6, 0):
-                self.TabsOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,
+                self.TabsOpened.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGING,
                     self.OnPouSelectedChanged, id=ID_PLCOPENEDITORTABSOPENED)
             else:
-                wx.EVT_NOTEBOOK_PAGE_CHANGED(self.TabsOpened, ID_PLCOPENEDITORTABSOPENED,
+                wx.EVT_NOTEBOOK_PAGE_CHANGING(self.TabsOpened, ID_PLCOPENEDITORTABSOPENED,
                     self.OnPouSelectedChanged)
             
             self.RightNoteBook = wx.Notebook(id=ID_PLCOPENEDITORRIGHTNOTEBOOK,
@@ -1002,7 +1002,7 @@
                 window = self.TabsOpened.GetPage(selected)
                 undo, redo = window.GetBufferState()
             else:
-                undo, redo = False, False
+                undo, redo = self.Controler.GetBufferState()
             self.EditMenu.Enable(wx.ID_UNDO, undo)
             self.EditMenu.Enable(wx.ID_REDO, redo)
             #self.EditMenu.Enable(ID_PLCOPENEDITOREDITMENUENABLEUNDOREDO, True)
@@ -1049,16 +1049,20 @@
         if selected != -1:
             window = self.TabsOpened.GetPage(selected)
             window.Undo()
-            self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE, LIBRARYTREE, 
-                          SCALING, PAGETITLES)
+        else:
+            self.Controler.LoadPrevious()
+        self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE, LIBRARYTREE, 
+                      SCALING, PAGETITLES)    
     
     def OnRedoMenu(self, event):
         selected = self.TabsOpened.GetSelection()
         if selected != -1:
             window = self.TabsOpened.GetPage(selected)
             window.Redo()
-            self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE, LIBRARYTREE, 
-                          SCALING, PAGETITLES)
+        else:
+            self.Controler.LoadNext()
+        self._Refresh(TITLE, FILEMENU, EDITMENU, TYPESTREE, INSTANCESTREE, LIBRARYTREE, 
+                      SCALING, PAGETITLES)
     
     def OnEnableUndoRedoMenu(self, event):
         self.Controler.EnableProjectBuffer(event.IsChecked())
@@ -1196,8 +1200,10 @@
         if selected >= 0:
             window = self.TabsOpened.GetPage(selected)
             if not window.IsDebugging():
+                print "Is not Debugging"
                 wx.CallAfter(self.SelectTypesTreeItem, window.GetTagName())
             else:
+                print "Is Debugging"
                 wx.CallAfter(self.SelectInstancesTreeItem, self.InstancesTree.GetRootItem(), window.GetInstancePath())
             window.RefreshView()
             self._Refresh(FILEMENU, EDITMENU, DISPLAYMENU, TOOLBAR)
--- a/TextViewer.py	Wed Dec 21 19:38:26 2011 +0100
+++ b/TextViewer.py	Wed Dec 21 19:41:29 2011 +0100
@@ -222,9 +222,6 @@
         else:
             return self.TagName == tagname
     
-    def IsDebugging(self):
-        return self.Debug
-    
     def GetText(self):
         return self.Editor.GetText()
     
--- a/controls/EditorPanel.py	Wed Dec 21 19:38:26 2011 +0100
+++ b/controls/EditorPanel.py	Wed Dec 21 19:41:29 2011 +0100
@@ -94,7 +94,7 @@
         return self.TagName == tagname
 
     def IsDebugging(self):
-        return False
+        return self.Debug
 
     def SetMode(self, mode):
         pass