diff --git a/README.MD b/README.MD index 618cd28..8e0bc3d 100644 --- a/README.MD +++ b/README.MD @@ -4,6 +4,8 @@ Please see the respective READMEs and wikis for each of the above projects for a This extension also adds buttons to send output from webUI txt2img and img2img tools directly to openOutpaint which will also include the prompts used for convenience. +**_2023-01-23: new `--lock-oo-submodule` commandline argument if you want to roll back to a previous version of openOutpaint and keep it there - be sure to install/run openOutpaint extension at least once before enabling this flag_** + **Note: Requires `--api` flag enabled in your webui-user launch script!** **_FURTHER NOTE: the commandline flag `--gradio-debug` disables custom API routes and completely breaks openOutpaint. please remove it from your COMMANDLINE_ARGS before running openOutpaint._** diff --git a/install.py b/install.py index 4885d1e..3b5bb2c 100644 --- a/install.py +++ b/install.py @@ -10,11 +10,12 @@ installDir = os.path.join(scripts.basedir(), usefulDirs[0], usefulDirs[1]) # Attempt to use launch module from webui command = f'"{git}" -C "' + installDir +\ '" submodule update --init --recursive --remote' -try: - from launch import run - stdout = run(command) - if len(stdout) > 0: - print(run(command)) -except ImportError: - print("[openoutpaint-extension] We failed to import the 'launch' module. Using 'os'") - os.system(command) +if not os.path.isfile(os.path.join(installDir, "app", "index.html")): + try: + from launch import run + stdout = run(command) + if len(stdout) > 0: + print(run(command)) + except ImportError: + print("[openoutpaint-extension] We failed to import the 'launch' module. Using 'os'") + os.system(command) diff --git a/preload.py b/preload.py new file mode 100644 index 0000000..29b726a --- /dev/null +++ b/preload.py @@ -0,0 +1,5 @@ +import argparse + +def preload(parser: argparse.ArgumentParser): + parser.add_argument("--lock-oo-submodule", action='store_true', + help="(openOutpaint-webUI-extension) Prevent checking for main openOutpaint submodule updates.") \ No newline at end of file diff --git a/scripts/main.py b/scripts/main.py index dc1e1a7..1e577e3 100644 --- a/scripts/main.py +++ b/scripts/main.py @@ -1,4 +1,4 @@ -from modules import script_callbacks, scripts +from modules import script_callbacks, scripts, shared import gradio as gr from fastapi import FastAPI import os @@ -40,6 +40,12 @@ def started(demo, app: FastAPI): def add_tab(): + if (not shared.cmd_opts.lock_oo_submodule): + git = os.environ.get('GIT', "git") + run(f'"{git}" -C "' + scripts.basedir() + + '" submodule update --init --recursive --remote') + else: + print("locked openOutpaint submodule, not updating") with gr.Blocks(analytics_enabled=False) as ui: #refresh = gr.Button(value="refresh", variant="primary") canvas = gr.HTML(