# HG changeset patch
# User Laurent Bessard
# Date 1338768269 -7200
# Node ID 1a14560e10ede236f59b698e3e2c5585be6b3598
# Parent  ece862b07321cb5cba839d4915c85a17df7e3d39
Fix bug when reloading project layout, PouIntanceVariablesPanel not updated

diff -r ece862b07321 -r 1a14560e10ed PLCOpenEditor.py
--- a/PLCOpenEditor.py	Mon Jun 04 01:27:17 2012 +0200
+++ b/PLCOpenEditor.py	Mon Jun 04 02:04:29 2012 +0200
@@ -1521,10 +1521,16 @@
         selected = self.TabsOpened.GetSelection()
         if selected >= 0:
             window = self.TabsOpened.GetPage(selected)
+            tagname = window.GetTagName()
             if not window.IsDebugging():
-                self.SelectProjectTreeItem(window.GetTagName())
+                self.SelectProjectTreeItem(tagname)
+                self.PouInstanceVariablesPanel.SetPouType(tagname)
             else:
-                self.PouInstanceVariablesPanel.SetPouType(window.GetTagName(), window.GetInstancePath())
+                instance_path = window.GetInstancePath()
+                if tagname == "":
+                    instance_path = instance_path.rsplit(".", 1)[0]
+                    tagname = self.Controler.GetPouInstanceTagName(instance_path, self.EnableDebug)
+                self.PouInstanceVariablesPanel.SetPouType(tagname, instance_path)
             for child in self.TabsOpened.GetChildren():
                 if isinstance(child, wx.aui.AuiTabCtrl):
                     active_page = child.GetActivePage()