adds cmdline arg to prevent auto-update, only installs if index.html doesn't exist, checks for update in main.py again instead of install

pull/37/head
zero01101 2023-01-23 19:30:48 -06:00
parent 6cc0ae1bb0
commit 7b4f84816e
4 changed files with 23 additions and 9 deletions

View File

@ -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. 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!** **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._** **_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._**

View File

@ -10,11 +10,12 @@ installDir = os.path.join(scripts.basedir(), usefulDirs[0], usefulDirs[1])
# Attempt to use launch module from webui # Attempt to use launch module from webui
command = f'"{git}" -C "' + installDir +\ command = f'"{git}" -C "' + installDir +\
'" submodule update --init --recursive --remote' '" submodule update --init --recursive --remote'
try: if not os.path.isfile(os.path.join(installDir, "app", "index.html")):
from launch import run try:
stdout = run(command) from launch import run
if len(stdout) > 0: stdout = run(command)
print(run(command)) if len(stdout) > 0:
except ImportError: print(run(command))
print("[openoutpaint-extension] We failed to import the 'launch' module. Using 'os'") except ImportError:
os.system(command) print("[openoutpaint-extension] We failed to import the 'launch' module. Using 'os'")
os.system(command)

5
preload.py Normal file
View File

@ -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.")

View File

@ -1,4 +1,4 @@
from modules import script_callbacks, scripts from modules import script_callbacks, scripts, shared
import gradio as gr import gradio as gr
from fastapi import FastAPI from fastapi import FastAPI
import os import os
@ -40,6 +40,12 @@ def started(demo, app: FastAPI):
def add_tab(): 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: with gr.Blocks(analytics_enabled=False) as ui:
#refresh = gr.Button(value="refresh", variant="primary") #refresh = gr.Button(value="refresh", variant="primary")
canvas = gr.HTML( canvas = gr.HTML(