From 8523d7e9b568fc4783671a5c1ff130312bf3dea1 Mon Sep 17 00:00:00 2001 From: DominikDoom Date: Fri, 7 Jul 2023 10:30:28 +0200 Subject: [PATCH] Backwards compat fix for pre 1.3.0 webui versions Closes #199 --- scripts/tag_autocomplete_helper.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/scripts/tag_autocomplete_helper.py b/scripts/tag_autocomplete_helper.py index e108b32..01e570d 100644 --- a/scripts/tag_autocomplete_helper.py +++ b/scripts/tag_autocomplete_helper.py @@ -293,6 +293,18 @@ write_temp_files() def on_ui_settings(): TAC_SECTION = ("tac", "Tag Autocomplete") + # Backwards compatibility for pre 1.3.0 webui versions + if not (hasattr(shared.OptionInfo, "info") and callable(getattr(shared.OptionInfo, "info"))): + def info(self, info): + self.label += f" ({info})" + return self + shared.OptionInfo.info = info + if not (hasattr(shared.OptionInfo, "needs_restart") and callable(getattr(shared.OptionInfo, "needs_restart"))): + def needs_restart(self): + self.label += " (Requires restart)" + return self + shared.OptionInfo.needs_restart = needs_restart + tac_options = { # Main tag file "tac_tagFile": shared.OptionInfo("danbooru.csv", "Tag filename", gr.Dropdown, lambda: {"choices": csv_files_withnone}, refresh=update_tag_files),