# HG changeset patch # User Surkov Sergey # Date 1490710171 -10800 # Node ID 54da2cfe0180c6248e4a229efca37c447e472e47 # Parent cd9db17c7ab53e4277afc9ab7dcd18fe3a5c2bbc fix debug button and variable tree generate for actions and transitions in POU instance variable panel for 'None' type instances(Python POU's, Native, SVGUI, user-defined pou's, etc.) debug button will be disabled. If action or transition instances have opened in instance variable panel,variables from main POU will be loaded. When user press debug button on variable instance in action or transition, instance path to main POU will be used, because all variables of action or transition in instance variable tree belong to main POU. diff -r cd9db17c7ab5 -r 54da2cfe0180 controls/PouInstanceVariablesPanel.py --- a/controls/PouInstanceVariablesPanel.py Tue Mar 28 11:31:05 2017 +0300 +++ b/controls/PouInstanceVariablesPanel.py Tue Mar 28 17:09:31 2017 +0300 @@ -229,11 +229,16 @@ self.VariablesList.DeleteAllItems() if self.Controller is not None and self.PouTagName is not None: - self.PouInfos = self.Controller.GetPouVariables(self.PouTagName, self.Debug) + if self.PouTagName.split('::')[0] in ['A', 'T']: + self.PouInfos = self.Controller.GetPouVariables('P::%s' % self.PouTagName.split('::')[1], self.Debug) + else: + self.PouInfos = self.Controller.GetPouVariables(self.PouTagName, self.Debug) + if None in self.Controller.GetEditedElementType(self.PouTagName, self.Debug) and self.PouInfos is not None: + self.PouInfos.debug = False else: self.PouInfos = None if self.PouInfos is not None: - root = self.VariablesList.AddRoot("") + root = self.VariablesList.AddRoot("", data=self.PouInfos) for var_infos in self.PouInfos.variables: if var_infos.type is not None: text = "%s (%s)" % (var_infos.name, var_infos.type) @@ -313,8 +318,11 @@ def DebugButtonCallback(self, infos): if self.InstanceChoice.GetSelection() != -1: var_class = infos.var_class - var_path = "%s.%s" % (self.InstanceChoice.GetStringSelection(), - infos.name) + instance_path = self.InstanceChoice.GetStringSelection() + if self.PouTagName.split("::")[0] in ["A", "T"]: + pos = instance_path.rfind('.') + instance_path = instance_path[0:pos] + var_path = "%s.%s" % (instance_path, infos.name) if var_class in ITEMS_VARIABLE: self.ParentWindow.AddDebugVariable(var_path, force=True) elif var_class == ITEM_TRANSITION: @@ -401,7 +409,13 @@ else: tagname = None else: - tagname = self.Controller.ComputePouName(item_infos.type) + parent_infos = self.VariablesList.GetPyData(selected_item.GetParent()) + if item_infos.var_class == ITEM_ACTION: + tagname = self.Controller.ComputePouActionName(parent_infos.type, item_infos.name) + elif item_infos.var_class == ITEM_TRANSITION: + tagname = self.Controller.ComputePouTransitionName(parent_infos.type, item_infos.name) + else: + tagname = self.Controller.ComputePouName(item_infos.type) if tagname is not None: if instance_path != "": item_path = "%s.%s" % (instance_path, item_infos.name)