# HG changeset patch # User Laurent Bessard # Date 1370552475 -7200 # Node ID 5e6d0969bb5d05825bfc1b984617d4e9a02f7025 # Parent b6894285d4cc6c5af99cd8b4d72ca81a4e0a064b Fixed bugs in refresh of PouInstanceVariablesPanel diff -r b6894285d4cc -r 5e6d0969bb5d IDEFrame.py --- a/IDEFrame.py Thu Jun 06 17:03:19 2013 +0200 +++ b/IDEFrame.py Thu Jun 06 23:01:15 2013 +0200 @@ -1358,6 +1358,7 @@ tagname = window.GetTagName() if not window.IsDebugging(): self.SelectProjectTreeItem(tagname) + self.PouInstanceVariablesPanel.SetPouType(tagname) window.RefreshView() self.EnsureTabVisible(self.LibraryPanel) else: diff -r b6894285d4cc -r 5e6d0969bb5d controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Thu Jun 06 17:03:19 2013 +0200 +++ b/controls/PouInstanceVariablesPanel.py Thu Jun 06 23:01:15 2013 +0200 @@ -114,15 +114,20 @@ def SetPouType(self, tagname, pou_instance=None): if self.Controller is not None: - self.PouTagName = tagname - if self.PouTagName == "Project": + if tagname == "Project": config_name = self.Controller.GetProjectMainConfigurationName() if config_name is not None: - self.PouTagName = self.Controller.ComputeConfigurationName(config_name) + tagname = self.Controller.ComputeConfigurationName(config_name) if pou_instance is not None: self.PouInstance = pou_instance - - self.RefreshView() + + if self.PouTagName != tagname: + self.PouTagName = tagname + self.RefreshView() + else: + self.RefreshInstanceChoice() + else: + self.RefreshView() def ResetView(self): self.Controller = None @@ -197,6 +202,14 @@ self.VariablesList.SetItemImage(item, self.ParentWindow.GetTreeImage(var_infos["class"])) self.VariablesList.SetPyData(item, var_infos) + self.RefreshInstanceChoice() + + self.RefreshButtons() + + self.Thaw() + + def RefreshInstanceChoice(self): + if self.Controller is not None and self.PouInfos is not None: instances = self.Controller.SearchPouInstances(self.PouTagName, self.Debug) for instance in instances: self.InstanceChoice.Append(instance) @@ -210,11 +223,7 @@ else: self.PouInstance = None self.InstanceChoice.SetValue(_("Select an instance")) - - self.RefreshButtons() - - self.Thaw() - + def RefreshButtons(self): enabled = self.InstanceChoice.GetSelection() != -1 self.ParentButton.Enable(enabled and self.PouInfos["class"] != ITEM_CONFIGURATION) diff -r b6894285d4cc -r 5e6d0969bb5d editors/Viewer.py --- a/editors/Viewer.py Thu Jun 06 17:03:19 2013 +0200 +++ b/editors/Viewer.py Thu Jun 06 23:01:15 2013 +0200 @@ -271,6 +271,7 @@ self.ParentWindow.RefreshScrollBars() self.ParentWindow.RefreshVisibleElements() self.ParentWindow.RefreshVariablePanel() + self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() self.ParentWindow.Refresh(False) elif values[1] == "location": if pou_type == "program": @@ -318,6 +319,7 @@ if not var_name.upper() in [name.upper() for name in self.ParentWindow.Controler.GetEditedElementVariables(tagname, self.ParentWindow.Debug)]: self.ParentWindow.Controler.AddEditedElementPouExternalVar(tagname, values[2], var_name) self.ParentWindow.RefreshVariablePanel() + self.ParentWindow.ParentWindow.RefreshPouInstanceVariablesPanel() self.ParentWindow.AddVariableBlock(x, y, scaling, INPUT, var_name, values[2]) elif values[1] == "Constant": self.ParentWindow.AddVariableBlock(x, y, scaling, INPUT, values[0], None)