From nobody Mon Apr 29 04:06:15 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+77550+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+77550+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1625650398; cv=none; d=zohomail.com; s=zohoarc; b=YnIvjpCJx9USDHc3rf7jZPBNchnk/50AYhOe3SPFKdGfQ2n7iyKtWP4FOi05k/kdevVI8v0OwaMDHjee/yNmBphOCI01BTt3+usl0mFSs55sMe7NmfMCRnu3lEGSisyhomsx0QDKp3yWEUpyON1FQ08PhEJLtsGOZFtKaGGet1o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1625650398; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=3qdqdhk2ejvcgexxIX6tG5Q3zhxoqqwEHAXQlN4PvR4=; b=FixFVuuQr2poClgp+ixMqqSFXNskD1BsQFs37xP/2yzqvWAxqdAcpjGzjmjwFxJzsAEfMKdHoKyMO1QMzs3koa/5hi9V+Je1vFNVR6haR8XQv14f4pn2cU6nivBPbmL3L9g+7a55xy2frTiYNQV4GjxTaOZY13nL9j5CWUVCIzI= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+77550+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1625650398692106.0946903469088; Wed, 7 Jul 2021 02:33:18 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 14ctYY1788612xnAz835KGG4; Wed, 07 Jul 2021 02:33:18 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web08.18883.1625650392190224706 for ; Wed, 07 Jul 2021 02:33:12 -0700 X-IronPort-AV: E=McAfee;i="6200,9189,10037"; a="209091345" X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="209091345" X-Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 02:33:08 -0700 X-IronPort-AV: E=Sophos;i="5.83,331,1616482800"; d="scan'208";a="486748349" X-Received: from tunglunl-mobl1.gar.corp.intel.com ([10.214.155.118]) by fmsmga003-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jul 2021 02:33:06 -0700 From: "Tung Lun" To: devel@edk2.groups.io Cc: Loo Tung Lun , Maurice Ma , Nate DeSimone , Star Zeng , Chasel Chiu Subject: [edk2-devel] [PATCH] IntelFsp2Pkg: Add search function for Config Editor Date: Wed, 7 Jul 2021 17:32:59 +0800 Message-Id: <20210707093259.1989-1-tung.lun.loo@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,tung.lun.loo@intel.com X-Gm-Message-State: vmiNySHZhfhTHDErJb1pFCXJx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1625650398; bh=v1u9MtLcHqWL5x45AA8+oJc34XgAS35+Xp6L3Umj/tk=; h=Cc:Date:From:Reply-To:Subject:To; b=Rhm7vou0Mam0A9Zd7PvnQC0xq73oAFbNRwYe97Kr/qGsJdhr6cocIH6sljQ8MyYI/oH SOvfK0MgXMuoUZ2VnIHEjiEHHtYysZRSLxxJt2U8O44x4MvJ+CmOABBaE8y7xqHJAK/eu ZWnNT48aTZc8Vle++VdZZBzpgXAe1H2lhPk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1625650399358100002 Content-Type: text/plain; charset="utf-8" BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3482 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. Cc: Maurice Ma Cc: Nate DeSimone Cc: Star Zeng Cc: Chasel Chiu Signed-off-by: Loo Tung Lun --- IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py | 31 +++++++++++++++++++++= ++++++++++ IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py | 25 +++++++++++++++++++--= ---- 2 files changed, 50 insertions(+), 6 deletions(-) diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py b/IntelFsp2Pkg= /Tools/ConfigEditor/ConfigEditor.py index a7f79bbc96..d58df385b1 100644 --- a/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py +++ b/IntelFsp2Pkg/Tools/ConfigEditor/ConfigEditor.py @@ -811,6 +811,7 @@ class application(tkinter.Frame): self.org_cfg_data_bin =3D None self.in_left =3D state() self.in_right =3D state() + self.search_text =3D '' =20 # 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 +836,23 @@ class application(tkinter.Frame): =20 root.geometry("1200x800") =20 + # Search string + fram =3D tkinter.Frame(root) + # adding label to search box + tkinter.Label(fram, text=3D'Text to find:').pack(side=3Dtkinter.LE= FT) + # adding of single line text box + self.edit =3D tkinter.Entry(fram, width=3D30) + # positioning of text box + self.edit.pack( + side=3Dtkinter.LEFT, fill=3Dtkinter.BOTH, expand=3D1, padx=3D(= 4, 4)) + # setting focus + self.edit.focus_set() + # adding of search button + butt =3D tkinter.Button(fram, text=3D'Search', relief=3Dtkinter.GR= OOVE, + command=3Dself.search_bar) + butt.pack(side=3Dtkinter.RIGHT, padx=3D(4, 4)) + fram.pack(side=3Dtkinter.TOP, anchor=3Dtkinter.SE) + paned =3D ttk.Panedwindow(root, orient=3Dtkinter.HORIZONTAL) paned.pack(fill=3Dtkinter.BOTH, expand=3DTrue, padx=3D(4, 4)) =20 @@ -943,6 +961,12 @@ class application(tkinter.Frame): "Unsupported file '%s' !" % path) return =20 + def search_bar(self): + # get data from text box + self.search_text =3D 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)] =3D name =20 @@ -999,6 +1023,12 @@ class application(tkinter.Frame): widget.grid() widget.configure(state=3D'normal') =20 + if visible and self.search_text !=3D '': + name =3D item['name'] + if name.lower().find(self.search_text.lower()) =3D=3D -1: + visible =3D False + widget.grid_remove() + return visible =20 def update_widgets_visibility_on_page(self): @@ -1377,6 +1407,7 @@ class application(tkinter.Frame): return None else: path =3D name + item =3D self.cfg_data_obj.get_item_by_path(path) return item =20 diff --git a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py b/IntelFsp2Pkg/T= ools/ConfigEditor/GenYamlCfg.py index 25fd9c547e..0d9505b97f 100644 --- a/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py +++ b/IntelFsp2Pkg/Tools/ConfigEditor/GenYamlCfg.py @@ -583,6 +583,7 @@ class CGenYamlCfg: self._mode =3D '' self._debug =3D False self._macro_dict =3D {} + self.bin_offset =3D [] self.initialize() =20 def initialize(self): @@ -1301,10 +1302,15 @@ option format '%s' !" % option) if 'indx' not in cfgs: return act_cfg =3D self.get_item_by_index(cfgs['indx']) - if force or act_cfg['value'] =3D=3D '': + actual_offset =3D act_cfg['offset'] - struct_info['offset'] + set_value =3D True + for each in self.bin_offset: + if actual_offset in range(each[0], (each[0] + each[2]) * 8= ): + if each[1] < 0: + set_value =3D False + if set_value and force or act_cfg['value'] =3D=3D '': value =3D get_bits_from_bytes(full_bytes, - act_cfg['offset'] - - struct_info['offset'], + actual_offset, act_cfg['length']) act_val =3D act_cfg['value'] if act_val =3D=3D '': @@ -1424,8 +1430,8 @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) % seg[0]) bin_segs.append([seg[0], pos, seg[2]]) else: - raise Exception("Could not find '%s' in binary !" - % seg[0]) + bin_segs.append([seg[0], -1, seg[2]]) + continue =20 return bin_segs =20 @@ -1433,8 +1439,15 @@ for '%s' !" % (act_cfg['value'], act_cfg['path'])) # get cfg bin length cfg_bins =3D bytearray() bin_segs =3D self.get_bin_segment(bin_data) + Dummy_offset =3D 0 for each in bin_segs: - cfg_bins.extend(bin_data[each[1]:each[1] + each[2]]) + if each[1] !=3D -1: + self.bin_offset.append([Dummy_offset, each[1], each[2]]) + cfg_bins.extend(bin_data[each[1]:each[1] + each[2]]) + else: + self.bin_offset.append([Dummy_offset, each[1], each[2]]) + cfg_bins.extend(bytearray(each[2])) + Dummy_offset +=3D each[2] return cfg_bins =20 def save_current_to_bin(self): --=20 2.28.0.windows.1 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#77550): https://edk2.groups.io/g/devel/message/77550 Mute This Topic: https://groups.io/mt/84040828/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-