diff --git a/__init__.py b/__init__.py index 8c57f50..c1a62bc 100644 --- a/__init__.py +++ b/__init__.py @@ -193,6 +193,7 @@ class Lexicon(metaclass=LexiconMeta): EDGE = 'EDGE', "Clip or Wrap the Canvas Edge" EDGE_X = 'EDGE_X', "Clip or Wrap the Canvas Edge" EDGE_Y = 'EDGE_Y', "Clip or Wrap the Canvas Edge" + ENABLE = 'ENABLE', "Enable or Disable" END = 'END', "End of the range" FALSE = '🇫', "False" FILEN = '💾', "File Name" @@ -779,6 +780,7 @@ try: @PromptServer.instance.routes.post("/jovimetrix/message") async def jovimetrix_message_post(request) -> Any: json_data = await request.json() + print(json_data) if (did := json_data.get("id")) is not None: ComfyAPIMessage.MESSAGE[str(did)] = json_data return web.json_response(json_data) diff --git a/core/calc.py b/core/calc.py index 9e3221a..a003640 100644 --- a/core/calc.py +++ b/core/calc.py @@ -600,7 +600,7 @@ class DelayNode(JOVBaseNode): RETURN_NAMES = (Lexicon.PASS_OUT,) SORT = 240 DESCRIPTION = """ -Introduce pauses in the workflow that accept an optional input to pass through and a timer parameter to specify the duration of the delay. If no timer is provided, it defaults to a maximum delay. During the delay, it periodically checks for messages to interrupt the delay. Once the delay is completed, it returns the input passed to it. +Introduce pauses in the workflow that accept an optional input to pass through and a timer parameter to specify the duration of the delay. If no timer is provided, it defaults to a maximum delay. During the delay, it periodically checks for messages to interrupt the delay. Once the delay is completed, it returns the input passed to it. You can disable the screensaver with the `ENABLE` option """ @classmethod @@ -610,9 +610,10 @@ Introduce pauses in the workflow that accept an optional input to pass through a "optional": { Lexicon.PASS_IN: (JOV_TYPE_ANY, {"default": None}), Lexicon.TIMER: ("INT", {"default" : 0, "mij": -1}), + Lexicon.ENABLE: ("BOOLEAN", {"default": True, "tooltips":"Enable or disable the screensaver"}) }, "outputs": { - 0: (Lexicon.PASS_OUT, {"tooltips":f"Pass through data when the delay ends"}) + 0: (Lexicon.PASS_OUT, {"tooltips":"Pass through data when the delay ends"}) } }) return Lexicon._parse(d, cls) @@ -623,14 +624,17 @@ Introduce pauses in the workflow that accept an optional input to pass through a delay = JOV_DELAY_MAX if delay > JOV_DELAY_MIN: comfy_message(ident, "jovi-delay-user", {"id": ident, "timeout": delay}) + # enable = parse_param(kw, Lexicon.ENABLE, EnumConvertType.BOOLEAN, True) + step = 1 pbar = ProgressBar(delay) while step <= delay: try: data = ComfyAPIMessage.poll(ident, timeout=1) - if data.get('cmd', False): - interrupt_processing(True) - logger.warning(f"delay [cancelled] ({step}): {ident}") + if data.get('id', None) == ident: + if data.get('cmd', False) == False: + interrupt_processing(True) + logger.warning(f"delay [cancelled] ({step}): {ident}") break except TimedOutException as _: if step % 10 == 0: diff --git a/web/nodes/delay.js b/web/nodes/delay.js index f6716f2..9097e41 100644 --- a/web/nodes/delay.js +++ b/web/nodes/delay.js @@ -25,6 +25,7 @@ app.registerExtension({ nodeType.prototype.onNodeCreated = async function () { const me = onNodeCreated?.apply(this); const widget_time = this.widgets.find(w => w.name == '⏱'); + const widget_enable = this.widgets.find(w => w.name == 'ENABLE'); this.total_timeout = 0; let showing = false; let delay_modal; @@ -34,9 +35,11 @@ app.registerExtension({ if (showing || event.detail.id != self.id) { return; } - if (widget_time.value > 5) { + + if (widget_time.value > 4 && widget_enable.value == true) { bubbles(); } + showing = true; delay_modal = domShowModal(`