controls/PouInstanceVariablesPanel.py
changeset 1189 93a4431a0cd8
parent 1107 9303f6b900fe
child 1214 2ef048b5383c
equal deleted inserted replaced
1188:63afb5833bd8 1189:93a4431a0cd8
   320                 self.InstanceChoice.GetStringSelection(),
   320                 self.InstanceChoice.GetStringSelection(),
   321                 self.PouTagName)
   321                 self.PouTagName)
   322         event.Skip()
   322         event.Skip()
   323         
   323         
   324     def OnVariablesListItemActivated(self, event):
   324     def OnVariablesListItemActivated(self, event):
   325         if self.InstanceChoice.GetSelection() != -1:
   325         selected_item = event.GetItem()
   326             instance_path = self.InstanceChoice.GetStringSelection()
   326         if selected_item is not None and selected_item.IsOk():
   327             selected_item = event.GetItem()
   327             item_infos = self.VariablesList.GetPyData(selected_item)
   328             if selected_item is not None and selected_item.IsOk():
   328             if item_infos is not None and item_infos["class"] not in ITEMS_VARIABLE:
   329                 item_infos = self.VariablesList.GetPyData(selected_item)
   329                 instance_path = self.InstanceChoice.GetStringSelection()
   330                 if item_infos is not None and item_infos["class"] not in ITEMS_VARIABLE:
   330                 if item_infos["class"] == ITEM_RESOURCE:
   331                     if item_infos["class"] == ITEM_RESOURCE:
   331                     if instance_path != "":
   332                         tagname = self.Controller.ComputeConfigurationResourceName(
   332                         tagname = self.Controller.ComputeConfigurationResourceName(
   333                                        instance_path, 
   333                                        instance_path, 
   334                                        item_infos["name"])
   334                                        item_infos["name"])
   335                     else:
   335                     else:
   336                         tagname = self.Controller.ComputePouName(item_infos["type"])
   336                         tagname = None
   337                     item_path = "%s.%s" % (instance_path, item_infos["name"])
   337                 else:
       
   338                     tagname = self.Controller.ComputePouName(item_infos["type"])
       
   339                 if tagname is not None:
       
   340                     if instance_path != "":
       
   341                         item_path = "%s.%s" % (instance_path, item_infos["name"])
       
   342                     else:
       
   343                         item_path = None
   338                     wx.CallAfter(self.SetPouType, tagname, item_path)
   344                     wx.CallAfter(self.SetPouType, tagname, item_path)
   339                     wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, tagname)
   345                     wx.CallAfter(self.ParentWindow.SelectProjectTreeItem, tagname)
   340         event.Skip()
   346         event.Skip()
   341     
   347     
   342     def OnVariablesListLeftDown(self, event):
   348     def OnVariablesListLeftDown(self, event):