--- a/PLCControler.py Wed Dec 28 19:05:28 2016 +0300
+++ b/PLCControler.py Thu Dec 29 18:36:00 2016 +0300
@@ -3193,7 +3193,14 @@
def SearchInPou(self, tagname, criteria, debug=False):
pou = self.GetEditedElement(tagname, debug)
if pou is not None:
- return pou.Search(criteria)
+ search_results = pou.Search(criteria, [tagname])
+ if tagname.split("::")[0] in ['A', 'T']:
+ parent_pou_tagname = "P::%s" % (tagname.split("::")[-2])
+ parent_pou = self.GetEditedElement(parent_pou_tagname, debug)
+ for infos, start, end, text in parent_pou.Search(criteria):
+ if infos[1] in ["var_local", "var_input", "var_output", "var_inout"]:
+ search_results.append((infos, start, end, text))
+ return search_results
return []
#-------------------------------------------------------------------------------
--- a/editors/Viewer.py Wed Dec 28 19:05:28 2016 +0300
+++ b/editors/Viewer.py Thu Dec 29 18:36:00 2016 +0300
@@ -3465,12 +3465,13 @@
self.SearchResults = []
blocks = []
for infos, start, end, text in self.Controler.SearchInPou(self.TagName, search_params, self.Debug):
- if infos[1] in ["var_local", "var_input", "var_output", "var_inout"]:
- self.SearchResults.append((infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT))
- else:
- block = self.Blocks.get(infos[2])
- if block is not None:
- blocks.append((block, (infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT)))
+ if (infos[0] == self.TagName or self.TagName.split("::")[0] in ['A', 'T']) and infos[1] is not 'name':
+ if infos[1] in ["var_local", "var_input", "var_output", "var_inout"]:
+ self.SearchResults.append((infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT))
+ else:
+ block = self.Blocks.get(infos[2])
+ if block is not None:
+ blocks.append((block, (infos[1:], start, end, SEARCH_RESULT_HIGHLIGHT)))
blocks.sort(sort_blocks)
self.SearchResults.extend([infos for block, infos in blocks])
self.CurrentFindHighlight = None
--- a/plcopen/plcopen.py Wed Dec 28 19:05:28 2016 +0300
+++ b/plcopen/plcopen.py Thu Dec 29 18:36:00 2016 +0300
@@ -1409,7 +1409,8 @@
search_result = []
filter = criteria["filter"]
if filter == "all" or self.getpouType() in filter:
- parent_infos = parent_infos + ["P::%s" % self.getname()]
+ if parent_infos == []:
+ parent_infos = parent_infos + ["P::%s" % self.getname()]
search_result.extend(_Search([("name", self.getname())], criteria, parent_infos))
if self.interface is not None:
var_number = 0