Fixed flickering and lag when refreshing PouInstanceVariablesPanel
authorLaurent Bessard
Wed, 05 Jun 2013 23:09:52 +0200
changeset 1222 775b48a2be3b
parent 1221 d18ccec78117
child 1223 d51cea72baa7
Fixed flickering and lag when refreshing PouInstanceVariablesPanel
IDEFrame.py
PLCControler.py
controls/PouInstanceVariablesPanel.py
--- a/IDEFrame.py	Wed Jun 05 23:06:01 2013 +0200
+++ b/IDEFrame.py	Wed Jun 05 23:09:52 2013 +0200
@@ -1358,7 +1358,6 @@
             tagname = window.GetTagName()
             if not window.IsDebugging():
                 self.SelectProjectTreeItem(tagname)
-                self.PouInstanceVariablesPanel.SetPouType(tagname)
                 window.RefreshView()
                 self.EnsureTabVisible(self.LibraryPanel)
             else:
--- a/PLCControler.py	Wed Jun 05 23:06:01 2013 +0200
+++ b/PLCControler.py	Wed Jun 05 23:09:52 2013 +0200
@@ -561,7 +561,7 @@
                         instances.append(var_path)
                     else:
                         pou = project.getpou(var_type)
-                        if pou is not None:
+                        if pou is not None and project.ElementIsUsedBy(pou_type, var_type):
                             instances.extend(
                                 self.RecursiveSearchPouInstances(
                                     project, pou_type, var_path, 
@@ -596,7 +596,7 @@
                             if pou_type == words[1]:
                                 instances.append(pou_path)
                             pou = project.getpou(pou_type)
-                            if pou is not None:
+                            if pou is not None and project.ElementIsUsedBy(words[1], pou_type):
                                 instances.extend(
                                     self.RecursiveSearchPouInstances(
                                         project, words[1], pou_path, 
--- a/controls/PouInstanceVariablesPanel.py	Wed Jun 05 23:06:01 2013 +0200
+++ b/controls/PouInstanceVariablesPanel.py	Wed Jun 05 23:09:52 2013 +0200
@@ -113,7 +113,7 @@
         self.RefreshView()
     
     def SetPouType(self, tagname, pou_instance=None):
-        if  self.Controller is not None:
+        if self.Controller is not None:
             self.PouTagName = tagname
             if self.PouTagName == "Project":
                 config_name = self.Controller.GetProjectMainConfigurationName()
@@ -134,6 +134,7 @@
         self.RefreshView()
     
     def RefreshView(self):
+        self.Freeze()
         self.VariablesList.DeleteAllItems()
         self.InstanceChoice.Clear()
         self.InstanceChoice.SetValue("")
@@ -212,6 +213,8 @@
         
         self.RefreshButtons()
         
+        self.Thaw()
+        
     def RefreshButtons(self):
         enabled = self.InstanceChoice.GetSelection() != -1
         self.ParentButton.Enable(enabled and self.PouInfos["class"] != ITEM_CONFIGURATION)