From b31709d783c0b7666c0fc6d474473f5fff8c840c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Fri, 15 Mar 2024 22:39:41 +0800 Subject: [PATCH] v8 --- .../LunaTranslator/gui/settingpage1.py | 45 +------------------ .../files/defaultconfig/static_data.json | 2 +- LunaTranslator/files/lunajspatch.js | 42 ----------------- 3 files changed, 3 insertions(+), 86 deletions(-) delete mode 100644 LunaTranslator/files/lunajspatch.js diff --git a/LunaTranslator/LunaTranslator/gui/settingpage1.py b/LunaTranslator/LunaTranslator/gui/settingpage1.py index 99e67736..1f2b8df4 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage1.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage1.py @@ -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('','') - 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 ) diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index f33a59a3..d8078a0b 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -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"], diff --git a/LunaTranslator/files/lunajspatch.js b/LunaTranslator/files/lunajspatch.js deleted file mode 100644 index f1ced634..00000000 --- a/LunaTranslator/files/lunajspatch.js +++ /dev/null @@ -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);