227 def RefreshView(self): |
227 def RefreshView(self): |
228 self.Freeze() |
228 self.Freeze() |
229 self.VariablesList.DeleteAllItems() |
229 self.VariablesList.DeleteAllItems() |
230 |
230 |
231 if self.Controller is not None and self.PouTagName is not None: |
231 if self.Controller is not None and self.PouTagName is not None: |
232 self.PouInfos = self.Controller.GetPouVariables(self.PouTagName, self.Debug) |
232 if self.PouTagName.split('::')[0] in ['A', 'T']: |
|
233 self.PouInfos = self.Controller.GetPouVariables('P::%s' % self.PouTagName.split('::')[1], self.Debug) |
|
234 else: |
|
235 self.PouInfos = self.Controller.GetPouVariables(self.PouTagName, self.Debug) |
|
236 if None in self.Controller.GetEditedElementType(self.PouTagName, self.Debug) and self.PouInfos is not None: |
|
237 self.PouInfos.debug = False |
233 else: |
238 else: |
234 self.PouInfos = None |
239 self.PouInfos = None |
235 if self.PouInfos is not None: |
240 if self.PouInfos is not None: |
236 root = self.VariablesList.AddRoot("") |
241 root = self.VariablesList.AddRoot("", data=self.PouInfos) |
237 for var_infos in self.PouInfos.variables: |
242 for var_infos in self.PouInfos.variables: |
238 if var_infos.type is not None: |
243 if var_infos.type is not None: |
239 text = "%s (%s)" % (var_infos.name, var_infos.type) |
244 text = "%s (%s)" % (var_infos.name, var_infos.type) |
240 else: |
245 else: |
241 text = var_infos.name |
246 text = var_infos.name |
311 self.ParentWindow.EditProjectElement(var_class, tagname) |
316 self.ParentWindow.EditProjectElement(var_class, tagname) |
312 |
317 |
313 def DebugButtonCallback(self, infos): |
318 def DebugButtonCallback(self, infos): |
314 if self.InstanceChoice.GetSelection() != -1: |
319 if self.InstanceChoice.GetSelection() != -1: |
315 var_class = infos.var_class |
320 var_class = infos.var_class |
316 var_path = "%s.%s" % (self.InstanceChoice.GetStringSelection(), |
321 instance_path = self.InstanceChoice.GetStringSelection() |
317 infos.name) |
322 if self.PouTagName.split("::")[0] in ["A", "T"]: |
|
323 pos = instance_path.rfind('.') |
|
324 instance_path = instance_path[0:pos] |
|
325 var_path = "%s.%s" % (instance_path, infos.name) |
318 if var_class in ITEMS_VARIABLE: |
326 if var_class in ITEMS_VARIABLE: |
319 self.ParentWindow.AddDebugVariable(var_path, force=True) |
327 self.ParentWindow.AddDebugVariable(var_path, force=True) |
320 elif var_class == ITEM_TRANSITION: |
328 elif var_class == ITEM_TRANSITION: |
321 self.ParentWindow.OpenDebugViewer( |
329 self.ParentWindow.OpenDebugViewer( |
322 var_class, |
330 var_class, |
399 instance_path, |
407 instance_path, |
400 item_infos.name) |
408 item_infos.name) |
401 else: |
409 else: |
402 tagname = None |
410 tagname = None |
403 else: |
411 else: |
404 tagname = self.Controller.ComputePouName(item_infos.type) |
412 parent_infos = self.VariablesList.GetPyData(selected_item.GetParent()) |
|
413 if item_infos.var_class == ITEM_ACTION: |
|
414 tagname = self.Controller.ComputePouActionName(parent_infos.type, item_infos.name) |
|
415 elif item_infos.var_class == ITEM_TRANSITION: |
|
416 tagname = self.Controller.ComputePouTransitionName(parent_infos.type, item_infos.name) |
|
417 else: |
|
418 tagname = self.Controller.ComputePouName(item_infos.type) |
405 if tagname is not None: |
419 if tagname is not None: |
406 if instance_path != "": |
420 if instance_path != "": |
407 item_path = "%s.%s" % (instance_path, item_infos.name) |
421 item_path = "%s.%s" % (instance_path, item_infos.name) |
408 else: |
422 else: |
409 item_path = None |
423 item_path = None |