From bbfff771d7337707bf501b27f98da2f7a7c06f73 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sat, 29 Jul 2023 01:07:35 +0900 Subject: --disable-all-extensions --disable-extra-extensions --- modules/ui_extensions.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index f3e4fba7..bd28bfcf 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -164,7 +164,7 @@ def extension_table(): ext_status = ext.status style = "" - if shared.opts.disable_all_extensions == "extra" and not ext.is_builtin or shared.opts.disable_all_extensions == "all": + if shared.cmd_opts.disable_extra_extensions and not ext.is_builtin or shared.opts.disable_all_extensions == "extra" and not ext.is_builtin or shared.cmd_opts.disable_all_extensions or shared.opts.disable_all_extensions == "all": style = STYLE_PRIMARY version_link = ext.version @@ -537,12 +537,16 @@ def create_ui(): extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False) html = "" - if shared.opts.disable_all_extensions != "none": - html = """ - - "Disable all extensions" was set, change it to "none" to load all extensions again - - """ + + if shared.cmd_opts.disable_all_extensions or shared.cmd_opts.disable_extra_extensions or shared.opts.disable_all_extensions != "none": + if shared.cmd_opts.disable_all_extensions: + msg = '"--disable-all-extensions" was used, remove it to load all extensions again' + elif shared.opts.disable_all_extensions != "none": + msg = '"Disable all extensions" was set, change it to "none" to load all extensions again' + elif shared.cmd_opts.disable_extra_extensions: + msg = '"--disable-extra-extensions" was used, remove it to load all extensions again' + html = f'{msg}' + info = gr.HTML(html) extensions_table = gr.HTML('Loading...') ui.load(fn=extension_table, inputs=[], outputs=[extensions_table]) -- cgit v1.2.1 From 362789a3793025c698fa42372fd66c3c4f2d6413 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Fri, 4 Aug 2023 07:50:17 +0300 Subject: gradio 3.39 --- modules/ui_extensions.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index bd28bfcf..15a8b0bf 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -533,8 +533,8 @@ def create_ui(): apply = gr.Button(value=apply_label, variant="primary") check = gr.Button(value="Check for updates") extensions_disable_all = gr.Radio(label="Disable all extensions", choices=["none", "extra", "all"], value=shared.opts.disable_all_extensions, elem_id="extensions_disable_all") - extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False).style(container=False) - extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False).style(container=False) + extensions_disabled_list = gr.Text(elem_id="extensions_disabled_list", visible=False, container=False) + extensions_update_list = gr.Text(elem_id="extensions_update_list", visible=False, container=False) html = "" @@ -569,7 +569,7 @@ def create_ui(): with gr.Row(): refresh_available_extensions_button = gr.Button(value="Load from:", variant="primary") extensions_index_url = os.environ.get('WEBUI_EXTENSIONS_INDEX', "https://raw.githubusercontent.com/AUTOMATIC1111/stable-diffusion-webui-extensions/master/index.json") - available_extensions_index = gr.Text(value=extensions_index_url, label="Extension index URL").style(container=False) + available_extensions_index = gr.Text(value=extensions_index_url, label="Extension index URL", container=False) extension_to_install = gr.Text(elem_id="extension_to_install", visible=False) install_extension_button = gr.Button(elem_id="install_extension_button", visible=False) @@ -578,7 +578,7 @@ def create_ui(): sort_column = gr.Radio(value="newest first", label="Order", choices=["newest first", "oldest first", "a-z", "z-a", "internal order",'update time', 'create time', "stars"], type="index") with gr.Row(): - search_extensions_text = gr.Text(label="Search").style(container=False) + search_extensions_text = gr.Text(label="Search", container=False) install_result = gr.HTML() available_extensions_table = gr.HTML() -- cgit v1.2.1 From 36ecff71aea2c9c9f296ae1e0b5da00a3aea26d3 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sun, 20 Aug 2023 15:36:39 +0900 Subject: catch error when loading config_states and save config_states with indent --- modules/ui_extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 15a8b0bf..c5a04d6b 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -65,7 +65,7 @@ def save_config_state(name): filename = os.path.join(config_states_dir, f"{timestamp}_{name}.json") print(f"Saving backup of webui/extension state to {filename}.") with open(filename, "w", encoding="utf-8") as f: - json.dump(current_config_state, f) + json.dump(current_config_state, f, indent=4) config_states.list_config_states() new_value = next(iter(config_states.all_config_states.keys()), "Current") new_choices = ["Current"] + list(config_states.all_config_states.keys()) -- cgit v1.2.1 From 2c10fda39900adcf9aca1f69c7ef023a2d85e2a9 Mon Sep 17 00:00:00 2001 From: w-e-w <40751091+w-e-w@users.noreply.github.com> Date: Sun, 20 Aug 2023 17:34:20 +0900 Subject: make it obvious that a config_status is corrupted also format HTML removing unnecessary text blocks --- modules/ui_extensions.py | 224 +++++++++++++++++++++++++---------------------- 1 file changed, 117 insertions(+), 107 deletions(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index c5a04d6b..e0138267 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -200,119 +200,129 @@ def update_config_states_table(state_name): created_date = time.asctime(time.gmtime(config_state["created_at"])) filepath = config_state.get("filepath", "") - code = f"""""" - - webui_remote = config_state["webui"]["remote"] or "" - webui_branch = config_state["webui"]["branch"] - webui_commit_hash = config_state["webui"]["commit_hash"] or "" - webui_commit_date = config_state["webui"]["commit_date"] - if webui_commit_date: - webui_commit_date = time.asctime(time.gmtime(webui_commit_date)) - else: - webui_commit_date = "" - - remote = f"""{html.escape(webui_remote or '')}""" - commit_link = make_commit_link(webui_commit_hash, webui_remote) - date_link = make_commit_link(webui_commit_hash, webui_remote, webui_commit_date) - - current_webui = config_states.get_webui_config() - - style_remote = "" - style_branch = "" - style_commit = "" - if current_webui["remote"] != webui_remote: - style_remote = STYLE_PRIMARY - if current_webui["branch"] != webui_branch: - style_branch = STYLE_PRIMARY - if current_webui["commit_hash"] != webui_commit_hash: - style_commit = STYLE_PRIMARY - - code += f"""

Config Backup: {config_name}

-
Filepath: {filepath}
-
Created at: {created_date}
""" - - code += f"""

WebUI State

- - - - - - - - - - - - - - - - - -
URLBranchCommitDate
{remote}{webui_branch}{commit_link}{date_link}
- """ - - code += """

Extension State

- - - - - - - - - - - - """ - - ext_map = {ext.name: ext for ext in extensions.extensions} - - for ext_name, ext_conf in config_state["extensions"].items(): - ext_remote = ext_conf["remote"] or "" - ext_branch = ext_conf["branch"] or "" - ext_enabled = ext_conf["enabled"] - ext_commit_hash = ext_conf["commit_hash"] or "" - ext_commit_date = ext_conf["commit_date"] - if ext_commit_date: - ext_commit_date = time.asctime(time.gmtime(ext_commit_date)) + try: + webui_remote = config_state["webui"]["remote"] or "" + webui_branch = config_state["webui"]["branch"] + webui_commit_hash = config_state["webui"]["commit_hash"] or "" + webui_commit_date = config_state["webui"]["commit_date"] + if webui_commit_date: + webui_commit_date = time.asctime(time.gmtime(webui_commit_date)) else: - ext_commit_date = "" + webui_commit_date = "" + + remote = f"""{html.escape(webui_remote or '')}""" + commit_link = make_commit_link(webui_commit_hash, webui_remote) + date_link = make_commit_link(webui_commit_hash, webui_remote, webui_commit_date) - remote = f"""{html.escape(ext_remote or '')}""" - commit_link = make_commit_link(ext_commit_hash, ext_remote) - date_link = make_commit_link(ext_commit_hash, ext_remote, ext_commit_date) + current_webui = config_states.get_webui_config() - style_enabled = "" style_remote = "" style_branch = "" style_commit = "" - if ext_name in ext_map: - current_ext = ext_map[ext_name] - current_ext.read_info_from_repo() - if current_ext.enabled != ext_enabled: - style_enabled = STYLE_PRIMARY - if current_ext.remote != ext_remote: - style_remote = STYLE_PRIMARY - if current_ext.branch != ext_branch: - style_branch = STYLE_PRIMARY - if current_ext.commit_hash != ext_commit_hash: - style_commit = STYLE_PRIMARY - - code += f""" - - - - - - - - """ - - code += """ - -
ExtensionURLBranchCommitDate
{html.escape(ext_name)}{remote}{ext_branch}{commit_link}{date_link}
- """ + if current_webui["remote"] != webui_remote: + style_remote = STYLE_PRIMARY + if current_webui["branch"] != webui_branch: + style_branch = STYLE_PRIMARY + if current_webui["commit_hash"] != webui_commit_hash: + style_commit = STYLE_PRIMARY + + code = f""" +

Config Backup: {config_name}

+
Filepath: {filepath}
+
Created at: {created_date}
+

WebUI State

+ + + + + + + + + + + + + + + + + +
URLBranchCommitDate
+ {remote} + + {webui_branch} + + {commit_link} + + {date_link} +
+

Extension State

+ + + + + + + + + + + +""" + + ext_map = {ext.name: ext for ext in extensions.extensions} + + for ext_name, ext_conf in config_state["extensions"].items(): + ext_remote = ext_conf["remote"] or "" + ext_branch = ext_conf["branch"] or "" + ext_enabled = ext_conf["enabled"] + ext_commit_hash = ext_conf["commit_hash"] or "" + ext_commit_date = ext_conf["commit_date"] + if ext_commit_date: + ext_commit_date = time.asctime(time.gmtime(ext_commit_date)) + else: + ext_commit_date = "" + + remote = f"""{html.escape(ext_remote or '')}""" + commit_link = make_commit_link(ext_commit_hash, ext_remote) + date_link = make_commit_link(ext_commit_hash, ext_remote, ext_commit_date) + + style_enabled = "" + style_remote = "" + style_branch = "" + style_commit = "" + if ext_name in ext_map: + current_ext = ext_map[ext_name] + current_ext.read_info_from_repo() + if current_ext.enabled != ext_enabled: + style_enabled = STYLE_PRIMARY + if current_ext.remote != ext_remote: + style_remote = STYLE_PRIMARY + if current_ext.branch != ext_branch: + style_branch = STYLE_PRIMARY + if current_ext.commit_hash != ext_commit_hash: + style_commit = STYLE_PRIMARY + + code += f""" + + + + + + +""" + + code += """ +
ExtensionURLBranchCommitDate
{html.escape(ext_name)}{remote}{ext_branch}{commit_link}{date_link}
""" + + except Exception as e: + print(f"[ERROR]: Config states {filepath}, {e}") + code = f""" +

Config Backup: {config_name}

+
Filepath: {filepath}
+
Created at: {created_date}
+

This file is corrupted

""" return code -- cgit v1.2.1 From afea99a72b48fd88b101b1b2cea45fd527c3bc6f Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 30 Aug 2023 08:05:18 +0300 Subject: get progressbar to display correctly in extensions tab --- modules/ui_extensions.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index e0138267..67a243c3 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -557,8 +557,12 @@ def create_ui(): msg = '"--disable-extra-extensions" was used, remove it to load all extensions again' html = f'{msg}' - info = gr.HTML(html) - extensions_table = gr.HTML('Loading...') + with gr.Row(): + info = gr.HTML(html) + + with gr.Row(elem_classes="progress-container"): + extensions_table = gr.HTML('Loading...', elem_id="extensions_installed_html") + ui.load(fn=extension_table, inputs=[], outputs=[extensions_table]) apply.click( -- cgit v1.2.1 From 06bc1f4f67f9c01808cafd034b8f9761740982f4 Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 30 Aug 2023 08:23:11 +0300 Subject: Merge pull request #12851 from bluelovers/pr/extension-time-001 chore: change extension time format --- modules/ui_extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 67a243c3..83557d7a 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -177,7 +177,7 @@ def extension_table(): {remote} {ext.branch} {version_link} - {time.asctime(time.gmtime(ext.commit_date))} + {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(ext.commit_date))} {ext_status} """ -- cgit v1.2.1 From 87a083d1b23ed0a777432907752980249421783f Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 30 Aug 2023 09:45:12 +0300 Subject: Merge pull request #12864 from AUTOMATIC1111/extension-time-format-time-zone patch Extension time format in systme time zone --- modules/ui_extensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index 83557d7a..fa831f57 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -177,7 +177,7 @@ def extension_table(): {remote} {ext.branch} {version_link} - {time.strftime('%Y-%m-%d %H:%M:%S', time.gmtime(ext.commit_date))} + {datetime.fromtimestamp(ext.commit_date) if ext.commit_date else ""} {ext_status} """ -- cgit v1.2.1 From 1ac11b3dae49568fc0b3ae6afe6627196a0a001e Mon Sep 17 00:00:00 2001 From: AUTOMATIC1111 <16777216c@gmail.com> Date: Wed, 30 Aug 2023 11:00:29 +0300 Subject: Merge pull request #12865 from AUTOMATIC1111/another-convert-to-system-time-zone extension update time, convert to system time zone --- modules/ui_extensions.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'modules/ui_extensions.py') diff --git a/modules/ui_extensions.py b/modules/ui_extensions.py index fa831f57..2e8c1d6d 100644 --- a/modules/ui_extensions.py +++ b/modules/ui_extensions.py @@ -2,7 +2,7 @@ import json import os import threading import time -from datetime import datetime +from datetime import datetime, timezone import git @@ -442,7 +442,7 @@ sort_ordering = [ def get_date(info: dict, key): try: - return datetime.strptime(info.get(key), "%Y-%m-%dT%H:%M:%SZ").strftime("%Y-%m-%d") + return datetime.strptime(info.get(key), "%Y-%m-%dT%H:%M:%SZ").replace(tzinfo=timezone.utc).astimezone().strftime("%Y-%m-%d") except (ValueError, TypeError): return '' -- cgit v1.2.1