add ability to create extensions that add localizations
This commit is contained in:
parent
ea5b90b3b3
commit
a2a1a2f727
@ -208,4 +208,6 @@ function update_token_counter(button_id) {
|
||||
function restart_reload(){
|
||||
document.body.innerHTML='<h1 style="font-family:monospace;margin-top:20%;color:lightgray;text-align:center;">Reloading...</h1>';
|
||||
setTimeout(function(){location.reload()},2000)
|
||||
|
||||
return []
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ import os
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
localizations = {}
|
||||
|
||||
|
||||
@ -16,6 +17,11 @@ def list_localizations(dirname):
|
||||
|
||||
localizations[fn] = os.path.join(dirname, file)
|
||||
|
||||
from modules import scripts
|
||||
for file in scripts.list_scripts("localizations", ".json"):
|
||||
fn, ext = os.path.splitext(file.filename)
|
||||
localizations[fn] = file.path
|
||||
|
||||
|
||||
def localization_js(current_localization_name):
|
||||
fn = localizations.get(current_localization_name, None)
|
||||
|
@ -3,7 +3,6 @@ import sys
|
||||
import traceback
|
||||
from collections import namedtuple
|
||||
|
||||
import modules.ui as ui
|
||||
import gradio as gr
|
||||
|
||||
from modules.processing import StableDiffusionProcessing
|
||||
|
@ -221,8 +221,6 @@ interrogator = modules.interrogate.InterrogateModels("interrogate")
|
||||
|
||||
face_restorers = []
|
||||
|
||||
localization.list_localizations(cmd_opts.localizations_dir)
|
||||
|
||||
|
||||
def realesrgan_models_names():
|
||||
import modules.realesrgan_model
|
||||
|
@ -1563,11 +1563,10 @@ def create_ui(wrap_gradio_gpu_call):
|
||||
shared.state.need_restart = True
|
||||
|
||||
restart_gradio.click(
|
||||
|
||||
fn=request_restart,
|
||||
_js='restart_reload',
|
||||
inputs=[],
|
||||
outputs=[],
|
||||
_js='restart_reload'
|
||||
)
|
||||
|
||||
if column is not None:
|
||||
|
9
webui.py
9
webui.py
@ -10,7 +10,7 @@ from fastapi.middleware.gzip import GZipMiddleware
|
||||
|
||||
from modules.paths import script_path
|
||||
|
||||
from modules import devices, sd_samplers, upscaler, extensions
|
||||
from modules import devices, sd_samplers, upscaler, extensions, localization
|
||||
import modules.codeformer_model as codeformer
|
||||
import modules.extras
|
||||
import modules.face_restoration
|
||||
@ -28,9 +28,7 @@ import modules.txt2img
|
||||
import modules.script_callbacks
|
||||
|
||||
import modules.ui
|
||||
from modules import devices
|
||||
from modules import modelloader
|
||||
from modules.paths import script_path
|
||||
from modules.shared import cmd_opts
|
||||
import modules.hypernetworks.hypernetwork
|
||||
|
||||
@ -64,6 +62,7 @@ def wrap_gradio_gpu_call(func, extra_outputs=None):
|
||||
|
||||
def initialize():
|
||||
extensions.list_extensions()
|
||||
localization.list_localizations(cmd_opts.localizations_dir)
|
||||
|
||||
if cmd_opts.ui_debug_mode:
|
||||
shared.sd_upscalers = upscaler.UpscalerLanczos().scalers
|
||||
@ -99,7 +98,6 @@ def initialize():
|
||||
else:
|
||||
print("Running with TLS")
|
||||
|
||||
|
||||
# make the program just exit at ctrl+c without waiting for anything
|
||||
def sigint_handler(sig, frame):
|
||||
print(f'Interrupted with signal {sig} in {frame}')
|
||||
@ -185,6 +183,9 @@ def webui():
|
||||
|
||||
print('Reloading extensions')
|
||||
extensions.list_extensions()
|
||||
|
||||
localization.list_localizations(cmd_opts.localizations_dir)
|
||||
|
||||
print('Reloading custom scripts')
|
||||
modules.scripts.reload_scripts()
|
||||
print('Reloading modules: modules.ui')
|
||||
|
Loading…
Reference in New Issue
Block a user