summaryrefslogtreecommitdiffstats
path: root/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
diff options
context:
space:
mode:
authorLoo, Tung Lun <tung.lun.loo@intel.com>2021-07-13 08:12:08 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-07-15 14:21:14 +0000
commitcac83b6f3bfa361bb2c561675c3247ff88341067 (patch)
treee5f49c1caf0d96933c18dbbbc307962d5342174a /IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
parentbe282b14938846960cce30825a9fe762e14ca8c9 (diff)
downloadedk2-cac83b6f3bfa361bb2c561675c3247ff88341067.tar.gz
edk2-cac83b6f3bfa361bb2c561675c3247ff88341067.tar.bz2
edk2-cac83b6f3bfa361bb2c561675c3247ff88341067.zip
IntelFsp2Pkg: Add search function for Config Editor
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3482 This patch adds a search function in the Config Editor GUI at the top right corner. Once users key in the words to search, it will look for the option containing the string in the same page and display it. It also includes a README for this function. Cc: Maurice Ma <maurice.ma@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Signed-off-by: Loo Tung Lun <tung.lun.loo@intel.com> Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Diffstat (limited to 'IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py')
-rw-r--r--IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py41
1 files changed, 39 insertions, 2 deletions
diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
index a7f79bbc96..008c7d7a16 100644
--- a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
+++ b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py
@@ -811,6 +811,8 @@ class application(tkinter.Frame):
self.org_cfg_data_bin = None
self.in_left = state()
self.in_right = state()
+ self.search_text = ''
+ self.binseg_dict = {}
# Check if current directory contains a file with a .yaml extension
# if not default self.last_dir to a Platform directory where it is
@@ -835,6 +837,23 @@ class application(tkinter.Frame):
root.geometry("1200x800")
+ # Search string
+ fram = tkinter.Frame(root)
+ # adding label to search box
+ tkinter.Label(fram, text='Text to find:').pack(side=tkinter.LEFT)
+ # adding of single line text box
+ self.edit = tkinter.Entry(fram, width=30)
+ # positioning of text box
+ self.edit.pack(
+ side=tkinter.LEFT, fill=tkinter.BOTH, expand=1, padx=(4, 4))
+ # setting focus
+ self.edit.focus_set()
+ # adding of search button
+ butt = tkinter.Button(fram, text='Search', relief=tkinter.GROOVE,
+ command=self.search_bar)
+ butt.pack(side=tkinter.RIGHT, padx=(4, 4))
+ fram.pack(side=tkinter.TOP, anchor=tkinter.SE)
+
paned = ttk.Panedwindow(root, orient=tkinter.HORIZONTAL)
paned.pack(fill=tkinter.BOTH, expand=True, padx=(4, 4))
@@ -943,6 +962,12 @@ class application(tkinter.Frame):
"Unsupported file '%s' !" % path)
return
+ def search_bar(self):
+ # get data from text box
+ self.search_text = self.edit.get()
+ # Clear the page and update it according to search value
+ self.refresh_config_data_page()
+
def set_object_name(self, widget, name):
self.conf_list[id(widget)] = name
@@ -976,14 +1001,18 @@ class application(tkinter.Frame):
'units')
def update_visibility_for_widget(self, widget, args):
-
visible = True
item = self.get_config_data_item_from_widget(widget, True)
if item is None:
return visible
elif not item:
return visible
-
+ if self.cfg_data_obj.binseg_dict:
+ str_split = item['path'].split('.')
+ if self.cfg_data_obj.binseg_dict[str_split[-2]] == -1:
+ visible = False
+ widget.grid_remove()
+ return visible
result = 1
if item['condition']:
result = self.evaluate_condition(item)
@@ -999,6 +1028,12 @@ class application(tkinter.Frame):
widget.grid()
widget.configure(state='normal')
+ if visible and self.search_text != '':
+ name = item['name']
+ if name.lower().find(self.search_text.lower()) == -1:
+ visible = False
+ widget.grid_remove()
+
return visible
def update_widgets_visibility_on_page(self):
@@ -1134,6 +1169,7 @@ class application(tkinter.Frame):
self.fsp_version = '2.X'
else:
self.fsp_version = '1.X'
+
return gen_cfg_data
def about(self):
@@ -1377,6 +1413,7 @@ class application(tkinter.Frame):
return None
else:
path = name
+
item = self.cfg_data_obj.get_item_by_path(path)
return item