# HG changeset patch # User Edouard Tisserant # Date 1552655509 -3600 # Node ID aa7f138648f3dbfdd5e4397bc00c0245f4c61122 # Parent 48ebcbe7f19b617949dd4ceb697e198ca123e705 WIP adding searching capabilities in python files: - Added recursive Search capability to config tree nodes - Added stub search to code editors, for test diff -r 48ebcbe7f19b -r aa7f138648f3 CodeFileTreeNode.py --- a/CodeFileTreeNode.py Mon Mar 11 13:51:07 2019 +0100 +++ b/CodeFileTreeNode.py Fri Mar 15 14:11:49 2019 +0100 @@ -209,6 +209,11 @@ if variable.getonchange()]) return ret + + def CTNSearch(self, criteria): + # TODO really search + return [((self.CTNFullName()), (0,0),(0,3),"cow")] + # ------------------------------------------------------------------------------- # Current Buffering Management Functions # ------------------------------------------------------------------------------- diff -r 48ebcbe7f19b -r aa7f138648f3 ConfigTreeNode.py --- a/ConfigTreeNode.py Mon Mar 11 13:51:07 2019 +0100 +++ b/ConfigTreeNode.py Fri Mar 15 14:11:49 2019 +0100 @@ -36,6 +36,7 @@ import traceback import types import shutil +from operator import add from builtins import str as text from past.builtins import execfile @@ -121,6 +122,12 @@ return parent + "." + self.CTNName() return self.BaseParams.getName() + def CTNSearch(self, criteria): + # TODO match config's fields name and fields contents + return reduce(add, [ + CTNChild.CTNSearch(criteria) + for CTNChild in self.IterChildren()]) + def GetIconName(self): return None diff -r 48ebcbe7f19b -r aa7f138648f3 PLCControler.py --- a/PLCControler.py Mon Mar 11 13:51:07 2019 +0100 +++ b/PLCControler.py Fri Mar 15 14:11:49 2019 +0100 @@ -2749,7 +2749,10 @@ # ------------------------------------------------------------------------------- def SearchInProject(self, criteria): - return self.Project.Search(criteria) + project_matches = self.Project.Search(criteria) + print(project_matches) + ctn_matches = self.CTNSearch(criteria) + return project_matches + ctn_matches def SearchInPou(self, tagname, criteria, debug=False): pou = self.GetEditedElement(tagname, debug)