Skip to content

Commit 7994173

Browse files
committed
feat(runtime/virtual): change watch_display() args (#36, #52)
1 parent 4bdcc76 commit 7994173

File tree

3 files changed

+19
-8
lines changed

3 files changed

+19
-8
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ For example, to generate 3 images at once, and then let the user decide which on
263263
```python
264264
import ipywidgets as widgets
265265

266-
queue.watch_display(False, False)
266+
queue.watch_display(False)
267267

268268
latents = []
269269
image_batches = []

examples/runtime.ipynb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
"source": [
261261
"import ipywidgets as widgets\n",
262262
"\n",
263-
"queue.watch_display(False, False)\n",
263+
"queue.watch_display(False)\n",
264264
"\n",
265265
"latents = []\n",
266266
"image_batches = []\n",

src/comfy_script/runtime/__init__.py

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -621,14 +621,25 @@ def remove_queue_remaining_callback(self, callback: Callable[[int], None]):
621621
if callback in self._queue_remaining_callbacks:
622622
self._queue_remaining_callbacks.remove(callback)
623623

624-
def watch_display(self, display_node: bool = True, display_task: bool = True, display_node_preview: bool = True):
624+
def watch_display(self, all: bool | None = None, *, preview: bool | None = None, output: bool | None = None, task: bool | None = None):
625625
'''
626-
- `display_node`: When an output node is finished, display its result.
627-
- `display_task`: When a task is finished (all output nodes are finished), display all the results.
626+
- `preview`: When a preview of the node output is received, display it.
627+
- `output`: When an output node is finished, display its result.
628+
- `task`: When a task is finished (all output nodes are finished), display all the results.
628629
'''
629-
self._watch_display_node = display_node
630-
self._watch_display_task = display_task
631-
self._watch_display_node_preview = display_node_preview
630+
if all is not None:
631+
if preview is None:
632+
preview = all
633+
if output is None:
634+
output = all
635+
if task is None:
636+
task = all
637+
if preview is not None:
638+
self._watch_display_node_preview = preview
639+
if output is not None:
640+
self._watch_display_node = output
641+
if task is not None:
642+
self._watch_display_task = task
632643

633644
async def _put(self, workflow: data.NodeOutput | Iterable[data.NodeOutput] | Workflow, source = None) -> Task | None:
634645
global _client_id

0 commit comments

Comments
 (0)