From 713c48ddd7f296fe064cf58af7baa31aa5fcffb3 Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Sat, 10 Dec 2022 15:05:22 +0300 Subject: [PATCH] add an 'installed' tag to extensions --- modules/ui_extensions.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index b487ac25b..1434f25fe 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -206,12 +206,13 @@ def refresh_available_extensions_from_data(hide_tags): if url is None: continue + existing = installed_extension_urls.get(normalize_git_url(url), None) + extension_tags = extension_tags + ["installed"] if existing else extension_tags + if len([x for x in extension_tags if x in tags_to_hide]) > 0: hidden += 1 continue - existing = installed_extension_urls.get(normalize_git_url(url), None) - install_code = f"""""" tags_text = ", ".join([f"{x}" for x in extension_tags]) @@ -222,7 +223,11 @@ def refresh_available_extensions_from_data(hide_tags): {html.escape(description)} {install_code} - """ + + """ + + for tag in [x for x in extension_tags if x not in tags]: + tags[tag] = tag code += """ @@ -272,7 +277,7 @@ def create_ui(): install_extension_button = gr.Button(elem_id="install_extension_button", visible=False) with gr.Row(): - hide_tags = gr.CheckboxGroup(value=["ads", "localization"], label="Hide extensions with tags", choices=["script", "ads", "localization"]) + hide_tags = gr.CheckboxGroup(value=["ads", "localization", "installed"], label="Hide extensions with tags", choices=["script", "ads", "localization", "installed"]) install_result = gr.HTML() available_extensions_table = gr.HTML()