{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "find: examples: No such file or directory\n", "find: examples: No such file or directory\n", "find: examples: No such file or directory\n" ] } ], "source": [ "!command rm -f $(find examples -name 'data.dill.gz')\n", "!command rm -f $(find examples -name '.task.json')\n", "!command rm -f $(find examples -name '.sha.json')" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "nbsphinx": "hidden" }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "/Users/void/Documents/repype\n" ] }, { "name": "stderr", "output_type": "stream", "text": [ "/Users/void/Documents/repype/.venv/lib/python3.11/site-packages/IPython/core/magics/osm.py:417: UserWarning: This is now an optional IPython functionality, setting dhist requires you to install the `pickleshare` library.\n", " self.shell.db['dhist'] = compress_dhist(dhist)[-100:]\n" ] }, { "data": { "text/plain": [ "PosixPath('/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation')" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%cd ..\n", "\n", "import pathlib\n", "import shutil\n", "import tempfile\n", "\n", "tempdir = tempfile.TemporaryDirectory()\n", "tempdir_path = pathlib.Path(tempdir.name)\n", "root_task_path = tempdir_path / 'examples' / 'segmentation'\n", "shutil.copytree('examples/segmentation', root_task_path)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Text-based user interface\n", "\n", "Repype comes with a built-in *text-based user interface* TUI that is based on [Textual](https://textual.textualize.io):\n", "\n", "```bash\n", "python -m repype.textual examples/segmentation\n", "```\n", "\n", "The argument `examples/segmentation` is the path of the *root task directory*.\n", "\n", "## Built-in capabilities\n", "\n", "For demonstration purposes, we load the TUI programmatically:" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Manage tasks \n", "▼ Loaded tasks \n", "┗━━ ▼ [ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending) \n", " ┗━━ ▼ [ ] sigma=2 (pending) \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "Tasks: 0 queued / 2 pending \n", " a Add sub-task e Edit task d Delete task r Run tasks R Reset task x Toggle task q Exit\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mManage tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[1;38;2;33;21;5;48;2;254;166;43mLoaded tasks\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[3;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m┗━━ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m[ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m(pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[4;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m ┗━━ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m[ ] sigma=2 \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m(pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[5;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[6;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[7;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[8;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[9;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[10;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[11;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[23;1H\u001b[1;38;2;225;225;225;48;2;30;30;30mTasks:\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m 0 queued / 2 pending\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m a \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mAdd sub-task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m e \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mEdit task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m d \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mDelete task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m r \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mRun tasks \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m R \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mReset task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m x \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mToggle task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m q \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mExit \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "from repype.textual.app import Repype\n", "from repype.textual.demo import run\n", "\n", "demo = await run(\n", " Repype(path = root_task_path),\n", " size = (113, 24),\n", ")\n", "\n", "demo.screenshot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It can be seen from the screen above, that 2 tasks are found and loaded.\n", "\n", "The TUI can be navigated by using the keyboard and the hotkeys displayed at the bottom line of the screen.\n", "It is also possible to use the mouse, if this is supported by the terminal emulator.\n", "\n", "One or more tasks can be queued by pressing the the `x` key:" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Manage tasks \n", "▼ Loaded tasks \n", "└── ▼ [x] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending) \n", " ┗━━ ▼ [ ] sigma=2 (pending) \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "Tasks: 1 queued / 2 pending \n", " a Add sub-task e Edit task d Delete task r Run tasks R Reset task x Toggle task q Exit\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mManage tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47mLoaded tasks\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[3;1H\u001b[38;2;0;129;57;48;2;36;41;47m└── \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[1;38;2;33;21;5;48;2;254;166;43m[x] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[4;1H\u001b[38;2;0;129;57;48;2;36;41;47m \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m┗━━ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m[ ] sigma=2 \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m(pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[5;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[6;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[7;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[8;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[9;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[10;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[11;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[23;1H\u001b[1;38;2;225;225;225;48;2;30;30;30mTasks:\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m 1 queued / 2 pending\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m a \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mAdd sub-task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m e \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mEdit task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m d \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mDelete task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m r \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mRun tasks \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m R \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mReset task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m x \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mToggle task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m q \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mExit \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.press('down', 'x')\n", "demo.screenshot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The queued tasks can then be run by pressing the `r` key.\n", "If no task is queued and the `r` key is pressed, the currently selected task will be run.\n", "Only pending tasks can be run (i.e. those which are runnable and haven't been completed yet).\n", "\n", "Now lets run the queued task:" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "RunScreen.handle_new_status status={'info': 'enter', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation', 'step': 0, 'step_count': 1} intermediate=False\n", "RunScreen.handle_new_status status={'info': 'start', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation', 'pickup': None, 'first_stage': None} intermediate=False\n", "RunScreen.handle_new_status status={'info': 'start-stage', 'stage': 'unzip'} intermediate=True\n", "RunScreen.handle_new_status status={'info': 'start-stage', 'stage': 'segmentation'} intermediate=True\n", "RunScreen.handle_new_status status={'info': 'start-stage', 'stage': 'output'} intermediate=True\n", "RunScreen.handle_new_status status={'info': 'completed', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation'} intermediate=False\n", "RunScreen.handle_new_status status={'info': 'enter', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation', 'step': 0, 'step_count': 1} intermediate=False\n", "RunScreen.handle_new_status status={'info': 'start', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation', 'pickup': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation', 'first_stage': 'segmentation'} intermediate=False\n", "RunScreen.handle_new_status status={'info': 'start-stage', 'stage': 'output'} intermediate=True\n", "RunScreen.handle_new_status status={'info': 'completed', 'task': '/private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation'} intermediate=False\n" ] }, { "data": { "text/html": [ "
repype — Run tasks \n", "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n", " ▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation \n", " \n", " \n", " Starting from scratch \n", " \n", " (1/1) Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif \n", " Running stage: download \n", " ━━━━━━━━━━━━━━━━━━━━━━━╸━━━━━━━━ --% --:--:-- \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " ^c Cancel ESC Close\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mRun tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;18;18;18;48;2;38;38;38m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[0m\n", "\u001b[3;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;221;237;249;48;2;1;120;212m▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation\u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[4;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[5;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[6;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38mStarting from scratch \u001b[0m\n", "\u001b[7;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[8;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[1;38;2;0;255;255;48;2;38;38;38m(1/1)\u001b[0m\u001b[38;2;0;255;255;48;2;38;38;38m Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif\u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[9;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38mRunning stage: download \u001b[0m\n", "\u001b[10;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;57;57;57;48;2;38;38;38m━━━━━━━━━━━━━━━━━━━━━━━╸\u001b[0m\u001b[38;2;185;60;91;48;2;38;38;38m━━━━━━━━\u001b[0m\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m--%\u001b[0m\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m--:--:-- \u001b[0m\n", "\u001b[11;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[23;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m ^c \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mCancel \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m ESC \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mClose \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.press('r')\n", "await demo.wait(1)\n", "demo.screenshot()" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Run tasks \n", "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n", " ▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (done) \n", " \n", " \n", " Starting from scratch \n", " \n", " (1/1) Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif \n", " \n", " Results have been stored \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " ^c Cancel ESC Close\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mRun tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;18;18;18;48;2;38;38;38m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[0m\n", "\u001b[3;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;221;237;249;48;2;1;120;212m▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (done)\u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[4;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[5;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[6;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38mStarting from scratch \u001b[0m\n", "\u001b[7;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[8;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[1;38;2;0;255;255;48;2;38;38;38m(1/1)\u001b[0m\u001b[38;2;0;255;255;48;2;38;38;38m Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif\u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[9;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[10;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;221;238;221;48;2;0;128;0mResults have been stored\u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[11;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[23;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m ^c \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mCancel \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m ESC \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mClose \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.wait_for_condition(lambda: demo.app.batch.task_process is None)\n", "demo.screenshot()" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Manage tasks \n", "▼ Loaded tasks \n", "└── ▼ [ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation \n", " ┗━━ ▼ [ ] sigma=2 (pending) \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "Tasks: 0 queued / 1 pending \n", " a Add sub-task e Edit task d Delete task r Run tasks R Reset task x Toggle task q Exit\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mManage tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47mLoaded tasks\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[3;1H\u001b[38;2;0;129;57;48;2;36;41;47m└── \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[1;38;2;33;21;5;48;2;254;166;43m[ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[4;1H\u001b[38;2;0;129;57;48;2;36;41;47m \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m┗━━ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m[ ] sigma=2 \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m(pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[5;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[6;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[7;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[8;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[9;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[10;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[11;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[23;1H\u001b[1;38;2;225;225;225;48;2;30;30;30mTasks:\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m 0 queued / 1 pending\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m a \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mAdd sub-task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m e \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mEdit task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m d \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mDelete task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m r \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mRun tasks \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m R \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mReset task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m x \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mToggle task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m q \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mExit \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.press('escape')\n", "demo.screenshot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Custom status updates\n", "\n", "First, lets update the `Segmentation` stage so it produces a custom status update:" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [], "source": [ "import repype.status\n", "import tests.test_repype\n", "\n", "class Segmentation(tests.test_repype.Segmentation):\n", "\n", " def process(self, image, pipeline, config, status = None):\n", " repype.status.update(status, info = 'custom', text = 'Text', number = 42)\n", " return super().process(image, pipeline, config, status)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "To employ the new implementation programmatically, we override the `create_pipeline` method of the `Task` class:" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [], "source": [ "import repype.task\n", "\n", "class Task(repype.task.Task):\n", "\n", " def create_pipeline(self, *args, **kwargs):\n", " pipeline = super().create_pipeline(*args, **kwargs)\n", " pipeline.stages[pipeline.find('segmentation')] = Segmentation()\n", " return pipeline" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We then extend the `RunScreen` implementation to handle the custom status update:" ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "import repype.textual.run\n", "\n", "class RunScreen(repype.textual.run.RunScreen):\n", "\n", " def custom_format(self, positions, status, intermediate):\n", " if isinstance(status, dict) and status.get('info') == 'custom':\n", " return f'*** {status[\"text\"]} ({status[\"number\"]})'\n", " \n", "demo.app.screen.run_screen_cls = RunScreen" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Then we employ the new `Task` implementation in the TUI and observe that the previously finished task is pending again, due to the changed implementation:" ] }, { "cell_type": "code", "execution_count": 11, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Manage tasks \n", "▼ Loaded tasks \n", "└── ▼ [ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending) \n", " ┗━━ ▼ [ ] sigma=2 (pending) \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "Tasks: 0 queued / 2 pending \n", " a Add sub-task e Edit task d Delete task r Run tasks R Reset task x Toggle task q Exit\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mManage tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47mLoaded tasks\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[3;1H\u001b[38;2;0;129;57;48;2;36;41;47m└── \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[1;38;2;33;21;5;48;2;254;166;43m[ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[4;1H\u001b[38;2;0;129;57;48;2;36;41;47m \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m┗━━ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m▼ \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m[ ] sigma=2 \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m(pending)\u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[5;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[6;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[7;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[8;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[9;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[10;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[11;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m\n", "\u001b[23;1H\u001b[1;38;2;225;225;225;48;2;30;30;30mTasks:\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m 0 queued / 2 pending\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m a \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mAdd sub-task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m e \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mEdit task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m d \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mDelete task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m r \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mRun tasks \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m R \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mReset task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m x \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mToggle task \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m q \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mExit \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "import repype.batch\n", "demo.app.batch = repype.batch.Batch(Task)\n", "demo.app.screen.update_task_tree()\n", "demo.screenshot()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We run the updated task py pressing `r`:" ] }, { "cell_type": "code", "execution_count": 12, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Manage tasks \n", "▼ Loaded tasks \n", "└── ▼ [ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending) \n", " ┗━━ ▼ [ ] sigma=2 (pending) \n", " \n", " █▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█ \n", " █ █ \n", " █No tasks queued. Run the selected task? █ \n", " █/var/folders/bq/yy783k4j24zbhqhctlx__thr0000█ \n", " █gn/T/tmp586dj3lb/examples/segmentation █ \n", " █ █ \n", " █ █ \n", " █ ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔ █ \n", " █ Yes No █ \n", " █ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ ▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁ █ \n", " █ █ \n", " █ █ \n", " █▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█ \n", " \n", " \n", " \n", " \n", "Tasks: 0 queued / 2 pending \n", " a Add sub-task e Edit task d Delete task r Run tasks R Reset task x Toggle task q Exit\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;101;101;101;48;2;26;26;26m \u001b[0m\u001b[38;2;224;224;224;48;2;26;26;26m \u001b[0m\u001b[38;2;101;101;101;48;2;26;26;26mrepype — \u001b[0m\u001b[2;38;2;101;101;101;48;2;26;26;26mManage tasks\u001b[0m\u001b[38;2;224;224;224;48;2;26;26;26m \u001b[0m\u001b[38;2;224;224;224;48;2;26;26;26m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;101;101;101;48;2;25;27;29m▼ Loaded tasks \u001b[0m\n", "\u001b[3;1H\u001b[38;2;10;62;33;48;2;25;27;29m└── \u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m▼ \u001b[0m\u001b[1;38;2;24;19;12;48;2;112;77;28m[ ] /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (pending)\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[4;1H\u001b[38;2;10;62;33;48;2;25;27;29m \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m┗━━ \u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m▼ [ ] sigma=2 \u001b[0m\u001b[1;38;2;101;101;101;48;2;25;27;29m(pending)\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[5;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[6;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[7;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[8;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30mNo tasks queued. Run the selected task?\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[9;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[1;38;2;225;225;225;48;2;30;30;30m/var/folders/bq/yy783k4j24zbhqhctlx__thr0000\u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[10;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[1;38;2;225;225;225;48;2;30;30;30mgn/T/tmp586dj3lb/examples/segmentation\u001b[0m\u001b[48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[11;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[12;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;80;123;179;48;2;0;69;120m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;69;74;80;48;2;36;41;47m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[48;2;0;69;120m \u001b[0m\u001b[1;7;38;2;221;230;237;48;2;0;69;120m Yes \u001b[0m\u001b[48;2;0;69;120m \u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[48;2;36;41;47m \u001b[0m\u001b[1;38;2;226;227;227;48;2;36;41;47m No \u001b[0m\u001b[48;2;36;41;47m \u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;0;21;65;48;2;0;69;120m▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;0;0;0;48;2;36;41;47m▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁▁\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\u001b[38;2;18;18;18;48;2;30;30;30m█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█\u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m\n", "\u001b[23;1H\u001b[1;38;2;100;100;100;48;2;22;22;22mTasks:\u001b[0m\u001b[38;2;100;100;100;48;2;22;22;22m 0 queued / 2 pending\u001b[0m\u001b[38;2;224;224;224;48;2;22;22;22m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;112;77;28;48;2;25;27;29m a \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mAdd sub-task \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m e \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mEdit task \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m d \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mDelete task \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m r \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mRun tasks \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m R \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mReset task \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m x \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mToggle task \u001b[0m\u001b[1;38;2;112;77;28;48;2;25;27;29m q \u001b[0m\u001b[38;2;77;78;79;48;2;25;27;29mExit \u001b[0m\u001b[38;2;101;101;101;48;2;25;27;29m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.press('r')\n", "demo.screenshot()" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
repype — Run tasks \n", "▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\n", " ▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (done) \n", " \n", " \n", " Picking up from: /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (\n", " \n", " (1/1) Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif \n", " *** Text (42) \n", " \n", " Results have been stored \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " ^c Cancel ESC Close\n" ], "text/plain": [ "\u001b[1;1H\u001b[38;2;227;227;227;48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[38;2;227;227;227;48;2;40;40;40mrepype — \u001b[0m\u001b[2;38;2;227;227;227;48;2;40;40;40mRun tasks\u001b[0m\u001b[48;2;40;40;40m \u001b[0m\u001b[48;2;40;40;40m \u001b[0m\n", "\u001b[2;1H\u001b[38;2;18;18;18;48;2;38;38;38m▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔\u001b[0m\n", "\u001b[3;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;221;237;249;48;2;1;120;212m▼ /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (done)\u001b[0m\u001b[48;2;1;120;212m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[4;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[5;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[6;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38mPicking up from: /private/var/folders/bq/yy783k4j24zbhqhctlx__thr0000gn/T/tmp586dj3lb/examples/segmentation (\u001b[0m\n", "\u001b[7;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[8;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[1;38;2;0;255;255;48;2;38;38;38m(1/1)\u001b[0m\u001b[38;2;0;255;255;48;2;38;38;38m Processing: B2--W00026--P00001--Z00000--T00000--dapi.tif\u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[9;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m*** Text (42) \u001b[0m\n", "\u001b[10;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[11;1H\u001b[48;2;38;38;38m \u001b[0m\u001b[38;2;221;238;221;48;2;0;128;0mResults have been stored\u001b[0m\u001b[38;2;226;226;226;48;2;38;38;38m \u001b[0m\n", "\u001b[12;1H\u001b[48;2;38;38;38m \u001b[0m\n", "\u001b[13;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[14;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[15;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[16;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[17;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[18;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[19;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[20;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[21;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[22;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[23;1H\u001b[38;2;225;225;225;48;2;30;30;30m \u001b[0m\n", "\u001b[24;1H\u001b[1;38;2;254;166;43;48;2;36;41;47m ^c \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mCancel \u001b[0m\u001b[1;38;2;254;166;43;48;2;36;41;47m ESC \u001b[0m\u001b[38;2;167;169;171;48;2;36;41;47mClose \u001b[0m\u001b[38;2;226;227;227;48;2;36;41;47m \u001b[0m" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "await demo.press('enter')\n", "await demo.wait_for_condition(lambda: demo.app.batch.task_process is None)\n", "demo.screenshot()" ] } ], "metadata": { "kernelspec": { "display_name": ".venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.11.0" } }, "nbformat": 4, "nbformat_minor": 2 }