mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
v8
This commit is contained in:
parent
52305c7f92
commit
b31709d783
@ -255,58 +255,17 @@ def setTabOne_direct(self) :
|
||||
def setTabOne(self) :
|
||||
self.tabadd_lazy(self.tab_widget, ('文本输入'), lambda :setTabOne_lazy(self))
|
||||
|
||||
def jspatchgrid(self) :
|
||||
|
||||
|
||||
execbutton=QPushButton('Select RPGMakeMV/TyranoScript exe')
|
||||
def findindexhtml(exe):
|
||||
for f in os.walk(os.path.dirname(exe)):
|
||||
director,_,fs=f
|
||||
for _f in fs:
|
||||
if _f=='index.html':
|
||||
return os.path.join(director,_f)
|
||||
return None
|
||||
|
||||
def execclicked():
|
||||
|
||||
f=QFileDialog.getOpenFileName(filter='*.exe')
|
||||
pname=f[0]
|
||||
if pname!='':
|
||||
index=findindexhtml(pname)
|
||||
if index:
|
||||
with open(index,'r',encoding='utf8') as ff:
|
||||
html=ff.read()
|
||||
if 'lunajspatch.js' not in html:
|
||||
html=html.replace('</body>','<script type="text/javascript" src="./lunajspatch.js"></script></body>')
|
||||
with open(index,'w',encoding='utf8') as ff:
|
||||
ff.write(html)
|
||||
with open('./files/lunajspatch.js','rb') as ff:
|
||||
with open(os.path.join(os.path.dirname(index),'lunajspatch.js'),'wb') as fw:
|
||||
fw.write(ff.read())
|
||||
getQMessageBox(self,'',_TR("success!"))
|
||||
else:
|
||||
getQMessageBox(self,_TR("错误"),_TR("can't find index.html!"))
|
||||
execbutton.clicked.connect(execclicked)
|
||||
|
||||
grids=[
|
||||
[],
|
||||
[(execbutton,10)] ,
|
||||
]
|
||||
|
||||
return grids
|
||||
|
||||
def setTabOne_lazy(self) :
|
||||
|
||||
|
||||
|
||||
tab=self.makesubtab_lazy(['HOOK设置','OCR设置','剪贴板','内嵌翻译','FridaScripts','JS Patch'],
|
||||
tab=self.makesubtab_lazy(['HOOK设置','OCR设置','剪贴板','内嵌翻译','FridaScripts'],
|
||||
[
|
||||
lambda:self.makescroll(self.makegrid(gethookgrid(self))),
|
||||
lambda:self.makescroll(self.makegrid(getocrgrid(self))),
|
||||
lambda:self.makescroll(self.makegrid(setTabclip(self))),
|
||||
lambda:self.makescroll(self.makegrid(gethookembedgrid(self) )),
|
||||
lambda:self.makescroll(self.makegrid(getfridahookgrid(self) )),
|
||||
lambda:self.makescroll(self.makegrid(jspatchgrid(self) )),
|
||||
lambda:self.makescroll(self.makegrid(getfridahookgrid(self) ))
|
||||
])
|
||||
|
||||
gridlayoutwidget=self.makegrid(self.tab1grids )
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"version":"v2.39.0",
|
||||
"version":"v2.39.1",
|
||||
"language_list_show":["简体中文","日本語","English","Русский язык","Español","한국어","Français","繁體中文","Tiếng Việt","Türkçe","Polski","Українська Мова","Italiano","اللغة العربية","ภาษาไทย"] ,
|
||||
"language_list_translator":["简体中文","日文","英文","俄语","西班牙语","韩语","法语","繁体中文","越南语","土耳其语","波兰语","乌克兰语","意大利语","阿拉伯语","泰语"],
|
||||
"language_list_translator_inner":["zh", "ja", "en","ru","es","ko","fr","cht","vi","tr","pl","uk","it","ar","th"],
|
||||
|
@ -1,42 +0,0 @@
|
||||
|
||||
|
||||
function NWjshook(){
|
||||
function NWjssend(s) {
|
||||
const _clipboard = require('nw.gui').Clipboard.get();
|
||||
_clipboard.set(s, 'text');
|
||||
return _clipboard.get('text')
|
||||
}
|
||||
|
||||
Window_Message.prototype.originstartMessage=Window_Message.prototype.startMessage;
|
||||
Window_Message.prototype.startMessage = function()
|
||||
{
|
||||
gametext = $gameMessage.allText();
|
||||
resp=NWjssend(gametext);
|
||||
$gameMessage._texts=[resp]
|
||||
this.originstartMessage();
|
||||
};
|
||||
}
|
||||
|
||||
function Electronhook() {
|
||||
|
||||
function Electronsend(s) {
|
||||
const { clipboard } = require('electron');
|
||||
clipboard.writeText(s);
|
||||
return clipboard.readText();
|
||||
}
|
||||
const _text_showMessage = tyrano.plugin.kag.tag.text.showMessage;
|
||||
tyrano.plugin.kag.tag.text.showMessage = function () {
|
||||
arguments[0]=Electronsend(arguments[0]);
|
||||
return _text_showMessage.apply(this, arguments);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setTimeout(()=>{
|
||||
if(window.tyrano && tyrano.plugin){
|
||||
Electronhook();
|
||||
}
|
||||
else if(window.Utils && Utils.RPGMAKER_NAME){
|
||||
NWjshook();
|
||||
}
|
||||
},5000);
|
Loading…
x
Reference in New Issue
Block a user