diff --git a/javascript/compute-height.js b/javascript/compute-height.js index 0a21ff8..9475746 100644 --- a/javascript/compute-height.js +++ b/javascript/compute-height.js @@ -8,9 +8,9 @@ const WEBUI_CLIENT_KEY = uuidv4(); function changeDisplayedWorkflowType(targetWorkflowType) { const targetIFrameElement = getWorkflowTypeIFrame(targetWorkflowType); - const currentIFrameElement = targetIFrameElement.parentElement.querySelector(".comfyui-embedded-widget-display"); - currentIFrameElement.classList.remove("comfyui-embedded-widget-display"); - targetIFrameElement.classList.add("comfyui-embedded-widget-display"); + const currentIFrameElement = targetIFrameElement.parentElement.querySelector(".comfyui-workflow-type-visible"); + currentIFrameElement.classList.remove("comfyui-workflow-type-visible"); + targetIFrameElement.classList.add("comfyui-workflow-type-visible"); } document.addEventListener("DOMContentLoaded", () => { @@ -33,7 +33,7 @@ function onComfyuiTabLoaded(callback) { } function clearEnabledWorkflowTypes() { - for (let clearButton of getClearEnabledWorkflowTypesButtons()) { + for (const clearButton of getClearEnabledWorkflowTypesButtons()) { clearButton.click(); } } @@ -91,8 +91,8 @@ function updateFooterStyle() { function getClearEnabledWorkflowTypesButtons() { return [ - document.getElementById("script_txt2txt_comfyui_clear_enabled_workflow_types") ?? null, - document.getElementById("script_img2img_comfyui_clear_enabled_workflow_types") ?? null, + document.getElementById("script_txt2txt_comfyui_clear_enabled_display_names") ?? null, + document.getElementById("script_img2img_comfyui_clear_enabled_display_names") ?? null, ]; } diff --git a/lib_comfyui/webui/accordion.py b/lib_comfyui/webui/accordion.py index 732873f..307b9b6 100644 --- a/lib_comfyui/webui/accordion.py +++ b/lib_comfyui/webui/accordion.py @@ -27,17 +27,17 @@ def __init__(self, get_elem_id, tab): elem_id=get_elem_id('accordion'), ) - self.iframes = gr.HTML(value=self.get_iframes_html(self.workflow_type_ids[self.first_workflow_type.display_name])) - self.enable = gr.Checkbox( + self.iframes = gr.HTML(value=self.get_iframes_html()) + self.enabled_checkbox = gr.Checkbox( label='Enable', - elem_id=get_elem_id('enabled'), + elem_id=get_elem_id('enable'), value=False, ) - self.current_workflow_display_name = gr.Dropdown( + self.current_display_name = gr.Dropdown( label='Edit workflow type', choices=[workflow_type.display_name for workflow_type in self.workflow_types], value=self.first_workflow_type.display_name, - elem_id=get_elem_id('displayed_workflow_type'), + elem_id=get_elem_id('current_display_name'), ) self.queue_front = gr.Checkbox( label='Queue front', @@ -50,31 +50,30 @@ def __init__(self, get_elem_id, tab): ) self.enabled_display_names = gradio_utils.ExtensionDynamicProperty( - key=f'enabled_display_names_{self.tab}', value=[], ) - self.enabled_workflow_type_ids = gradio_utils.ExtensionDynamicProperty( - key=f'enabled_workflow_type_ids_{self.tab}', + self.enabled_type_ids = gradio_utils.ExtensionDynamicProperty( value={ workflow_type_id: False for workflow_type_id in self.workflow_type_ids.values() }, ) - self.clear_enabled_workflow_types_button = gr.Button( - elem_id=get_elem_id('clear_enabled_workflow_types'), + self.clear_enabled_display_names_button = gr.Button( + elem_id=get_elem_id('clear_enabled_display_names'), visible=False, ) self._rendered = False - def get_iframes_html(self, first_workflow_type_id: str) -> str: + def get_iframes_html(self) -> str: comfyui_client_url = settings.get_comfyui_client_url() + first_workflow_type_id = self.workflow_type_ids[self.first_workflow_type.display_name] iframes = [] for workflow_type_id in external_code.get_workflow_type_ids(self.tab): - html_classes = ['comfyui-embedded-widget'] + html_classes = [] if workflow_type_id == first_workflow_type_id: - html_classes.append('comfyui-embedded-widget-display') + html_classes.append('comfyui-workflow-type-visible') iframes.append(f"""