From 1f020691cbc83a9203f91a193d870b4d2ee8485c Mon Sep 17 00:00:00 2001 From: wywywywy Date: Mon, 4 Sep 2023 23:58:03 +0100 Subject: [PATCH] fix: broken radio-button in v1.6 (#62) * fix: broken radio-button in v1.6 * add comment --------- Co-authored-by: Zyin055 <5003647+Zyin055@users.noreply.github.com> --- scripts/config_presets.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/config_presets.py b/scripts/config_presets.py index 200a571..8995dc6 100644 --- a/scripts/config_presets.py +++ b/scripts/config_presets.py @@ -914,6 +914,15 @@ class Script(scripts.Script): if component_name in index_type_components and type(component_value) == int: current_components[component_name] = component_map[component_name].choices[component_value] + # A1111 1.6.0 changed radio buttons values into tuples. + # For example, for the "img2img_mask_mode" component it changed from: + # ['Inpaint masked', 'Inpaint not masked'] + # to + # [('Inpaint masked', 'Inpaint masked'), ('Inpaint not masked', 'Inpaint not masked')] + # Using a type == tuple check here will ensure compatibility with the older versions. + if type(current_components[component_name]) == tuple: + current_components[component_name] = current_components[component_name][0] + #print("Components after :", current_components) return list(current_components.values())