new version v1.1 des:refresh and you can custom jsonfiles to yours folder

pull/12/head
thisjam 2023-07-31 14:01:40 +08:00
parent 4337cd3177
commit f494fe3c78
4 changed files with 24 additions and 16 deletions

8
.gitignore vendored
View File

@ -1,8 +1,14 @@
/cache/*
/script/__pycache__/*
/script/__pycache__/
/script/__pycache__
/yours/*
!/yours/.gitkeep
*.git*
*.swp
*.pyc
*.idea*
*__pycache__*

View File

@ -59,10 +59,10 @@ async function getJsonStr() {
return val1||val2
}
// function clearTextarea(){
// document.querySelector("#oldsix-area1 textarea").value='area1'
// document.querySelector("#oldsix-area2 textarea").value='area2'
// }
function clearTextarea(){
document.querySelector("#oldsix-area1 textarea").value='area1'
document.querySelector("#oldsix-area2 textarea").value='area2'
}
function createBtnTitle(name,parent){
let div=document.createElement('div')
@ -171,7 +171,7 @@ async function loadCustomUI(){
reloadNodes(jsonstr, Elements.btnReload[0])
reloadNodes(jsonstr, Elements.btnReload[1])
}
}

View File

@ -8,23 +8,25 @@ def LoadTagsFile():
current_script = os.path.realpath(__file__)
current_folder = os.path.dirname(current_script)
work_basedir = os.path.dirname(current_folder) #本插件目录
path = work_basedir+ r"/json"
files = os.listdir( path )
#listjsonpath="extensions/sd-webui-oldsix_prompt/json/"
path1 = work_basedir+ r"/json"
path2 = work_basedir+ r"/yours"
dic={}
for item in files:
loadjsonfiles(path1,dic)
loadjsonfiles(path2,dic)
return json.dumps(dic,ensure_ascii=False)
def loadjsonfiles(path,dic):
files = os.listdir( path )
for item in files:
if item.endswith(".json"):
filepath=path+'/'+item
filename=filepath[filepath.rindex('/') + 1:-5]
with open(filepath, "r",encoding="utf-8-sig") as f:
res=json.loads(f.read())
dic[filename]=res
return json.dumps(dic,ensure_ascii=False)
class Script(scripts.Script):