Backwards compat fix for pre 1.3.0 webui versions

Closes #199
This commit is contained in:
DominikDoom
2023-07-07 10:30:28 +02:00
parent 77c0970500
commit 8523d7e9b5

View File

@@ -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),