Fix bug when opening another project while current edited project has at least one tab opened
authorlaurent
Sun, 09 Oct 2011 20:10:36 +0200
changeset 568 31976c61c701
parent 567 eb523c4fa2da
child 570 37ba389e5c01
Fix bug when opening another project while current edited project has at least one tab opened
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Sun Oct 09 20:04:35 2011 +0200
+++ b/PLCOpenEditor.py	Sun Oct 09 20:10:36 2011 +0200
@@ -1203,10 +1203,12 @@
         if USE_AUI:
             for child in self.TabsOpened.GetChildren():
                 if isinstance(child, wx.aui.AuiTabCtrl):
-                    window = child.GetWindowFromIdx(child.GetActivePage())
-                    window.RefreshView()
-                    if not window.IsDebugging() and self.TabsOpened.GetPageIndex(window) == selected and variablepanel:
-                        self.RefreshVariablePanel(window.GetTagName())
+                    active_page = child.GetActivePage()
+                    if active_page >= 0:
+                        window = child.GetWindowFromIdx(child.GetActivePage())
+                        window.RefreshView()
+                        if not window.IsDebugging() and self.TabsOpened.GetPageIndex(window) == selected and variablepanel:
+                            self.RefreshVariablePanel(window.GetTagName())
         elif selected >= 0:
             window = self.TabsOpened.GetPage(idx)
             window.RefreshView()