diff --git a/.gitignore b/.gitignore index 3552a738..5e12838d 100644 --- a/.gitignore +++ b/.gitignore @@ -33,4 +33,5 @@ LunaTranslator/files/data LunaTranslator/chrome_cache plugins/.vscode/settings.json -LunaTranslator/files/themes \ No newline at end of file +LunaTranslator/files/themes +LunaTranslator/LunaTranslator/rendertext/luna.png diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index 32cd51d8..17c181a5 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -348,7 +348,8 @@ class MAINUI: return res = self.solveaftertrans(res, optimization_params) - + if len(res) == 0: + return if onlytrans == False: if globalconfig["read_trans"] and ( list(globalconfig["fanyi"].keys())[globalconfig["read_translator"]] @@ -697,7 +698,6 @@ class MAINUI: needinserthookcode=needinserthookcode, ) - else: pids = self.textsource.pids if sum([int(pid_running(pid)) for pid in pids]) == 0: @@ -908,8 +908,9 @@ class MAINUI: self.__currentexe = None except: print_exc() + @threader - def clickwordcallback(self,word, append): + def clickwordcallback(self, word, append): if globalconfig["usewordorigin"] == False: word = word["orig"] else: @@ -917,15 +918,12 @@ class MAINUI: if globalconfig["usecopyword"]: if append: - winsharedutils.clipboard_set( - winsharedutils.clipboard_get() + word - ) + winsharedutils.clipboard_set(winsharedutils.clipboard_get() + word) else: winsharedutils.clipboard_set(word) if globalconfig["usesearchword"]: - self.searchwordW.getnewsentencesignal.emit( - word, append - ) + self.searchwordW.getnewsentencesignal.emit(word, append) + def setshowintab_checked(self, widget): try: self.translation_ui diff --git a/LunaTranslator/LunaTranslator/cishu/cishubase.py b/LunaTranslator/LunaTranslator/cishu/cishubase.py index 345b2fab..ece23ebe 100644 --- a/LunaTranslator/LunaTranslator/cishu/cishubase.py +++ b/LunaTranslator/LunaTranslator/cishu/cishubase.py @@ -41,6 +41,8 @@ class cishubase: if res and len(res): callback(res) + else: + callback(None) except: pass diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index 2dc5529f..02d60189 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -44,14 +44,15 @@ from gui.usefulwidget import ( getsimplepatheditor, getboxlayout, getlineedit, - MySwitch, + MySwitch2, auto_select_webview, Prompt_dialog, getsimplecombobox, D_getsimpleswitch, getspinbox, + getIconButton, + D_getIconButton, getcolorbutton, - D_getcolorbutton, makesubtab_lazy, tabadd_lazy, getsimpleswitch, @@ -301,13 +302,8 @@ class tagitem(QWidget): lb.clicked.connect(functools.partial(self.labelclicked.emit, key)) tagLayout.addWidget(lb) if removeable: - button = getcolorbutton( - None, - None, - functools.partial(self.removesignal.emit, key), # self.removeTag(tag), - icon="fa.times", - constcolor="#FF69B4", - sizefixed=True, + button = getIconButton( + functools.partial(self.removesignal.emit, key), icon="fa.times" ) tagLayout.addWidget(button) @@ -498,24 +494,10 @@ class browserdialog(saveposwindow): hlay = QHBoxLayout() hlay.addWidget(self.tagswidget) + hlay.addWidget(getIconButton(self.likelink, icon="fa.heart")) hlay.addWidget( - getcolorbutton( - "", - "", - self.likelink, - icon="fa.heart", - constcolor="#FF69B4", - sizefixed=True, - ) - ) - hlay.addWidget( - getcolorbutton( - "", - "", - lambda: self.urlclicked((None, None, self.current)), - icon="fa.repeat", - constcolor="#FF69B4", - sizefixed=True, + getIconButton( + lambda: self.urlclicked((None, None, self.current)), icon="fa.repeat" ) ) _topw = QWidget() @@ -573,27 +555,20 @@ def maybehavebutton(self, game, post): savehook_new_data[game]["save_text_process_info"]["mypost"] = str( uuid.uuid4() ).replace("-", "_") - return getcolorbutton( - globalconfig, - "", + return getIconButton( callback=functools.partial( selectdebugfile, savehook_new_data[game]["save_text_process_info"]["mypost"], ismypost=True, ), icon="fa.gear", - constcolor="#FF69B4", ) else: if post not in postprocessconfig: return if post == "_remove_chaos": - return getcolorbutton( - globalconfig, - "", - icon="fa.gear", - constcolor="#FF69B4", - callback=lambda: codeacceptdialog(self), + return getIconButton( + icon="fa.gear", callback=lambda: codeacceptdialog(self) ) elif "args" in postprocessconfig[post]: if isinstance(list(postprocessconfig[post]["args"].values())[0], dict): @@ -618,13 +593,7 @@ def maybehavebutton(self, game, post): 600, items, ) - return getcolorbutton( - globalconfig, - "", - callback=callback, - icon="fa.gear", - constcolor="#FF69B4", - ) + return getIconButton(callback=callback, icon="fa.gear") else: return None @@ -663,19 +632,10 @@ class dialog_setting_game_internal(QWidget): getboxlayout( [ self.editpath, - getcolorbutton( - "", - "", - functools.partial(self.selectexe), - icon="fa.gear", - constcolor="#FF69B4", - ), - getcolorbutton( - "", - "", + getIconButton(functools.partial(self.selectexe), icon="fa.gear"), + getIconButton( lambda: browserdialog(gobject.baseobject.settin_ui, exepath), icon="fa.book", - constcolor="#FF69B4", ), ] ), @@ -697,13 +657,7 @@ class dialog_setting_game_internal(QWidget): getboxlayout( [ titleedit, - getcolorbutton( - "", - "", - _titlechange, - icon="fa.search", - constcolor="#FF69B4", - ), + getIconButton(_titlechange, icon="fa.search"), ] ), ) @@ -772,19 +726,13 @@ class dialog_setting_game_internal(QWidget): ) _vbox_internal = [ vndbid, - getcolorbutton( - "", - "", + getIconButton( functools.partial(self.openrefmainpage, key, idname, exepath), icon="fa.chrome", - constcolor="#FF69B4", ), - getcolorbutton( - "", - "", + getIconButton( functools.partial(gamdidchangedtask, key, idname, exepath), icon="fa.search", - constcolor="#FF69B4", ), ] @@ -792,13 +740,7 @@ class dialog_setting_game_internal(QWidget): __settting = targetmod[key].querysettingwindow _vbox_internal.insert( 1, - getcolorbutton( - "", - "", - functools.partial(__settting, self), - icon="fa.gear", - constcolor="#FF69B4", - ), + getIconButton(functools.partial(__settting, self), icon="fa.gear"), ) except: pass @@ -1047,9 +989,7 @@ class dialog_setting_game_internal(QWidget): [ QLabel(_TR("语音修正")), getsimpleswitch(savehook_new_data[exepath], "tts_repair"), - getcolorbutton( - globalconfig, - "", + getIconButton( callback=lambda x: noundictconfigdialog1( self, savehook_new_data[exepath]["tts_repair_regex"], @@ -1057,7 +997,6 @@ class dialog_setting_game_internal(QWidget): ["正则", "原文", "替换"], ), icon="fa.gear", - constcolor="#FF69B4", ), ] ) @@ -1775,16 +1714,9 @@ class dialog_savedgame_integrated(saveposwindow): self.internallayout.addWidget(QWidget()) self.setCentralWidget(w) - colors = ["#7f7f7f", "#7f7f7f", "#FF69B4", "#FF69B4"] - self.layout1btn = MySwitch( - self, icons=["fa.th", "fa.th"], size=20, colors=colors - ) - self.layout2btn = MySwitch( - self, icons=["fa.th-list", "fa.th-list"], size=20, colors=colors - ) - self.layout3btn = MySwitch( - self, icons=["fa.list", "fa.list"], size=20, colors=colors - ) + self.layout1btn = MySwitch2(self, icons=["fa.th", "fa.th"], size=20) + self.layout2btn = MySwitch2(self, icons=["fa.th-list", "fa.th-list"], size=20) + self.layout3btn = MySwitch2(self, icons=["fa.list", "fa.list"], size=20) self.layout1btn.clicked.connect(functools.partial(self.selectlayout, 0)) self.layout2btn.clicked.connect(functools.partial(self.selectlayout, 1)) self.layout3btn.clicked.connect(functools.partial(self.selectlayout, 2)) @@ -1974,9 +1906,7 @@ class dialog_savedgame_new(QWidget): self.tagswidget.lineEdit.setCurrentText(_) layout.addWidget( - getcolorbutton( - "", - "", + getIconButton( lambda _: listediter( parent, _TR("标签集"), @@ -1985,7 +1915,6 @@ class dialog_savedgame_new(QWidget): closecallback=refreshcombo, ), icon="fa.gear", - constcolor="#FF69B4", ), ) @@ -2259,12 +2188,8 @@ class dialog_savedgame_lagacy(QWidget): self.table.setIndexWidget( self.model.index(row, 2), - D_getcolorbutton( - "", - "", - functools.partial(self.showsettingdialog, k), - icon="fa.gear", - constcolor="#FF69B4", + D_getIconButton( + functools.partial(self.showsettingdialog, k), icon="fa.gear" ), ) diff --git a/LunaTranslator/LunaTranslator/gui/inputdialog.py b/LunaTranslator/LunaTranslator/gui/inputdialog.py index d5b46f1c..4a6348c0 100644 --- a/LunaTranslator/LunaTranslator/gui/inputdialog.py +++ b/LunaTranslator/LunaTranslator/gui/inputdialog.py @@ -277,6 +277,11 @@ class autoinitdialog(QDialog): elif line["type"] == "switch": lineW = MySwitch(sign=dd[key]) regist.append([dd, key, lineW.isChecked]) + _ = QHBoxLayout() + _.addStretch() + _.addWidget(lineW) + _.addStretch() + lineW = _ elif line["type"] == "spin": lineW = FocusDoubleSpin() lineW.setMinimum(line.get("min", 0)) diff --git a/LunaTranslator/LunaTranslator/gui/setting_about.py b/LunaTranslator/LunaTranslator/gui/setting_about.py index f17cc511..e013472a 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_about.py +++ b/LunaTranslator/LunaTranslator/gui/setting_about.py @@ -157,7 +157,7 @@ def setTab_aboutlazy(self, basel): [(functools.partial(createversionlabel, self), 10)], [(functools.partial(createdownloadprogress, self), 10)], [], - [("网络请求", -1)], + [("网络请求_重启生效", -1)], [(D_getsimplecombobox(["winhttp", "libcurl"], globalconfig, "network"), 5)], [("网页显示", -1)], [ diff --git a/LunaTranslator/LunaTranslator/gui/setting_cishu.py b/LunaTranslator/LunaTranslator/gui/setting_cishu.py index 58cf8ed9..bbe70cfe 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_cishu.py +++ b/LunaTranslator/LunaTranslator/gui/setting_cishu.py @@ -3,11 +3,10 @@ import gobject from myutils.config import globalconfig, _TRL from gui.inputdialog import autoinitdialog, autoinitdialog_items from gui.usefulwidget import ( - D_getcolorbutton, yuitsu_switch, makescrollgrid, D_getsimpleswitch, - D_getsimplecombobox, + D_getIconButton, ) @@ -29,9 +28,7 @@ def gethiragrid(self): if "args" in globalconfig["hirasetting"][name]: items = autoinitdialog_items(globalconfig["hirasetting"][name]) items[-1]["callback"] = gobject.baseobject.starthira - _3 = D_getcolorbutton( - globalconfig, - "", + _3 = D_getIconButton( callback=functools.partial( autoinitdialog, self, @@ -40,7 +37,6 @@ def gethiragrid(self): items, ), icon="fa.gear", - constcolor="#FF69B4", ) else: @@ -81,48 +77,16 @@ def gethiragrid(self): def setTabcishu_l(self): - grids = ( + grids = [ [ - [("分词&假名分析器", -1)], - [ - ("日语注音方案", 6), - ( - D_getsimplecombobox( - _TRL(["平假名", "片假名", "罗马音"]), - globalconfig, - "hira_vis_type", - ), - 5, - ), - ], - ] - + gethiragrid(self) - + [ - [], - [], - [ - ("点击单词查词", 6), - (D_getsimpleswitch(globalconfig, "usesearchword"), 1), - D_getcolorbutton( - globalconfig, - "", - callback=lambda: gobject.baseobject.searchwordW.showsignal.emit(), - icon="fa.search", - constcolor="#FF69B4", - ), - "", - ("点击单词复制", 6), - (D_getsimpleswitch(globalconfig, "usecopyword"), 1), - ], - [ - ("使用原型查询", 6), - (D_getsimpleswitch(globalconfig, "usewordorigin"), 1), - ], - [], - [("辞书", -1)], - ] - ) - + ( + dict(title="分词器", type="grid", grid=gethiragrid(self)), + 0, + "group", + ) + ], + ] + cishugrid = [] line = [] i = 0 for cishu in globalconfig["cishu"]: @@ -141,9 +105,7 @@ def setTabcishu_l(self): "use", callback=functools.partial(gobject.baseobject.startxiaoxueguan, cishu), ), - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=functools.partial( autoinitdialog, self, @@ -152,16 +114,34 @@ def setTabcishu_l(self): items, ), icon="fa.gear", - constcolor="#FF69B4", ), ] if i % 3 == 2: - grids.append(line) + cishugrid.append(line) line = [] else: line += [""] i += 1 if len(line): - grids.append(line) + cishugrid.append(line) + grids += [ + [], + [ + "查词", + D_getIconButton( + callback=lambda: gobject.baseobject.searchwordW.showsignal.emit(), + icon="fa.search", + ), + ("",4) + ], + [], + [ + ( + dict(title="辞书", type="grid", grid=cishugrid), + 0, + "group", + ) + ], + ] return grids diff --git a/LunaTranslator/LunaTranslator/gui/setting_display.py b/LunaTranslator/LunaTranslator/gui/setting_display.py index b6349bbc..9084aba2 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display.py @@ -2,7 +2,7 @@ from qtsymbols import * import functools import gobject from myutils.config import globalconfig, _TRL -from gui.setting_display_buttons import createbuttonwidget +from gui.setting_display_buttons import createbuttonwidget from gui.setting_display_text import xianshigrid from gui.setting_display_ui import uisetting from gui.setting_display_scale import makescalew @@ -18,51 +18,89 @@ def _xingw(): xingweigrid = [ [ - ("游戏最小化时窗口隐藏", 6), - (D_getsimpleswitch(globalconfig, "minifollow"), 1), + ( + dict( + title="伴随游戏窗口", + grid=( + [ + "游戏最小化时窗口隐藏", + D_getsimpleswitch(globalconfig, "minifollow"), + ], + [ + "游戏失去焦点时取消置顶", + D_getsimpleswitch(globalconfig, "focusnotop"), + ], + [ + "游戏窗口移动时同步移动", + D_getsimpleswitch(globalconfig, "movefollow"), + ], + ), + ), + 0, + "group", + ) ], [ - ("游戏失去焦点时取消置顶", 6), - (D_getsimpleswitch(globalconfig, "focusnotop"), 1), + ( + dict( + title="窗口尺寸", + grid=( + [ + "自动延展", + D_getsimpleswitch(globalconfig, "auto_expand"), + ], + [ + "自动收缩", + D_getsimpleswitch(globalconfig, "auto_shrink"), + ], + ), + ), + 0, + "group", + ) ], [ - ("游戏窗口移动时同步移动", 6), - (D_getsimpleswitch(globalconfig, "movefollow"), 1), - ], - [ - ("固定窗口尺寸", 6), - D_getsimpleswitch(globalconfig, "fixedheight"), - ], - [ - ("自动隐藏窗口", 6), - (D_getsimpleswitch(globalconfig, "autodisappear"), 1), - "", - ("隐藏延迟(s)", 3), - (D_getspinbox(1, 100, globalconfig, "disappear_delay"), 2), - ], - [ - ("任务栏中显示_翻译窗口", 6), - D_getsimpleswitch( - globalconfig, - "showintab", - callback=lambda _: gobject.baseobject.setshowintab(), - ), - ], - [ - ("任务栏中显示_其他", 6), - D_getsimpleswitch( - globalconfig, - "showintab_sub", - callback=lambda _: gobject.baseobject.setshowintab(), - ), - ], - [ - ("可选取模式", 6), - D_getsimpleswitch( - globalconfig, - "selectable", - callback=lambda x: gobject.baseobject.translation_ui.translate_text.setselectable(), - ), + ( + dict( + title="其他", + grid=( + [ + "自动隐藏窗口", + D_getsimpleswitch(globalconfig, "autodisappear"), + ], + [ + "隐藏延迟(s)", + D_getspinbox(1, 100, globalconfig, "disappear_delay"), + ], + [ + "任务栏中显示_翻译窗口", + D_getsimpleswitch( + globalconfig, + "showintab", + callback=lambda _: gobject.baseobject.setshowintab(), + ), + ], + [ + "任务栏中显示_其他", + D_getsimpleswitch( + globalconfig, + "showintab_sub", + callback=lambda _: gobject.baseobject.setshowintab(), + ), + ], + [ + "可选取模式", + D_getsimpleswitch( + globalconfig, + "selectable", + callback=lambda x: gobject.baseobject.translation_ui.translate_text.setselectable(), + ), + ], + ), + ), + 0, + "group", + ) ], ] return xingweigrid diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py b/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py index c3a0cc34..e38415f6 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_buttons.py @@ -5,8 +5,8 @@ from myutils.config import globalconfig, _TR, _TRL from myutils.wrapper import Singleton from gui.usefulwidget import ( D_getsimplecombobox, - D_getcolorbutton, - getcolorbutton, + D_getIconButton, + getIconButton, makescrollgrid, D_getsimpleswitch, ) @@ -29,9 +29,7 @@ class dialog_selecticon(QDialog): self.setLayout(layout) for i, name in enumerate(js): layout.addWidget( - getcolorbutton( - "", - "", + getIconButton( functools.partial(self.selectcallback, "fa." + name), qicon=qtawesome.icon( "fa." + name, color=globalconfig["buttoncolor"] @@ -89,23 +87,17 @@ def createbuttonwidget(self, lay): for i, k in enumerate(sortlist): - button_up = D_getcolorbutton( - globalconfig, - "", + button_up = D_getIconButton( callback=functools.partial( changerank, k, True, sortlist, savelist, savelay ), icon="fa.arrow-up", - constcolor="#FF69B4", ) - button_down = D_getcolorbutton( - globalconfig, - "", + button_down = D_getIconButton( callback=functools.partial( changerank, k, False, sortlist, savelist, savelay ), icon="fa.arrow-down", - constcolor="#FF69B4", ) l = [ @@ -123,9 +115,7 @@ def createbuttonwidget(self, lay): callback=doadjust, fixedsize=True, ), - D_getcolorbutton( - "", - "", + D_getIconButton( functools.partial( dialog_selecticon, self, @@ -140,9 +130,7 @@ def createbuttonwidget(self, lay): ] if "icon2" in globalconfig["toolbutton"]["buttons"][k]: l.append( - D_getcolorbutton( - "", - "", + D_getIconButton( functools.partial( dialog_selecticon, self, diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_scale.py b/LunaTranslator/LunaTranslator/gui/setting_display_scale.py index 2ac11e76..55281792 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_scale.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_scale.py @@ -7,7 +7,7 @@ from gui.usefulwidget import ( makegrid, D_getspinbox, getvboxwidget, - D_getcolorbutton, + D_getIconButton, makesubtab_lazy, makescrollgrid, D_getsimpleswitch, @@ -34,9 +34,7 @@ def makescalew(self, lay): [ ("Magpie_路径", 4), ( - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=lambda x: getsomepath1( self, "Magpie_路径", @@ -46,7 +44,6 @@ def makescalew(self, lay): isdir=True, ), icon="fa.gear", - constcolor="#FF69B4", ), 1, ), @@ -55,255 +52,299 @@ def makescalew(self, lay): ] innermagpie = [ - [("常规", -1)], [ - ("", 1), - ("缩放模式", 4), ( - D_getsimplecombobox( - [_["name"] for _ in magpie_config["scalingModes"]], - magpie_config["profiles"][globalconfig["profiles_index"]], - "scalingMode", + dict( + title="常规", + grid=( + [ + [ + "缩放模式", + D_getsimplecombobox( + [_["name"] for _ in magpie_config["scalingModes"]], + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "scalingMode", + ), + ], + [ + "捕获模式", + D_getsimplecombobox( + [ + "Graphics Capture", + "Desktop Duplication", + "GDI", + "DwmSharedSurface", + ], + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "captureMethod", + ), + ], + [ + "3D游戏模式", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "3DGameMode", + ), + ], + ] + ), ), - 6, - ), - "", + 0, + "group", + ) ], [ - ("", 1), - ("捕获模式", 4), ( - D_getsimplecombobox( - [ - "Graphics Capture", - "Desktop Duplication", - "GDI", - "DwmSharedSurface", - ], - magpie_config["profiles"][globalconfig["profiles_index"]], - "captureMethod", + dict( + title="性能", + grid=( + [ + [ + "显示帧率", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "showFPS", + ), + ], + [ + "限制帧率", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "frameRateLimiterEnabled", + ), + ], + [ + "最大帧率", + D_getspinbox( + 0, + 9999, + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "maxFrameRate", + ), + ], + ] + ), ), - 6, - ), + 0, + "group", + ) ], [ - ("", 1), - ("3D游戏模式", 4), ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "3DGameMode", - ) - ), - ], - [("性能", -1)], - [ - ("", 1), - ("显示帧率", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "showFPS", - ) - ), - ], - [ - ("", 1), - ("限制帧率", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "frameRateLimiterEnabled", - ) - ), - ], - [ - ("", 1), - ("最大帧率", 4), - ( - D_getspinbox( - 0, - 9999, - magpie_config["profiles"][globalconfig["profiles_index"]], - "maxFrameRate", + dict( + title="源窗口", + grid=( + [ + [ + "缩放时禁用窗口大小调整", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "disableWindowResizing", + ), + ], + [ + "捕获标题栏", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "captureTitleBar", + ), + ], + [ + "自定义剪裁", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "croppingEnabled", + ), + ], + ] + ), ), - 2, - ), - ], - [("源窗口", -1)], - [ - ("", 1), - ("缩放时禁用窗口大小调整", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "disableWindowResizing", - ) - ), + 0, + "group", + ) ], [ - ("", 1), - ("捕获标题栏", 4), ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "captureTitleBar", - ) - ), - ], - [ - ("", 1), - ("自定义剪裁", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "croppingEnabled", - ) - ), - ], - [("光标", -1)], - [ - ("", 1), - ("绘制光标", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "drawCursor", - ) - ), - ], - [ - ("", 1), - ("绘制光标_缩放系数", 4), - ( - D_getsimplecombobox( - ["0.5x", "0.75x", "无缩放", "1.25x", "1.5x", "2x", "和源窗口相同"], - magpie_config["profiles"][globalconfig["profiles_index"]], - "cursorScaling", + dict( + title="光标", + grid=( + [ + [ + "绘制光标", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "drawCursor", + ), + ], + [ + "绘制光标_缩放系数", + D_getsimplecombobox( + [ + "0.5x", + "0.75x", + "无缩放", + "1.25x", + "1.5x", + "2x", + "和源窗口相同", + ], + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "cursorScaling", + ), + ], + [ + "绘制光标_插值算法", + D_getsimplecombobox( + ["最邻近", "双线性"], + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "cursorInterpolationMode", + ), + ], + [ + "缩放时调整光标速度", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "adjustCursorSpeed", + ), + ], + ] + ), ), - 6, - ), + 0, + "group", + ) ], [ - ("", 1), - ("绘制光标_插值算法", 4), ( - D_getsimplecombobox( - ["最邻近", "双线性"], - magpie_config["profiles"][globalconfig["profiles_index"]], - "cursorInterpolationMode", + dict( + title="高级", + grid=( + [ + [ + "禁用DirectFlip", + D_getsimpleswitch( + magpie_config["profiles"][ + globalconfig["profiles_index"] + ], + "disableDirectFlip", + ), + ], + [ + "允许缩放最大化或全屏的窗口", + D_getsimpleswitch( + magpie_config, + "allowScalingMaximized", + ), + ], + [ + "缩放时模拟独占全屏", + D_getsimpleswitch( + magpie_config, + "simulateExclusiveFullscreen", + ), + ], + [ + "内联效果参数", + D_getsimpleswitch( + magpie_config, + "inlineParams", + ), + ], + ] + ), ), - 6, - ), + 0, + "group", + ) ], [ - ("", 1), - ("缩放时调整光标速度", 4), ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "adjustCursorSpeed", - ) - ), - ], - [("高级", -1)], - [ - ("", 1), - ("禁用DirectFlip", 4), - ( - D_getsimpleswitch( - magpie_config["profiles"][globalconfig["profiles_index"]], - "disableDirectFlip", - ) - ), - ], - [ - ("", 1), - ("允许缩放最大化或全屏的窗口", 4), - (D_getsimpleswitch(magpie_config, "allowScalingMaximized")), - ], - [ - ("", 1), - ("缩放时模拟独占全屏", 4), - (D_getsimpleswitch(magpie_config, "simulateExclusiveFullscreen")), - ], - [ - ("", 1), - ("内联效果参数", 4), - (D_getsimpleswitch(magpie_config, "inlineParams")), - ], - [("开发者选项", -1)], - [ - ("", 1), - ("调试模式", 4), - ( - D_getsimpleswitch( - magpie_config, - "debugMode", - ) - ), - ], - [ - ("", 1), - ("禁用效果缓存", 4), - ( - D_getsimpleswitch( - magpie_config, - "disableEffectCache", - ) - ), - ], - [ - ("", 1), - ("禁用字体缓存", 4), - ( - D_getsimpleswitch( - magpie_config, - "disableFontCache", - ) - ), - ], - [ - ("", 1), - ("解析效果时保存源代码", 4), - ( - D_getsimpleswitch( - magpie_config, - "saveEffectSources", - ) - ), - ], - [ - ("", 1), - ("编译效果时将警告视为错误", 4), - ( - D_getsimpleswitch( - magpie_config, - "warningsAreErrors", - ) - ), - ], - [ - ("", 1), - ("检测重复帧", 4), - ( - D_getsimplecombobox( - ["总是检测", "动态检测", "从不检测"], - magpie_config, - "duplicateFrameDetectionMode", + dict( + title="开发者选项", + grid=( + [ + [ + "调试模式", + D_getsimpleswitch( + magpie_config, + "debugMode", + ), + ], + [ + "禁用效果缓存", + D_getsimpleswitch( + magpie_config, + "disableEffectCache", + ), + ], + [ + "禁用字体缓存", + D_getsimpleswitch( + magpie_config, + "disableFontCache", + ), + ], + [ + "解析效果时保存源代码", + D_getsimpleswitch( + magpie_config, + "saveEffectSources", + ), + ], + [ + "编译效果时将警告视为错误", + D_getsimpleswitch( + magpie_config, + "warningsAreErrors", + ), + ], + [ + "检测重复帧", + D_getsimplecombobox( + ["总是检测", "动态检测", "从不检测"], + magpie_config, + "duplicateFrameDetectionMode", + ), + ], + [ + "启用动态检测统计", + D_getsimpleswitch( + magpie_config, + "enableStatisticsForDynamicDetection", + ), + ], + ] + ), ), - 6, - ), - ], - [ - ("", 1), - ("启用动态检测统计", 4), - ( - D_getsimpleswitch( - magpie_config, - "enableStatisticsForDynamicDetection", - ) - ), + 0, + "group", + ) ], ] diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_text.py b/LunaTranslator/LunaTranslator/gui/setting_display_text.py index 0ff226bd..6bdf28c4 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_text.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_text.py @@ -1,14 +1,17 @@ from qtsymbols import * import functools import gobject, os -from myutils.config import globalconfig, _TRL, _TR +from myutils.config import globalconfig, _TRL, _TR, static_data from gui.inputdialog import multicolorset +from myutils.wrapper import tryprint from gui.usefulwidget import ( D_getsimplecombobox, - getsimplecombobox, + Singleton_close, + saveposwindow, getsimpleswitch, D_getspinbox, getspinbox, + D_getIconButton, D_getcolorbutton, getcolorbutton, D_getsimpleswitch, @@ -72,7 +75,50 @@ def createfenciwitch(self): return self.show_fenciswitch +@Singleton_close +class extrahtml(saveposwindow): + def tryload(self): + + use = "userconfig/extrahtml.html" + if os.path.exists(use) == False: + use = r"LunaTranslator\rendertext\exampleextrahtml.html" + with open(use, "r", encoding="utf8") as ff: + self.vistext.setPlainText(ff.read()) + + @tryprint + def applyhtml(self, _): + + gobject.refwebview.set_extra_html(self.vistext.toPlainText()) + + def savehtml(self): + os.makedirs("userconfig", exist_ok=True) + with open("userconfig/extrahtml.html", "w", encoding="utf8") as ff: + ff.write(self.vistext.toPlainText()) + + def __init__(self, parent) -> None: + super().__init__(parent, globalconfig, "geo_extrahtml") + self.setWindowTitle(_TR("额外的html")) + + self.btn_save = QPushButton(_TR("保存")) + self.btn_save.clicked.connect(self.savehtml) + self.btn_apply = QPushButton(_TR("测试")) + self.btn_apply.clicked.connect(self.applyhtml) + self.vistext = QPlainTextEdit() + lay = QVBoxLayout() + hl = QHBoxLayout() + hl.addWidget(self.btn_save) + hl.addWidget(self.btn_apply) + lay.addWidget(self.vistext) + lay.addLayout(hl) + w = QWidget() + w.setLayout(lay) + self.setCentralWidget(w) + self.tryload() + self.show() + + def createinternalfontsettings(self, group, _type): + globalconfig["rendertext_using_internal"][group] = _type __internal = globalconfig["rendertext"][group][_type] dd = __internal.get("args", {}) @@ -84,6 +130,7 @@ def createinternalfontsettings(self, group, _type): w = item.widget() lay.removeWidget(w) w.deleteLater() + for key in dd: line = __internal["argstype"][key] name = line["name"] @@ -122,6 +169,10 @@ def createinternalfontsettings(self, group, _type): name, lineW, ) + if group == "webview": + _btn = QPushButton(_TR("额外的html")) + lay.addWidget(_btn) + _btn.clicked.connect(lambda: extrahtml(self)) def resetgroudswitchcallback(self, group): @@ -130,37 +181,24 @@ def resetgroudswitchcallback(self, group): self.goodfontgroupswitch.currentIndexChanged.disconnect() except: pass - _ = [] - for k in globalconfig["rendertext"][group]: - if not os.path.exists(f"LunaTranslator/rendertext/internal/{group}/{k}.py"): - _.append(k) - for k in _: - globalconfig["rendertext"][group].pop(k) - if ( - globalconfig["rendertext_using_internal"][group] - not in globalconfig["rendertext"][group] - ): - globalconfig["rendertext_using_internal"][group] = list( - globalconfig["rendertext"][group].keys() - )[0] self.goodfontgroupswitch.clear() self.goodfontgroupswitch.addItems( _TRL( [ globalconfig["rendertext"][group][x]["name"] - for x in globalconfig["rendertext"][group] + for x in static_data["textrender"][group] ] ) ) self.goodfontgroupswitch.setCurrentIndex(-1) self.goodfontgroupswitch.currentIndexChanged.connect( lambda idx: createinternalfontsettings( - self, group, list(globalconfig["rendertext"][group].keys())[idx] + self, group, static_data["textrender"][group][idx] ) ) self.goodfontgroupswitch.setCurrentIndex( - list(globalconfig["rendertext"][group].keys()).index( + static_data["textrender"][group].index( globalconfig["rendertext_using_internal"][group] ) ) @@ -185,112 +223,196 @@ def xianshigrid(self): textgrid = [ [ - ("原文字体", 3), - (functools.partial(createtextfontcom, "fonttype"), 6), - ("", 5), - ], - [ - ("译文字体", 3), - (functools.partial(createtextfontcom, "fonttype2"), 6), - ], - [ - ("字体大小", 3), - (functools.partial(createfontsizespin, self), 3), - "", - ("额外的行间距", 3), - (D_getspinbox(-100, 100, globalconfig, "extra_space"), 3), - ], - [ - ("居中显示", 5), - D_getsimpleswitch(globalconfig, "showatcenter"), - "", - ("加粗字体", 5), - D_getsimpleswitch(globalconfig, "showbold"), - ], - [], - [ - ("显示引擎", 3), ( - D_getsimplecombobox( - ["Webview2", "Qt"], - globalconfig, - "rendertext_using", - internallist=["webview", "textbrowser"], - callback=functools.partial(resetgroudswitchcallback, self), + dict( + title="样式", + type="grid", + grid=( + [ + ("原文字体", 3), + (functools.partial(createtextfontcom, "fonttype"), 6), + ], + [ + ("译文字体", 3), + (functools.partial(createtextfontcom, "fonttype2"), 6), + ], + [ + ("原文颜色", 3), + D_getcolorbutton( + globalconfig, + "rawtextcolor", + callback=lambda: selectcolor( + self, + globalconfig, + "rawtextcolor", + self.original_color_button, + ), + name="original_color_button", + parent=self, + ), + ], + [ + ("字体大小", 3), + (functools.partial(createfontsizespin, self), 3), + "", + ("额外的行间距", 3), + (D_getspinbox(-100, 100, globalconfig, "extra_space"), 3), + ], + [ + ("居中显示", 3), + D_getsimpleswitch(globalconfig, "showatcenter"), + ("", 3), + ("加粗字体", 3), + D_getsimpleswitch(globalconfig, "showbold"), + ], + ), ), - 6, - ), - ], - [(functools.partial(creategoodfontwid, self), 0)], - [], - [ - ("显示原文", 5), - functools.partial(createshoworiginswitch, self), - "", - ("显示翻译", 5), - (D_getsimpleswitch(globalconfig, "showfanyi"), 1), + 0, + "group", + ) ], [ - ("原文颜色", 5), - D_getcolorbutton( - globalconfig, - "rawtextcolor", - callback=lambda: selectcolor( - self, globalconfig, "rawtextcolor", self.original_color_button - ), - name="original_color_button", - parent=self, - ), - "", - ("显示翻译器名称", 5), - (D_getsimpleswitch(globalconfig, "showfanyisource"), 1), - ], - [ - ("最长显示字数", 3), - (D_getspinbox(0, 1000000, globalconfig, "maxoriginlength"), 3), - ], - [], - [ - ("显示日语注音", 5), - functools.partial(createhiraswitch, self), - ], - [ - ("注音颜色", 5), - D_getcolorbutton( - globalconfig, - "jiamingcolor", - callback=lambda: selectcolor( - self, globalconfig, "jiamingcolor", self.jiamingcolor_b - ), - name="jiamingcolor_b", - parent=self, - ), - "", - ("注音字体缩放", 3), ( - D_getspinbox( - 0.05, 1, globalconfig, "kanarate", double=True, step=0.05, dec=2 + dict( + type="grid", + grid=( + [ + ("显示引擎_重启生效", 3), + ( + D_getsimplecombobox( + ["Webview2", "Qt"], + globalconfig, + "rendertext_using", + internallist=["webview", "textbrowser"], + callback=functools.partial( + resetgroudswitchcallback, self + ), + ), + 6, + ), + ], + [(functools.partial(creategoodfontwid, self), 0)], + ), ), - 3, - ), + 0, + "group", + ) ], [ - ("语法加亮", 5), - functools.partial(createfenciwitch, self), - "", - ("词性颜色(需要Mecab)", 5), - D_getcolorbutton( - globalconfig, - "", - callback=lambda: multicolorset(self), - icon="fa.gear", - constcolor="#FF69B4", - ), + ( + dict( + title="注音", + type="grid", + grid=( + [ + ("显示", 5), + functools.partial(createhiraswitch, self), + "", + ("颜色", 5), + D_getcolorbutton( + globalconfig, + "jiamingcolor", + callback=lambda: selectcolor( + self, + globalconfig, + "jiamingcolor", + self.jiamingcolor_b, + ), + name="jiamingcolor_b", + parent=self, + ), + ], + [ + ("字体缩放", 5), + D_getspinbox( + 0.05, + 1, + globalconfig, + "kanarate", + double=True, + step=0.05, + dec=2, + ), + "", + ("日语注音方案", 5), + D_getsimplecombobox( + _TRL(["平假名", "片假名", "罗马音"]), + globalconfig, + "hira_vis_type", + ), + ], + ), + ), + 0, + "group", + ) ], - [], [ - ("收到翻译结果时才刷新", 5), - D_getsimpleswitch(globalconfig, "refresh_on_get_trans"), + ( + dict( + title="分词", + type="grid", + grid=( + [ + ("语法加亮", 5), + functools.partial(createfenciwitch, self), + "", + ("词性颜色(需要Mecab)", 5), + D_getIconButton( + callback=lambda: multicolorset(self), icon="fa.gear" + ), + ], + [ + ("点击单词查词", 5), + (D_getsimpleswitch(globalconfig, "usesearchword"), 1), + "", + ("点击单词复制", 5), + (D_getsimpleswitch(globalconfig, "usecopyword"), 1), + ], + [ + ("使用原型查询", 5), + (D_getsimpleswitch(globalconfig, "usewordorigin"), 1), + ], + ), + ), + 0, + "group", + ) + ], + [ + ( + dict( + title="显示行为", + type="grid", + grid=( + [ + ("显示原文", 5), + functools.partial(createshoworiginswitch, self), + "", + ("显示翻译", 5), + (D_getsimpleswitch(globalconfig, "showfanyi"), 1), + ], + [ + ("显示翻译器名称", 5), + (D_getsimpleswitch(globalconfig, "showfanyisource"), 1), + "", + ("最长显示字数", 5), + ( + D_getspinbox( + 0, 1000000, globalconfig, "maxoriginlength" + ), + 3, + ), + ], + [ + ("收到翻译结果时才刷新", 5), + D_getsimpleswitch(globalconfig, "refresh_on_get_trans"), + ], + ), + ), + 0, + "group", + ) ], ] return textgrid diff --git a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py index 7ded57a9..ecee9ba1 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_display_ui.py +++ b/LunaTranslator/LunaTranslator/gui/setting_display_ui.py @@ -8,9 +8,9 @@ from gui.usefulwidget import ( D_getsimplecombobox, D_getspinbox, D_getcolorbutton, - getcolorbutton, + getIconButton, selectcolor, - FocusFontCombo + FocusFontCombo, ) @@ -163,13 +163,7 @@ def checkthemesettingvisandapply_1(self, _dark): def createbtnthemelight(self): lightsetting = checkthemeissetable(self, False) self.lightsetting = lightsetting - self.btnthemelight = getcolorbutton( - globalconfig, - "", - callback=lambda: 1, - icon="fa.gear", - constcolor="#FF69B4", - ) + self.btnthemelight = getIconButton(icon="fa.gear") try: if not self.lightsetting: self.btnthemelight.hide() @@ -184,12 +178,8 @@ def createbtnthemelight(self): def createbtnthemedark(self): darksetting = checkthemeissetable(self, True) self.darksetting = darksetting - self.btnthemedark = getcolorbutton( - globalconfig, - "", - callback=lambda: 1, + self.btnthemedark = getIconButton( icon="fa.gear", - constcolor="#FF69B4", ) try: if not self.darksetting: @@ -213,170 +203,281 @@ def uisetting(self): return [_["name"] for _ in static_data["themes"][t]] uigrid = [ - [("设置界面字体", 4), (createfontcombo, 5)], [ - ("字体大小", 4), ( - D_getspinbox( - 1, - 100, - globalconfig, - "settingfontsize", - callback=lambda _: gobject.baseobject.setcommonstylesheet(), + dict( + title="主界面", + type="grid", + grid=( + [ + ( + dict( + title="翻译窗口", + type="grid", + grid=( + [ + ("不透明度", 4), + ( + functools.partial( + createhorizontal_slider, self + ), + 8, + ), + ( + functools.partial( + createhorizontal_slider_label, self + ), + 2, + ), + ], + [ + ("背景颜色", 4), + D_getcolorbutton( + globalconfig, + "backcolor", + callback=lambda: selectcolor( + self, + globalconfig, + "backcolor", + self.back_color_button, + callback=gobject.baseobject.translation_ui.set_color_transparency, + ), + name="back_color_button", + parent=self, + ), + "", + "", + ("圆角_半径", 4), + ( + D_getspinbox( + 0, + 100, + globalconfig, + "yuanjiao_r", + callback=lambda _: gobject.baseobject.translation_ui.set_color_transparency(), + ), + 2, + ), + ], + ), + ), + 0, + "group", + ) + ], + [ + ( + dict( + title="工具栏", + type="grid", + grid=( + [ + ("不透明度", 4), + ( + functools.partial( + createhorizontal_slider_tool, self + ), + 8, + ), + ( + functools.partial( + createhorizontal_slider_tool_label, + self, + ), + 2, + ), + ], + [ + ("背景颜色", 4), + D_getcolorbutton( + globalconfig, + "backcolor_tool", + callback=lambda: selectcolor( + self, + globalconfig, + "backcolor_tool", + self.back_color_button_tool, + callback=gobject.baseobject.translation_ui.set_color_transparency, + ), + name="back_color_button_tool", + parent=self, + ), + ], + [ + ("工具按钮颜色", 4), + D_getcolorbutton( + globalconfig, + "buttoncolor", + callback=lambda: selectcolor( + self, + globalconfig, + "buttoncolor", + self.buttoncolorbutton, + callback=lambda: gobject.baseobject.translation_ui.refreshtooliconsignal.emit(), + ), + name="buttoncolorbutton", + parent=self, + ), + "", + "", + ("工具按钮大小", 4), + ( + D_getspinbox( + 5, + 100, + globalconfig, + "buttonsize", + callback=lambda _: gobject.baseobject.translation_ui.refreshtooliconsignal.emit(), + ), + 2, + ), + ], + ), + ), + 0, + "group", + ) + ], + ), ), - 2, - ), + 0, + "group", + ) ], [ - ("不透明度_翻译窗口", 4), - (functools.partial(createhorizontal_slider, self), 8), - (functools.partial(createhorizontal_slider_label, self), 2), - ], - [ - ("不透明度_工具栏", 4), - (functools.partial(createhorizontal_slider_tool, self), 8), - (functools.partial(createhorizontal_slider_tool_label, self), 2), - ], - [ - ("背景颜色_翻译窗口", 4), - D_getcolorbutton( - globalconfig, - "backcolor", - callback=lambda: selectcolor( - self, - globalconfig, - "backcolor", - self.back_color_button, - callback=gobject.baseobject.translation_ui.set_color_transparency, - ), - name="back_color_button", - parent=self, - ), - "", - "", - ("背景颜色_工具栏", 4), - D_getcolorbutton( - globalconfig, - "backcolor_tool", - callback=lambda: selectcolor( - self, - globalconfig, - "backcolor_tool", - self.back_color_button_tool, - callback=gobject.baseobject.translation_ui.set_color_transparency, - ), - name="back_color_button_tool", - parent=self, - ), - ], - [ - ("工具按钮颜色", 4), - D_getcolorbutton( - globalconfig, - "buttoncolor", - callback=lambda: selectcolor( - self, - globalconfig, - "buttoncolor", - self.buttoncolorbutton, - callback=lambda: gobject.baseobject.translation_ui.refreshtooliconsignal.emit(), - ), - name="buttoncolorbutton", - parent=self, - ), - "", - "", - ("工具按钮大小", 4), ( - D_getspinbox( - 5, - 100, - globalconfig, - "buttonsize", - callback=lambda _: gobject.baseobject.translation_ui.refreshtooliconsignal.emit(), + dict( + title="设置界面", + grid=( + ["字体", createfontcombo], + [ + "字体大小", + D_getspinbox( + 1, + 100, + globalconfig, + "settingfontsize", + callback=lambda _: gobject.baseobject.setcommonstylesheet(), + ), + ], + [ + "按钮颜色", + ( + D_getcolorbutton( + globalconfig, + "buttoncolor2", + callback=lambda: selectcolor( + self, + globalconfig, + "buttoncolor2", + self.buttoncolorbutton2, + ), + name="buttoncolorbutton2", + parent=self, + ), + D_getcolorbutton( + globalconfig, + "buttoncolor3", + callback=lambda: selectcolor( + self, + globalconfig, + "buttoncolor3", + self.buttoncolorbutton3, + ), + name="buttoncolorbutton3", + parent=self, + ), + ), + ], + [ + "按钮大小", + D_getspinbox(5, 100, globalconfig, "buttonsize2"), + ], + ), ), - 2, - ), + 0, + "group", + ) ], [ - ("圆角_半径", 4), ( - D_getspinbox( - 0, - 100, - globalconfig, - "yuanjiao_r", - callback=lambda _: gobject.baseobject.translation_ui.set_color_transparency(), + dict( + title="主题", + grid=( + [ + "明暗", + D_getsimplecombobox( + _TRL(["跟随系统", "明亮", "黑暗"]), + globalconfig, + "darklight2", + lambda _: gobject.baseobject.setcommonstylesheet(), + ), + ], + [ + "明亮主题", + ( + D_getsimplecombobox( + _TRL(["默认"]) + themelist("light"), + globalconfig, + "lighttheme", + functools.partial( + checkthemesettingvisandapply, self, False + ), + ), + functools.partial(createbtnthemelight, self), + ), + ], + [ + "黑暗主题", + ( + D_getsimplecombobox( + themelist("dark"), + globalconfig, + "darktheme", + functools.partial( + checkthemesettingvisandapply, self, True + ), + ), + functools.partial(createbtnthemedark, self), + ), + ], + ), ), - 2, - ), - ], - [], - [ - ("明暗", 4), - ( - D_getsimplecombobox( - _TRL(["跟随系统", "明亮", "黑暗"]), - globalconfig, - "darklight2", - lambda _: gobject.baseobject.setcommonstylesheet(), - ), - 5, - ), + 0, + "group", + ) ], [ - ("明亮主题", 4), ( - D_getsimplecombobox( - _TRL(["默认"]) + themelist("light"), - globalconfig, - "lighttheme", - functools.partial(checkthemesettingvisandapply, self, False), + dict( + title="窗口特效", + grid=( + [ + "翻译窗口", + D_getsimplecombobox( + ["Disable", "Acrylic", "Aero"], + globalconfig, + "WindowEffect", + callback=lambda _: [ + gobject.baseobject.translation_ui.set_color_transparency(), + gobject.baseobject.translation_ui.seteffect(), + ], + ), + ], + [ + "其他", + D_getsimplecombobox( + ["Solid", "Acrylic", "Mica", "MicaAlt"], + globalconfig, + "WindowBackdrop", + callback=lambda _: gobject.baseobject.setcommonstylesheet(), + ), + ], + ), ), - 5, - ), - (functools.partial(createbtnthemelight, self), 0), - ], - [ - ("黑暗主题", 4), - ( - D_getsimplecombobox( - themelist("dark"), - globalconfig, - "darktheme", - functools.partial(checkthemesettingvisandapply, self, True), - ), - 5, - ), - (functools.partial(createbtnthemedark, self), 0), - ], - [], - [ - ("窗口特效_翻译窗口", 4), - ( - D_getsimplecombobox( - ["Disable", "Acrylic", "Aero"], - globalconfig, - "WindowEffect", - callback=lambda _: [ - gobject.baseobject.translation_ui.set_color_transparency(), - gobject.baseobject.translation_ui.seteffect(), - ], - ), - 5, - ), - ], - [ - ("窗口特效_其他", 4), - ( - D_getsimplecombobox( - ["Solid", "Acrylic", "Mica", "MicaAlt"], - globalconfig, - "WindowBackdrop", - callback=lambda _: gobject.baseobject.setcommonstylesheet(), - ), - 5, - ), + 0, + "group", + ) ], ] return uigrid diff --git a/LunaTranslator/LunaTranslator/gui/setting_lang.py b/LunaTranslator/LunaTranslator/gui/setting_lang.py index 3bc22a05..af89c83f 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_lang.py +++ b/LunaTranslator/LunaTranslator/gui/setting_lang.py @@ -3,7 +3,7 @@ from myutils.config import globalconfig, _TRL, static_data, getlanguse from gui.usefulwidget import ( D_getsimplecombobox, getsimplecombobox, - D_getcolorbutton, + D_getIconButton, makescrollgrid, ) @@ -35,7 +35,7 @@ def setTablanglz(self): ], [], [ - ("本软件显示语言(重启生效)", 5), + ("软件显示语言_重启生效", 5), ( D_getsimplecombobox( (static_data["language_list_show"]), globalconfig, "languageuse" @@ -43,14 +43,11 @@ def setTablanglz(self): 5, ), ( - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=lambda: os.startfile( os.path.abspath("./files/lang/{}.json".format(getlanguse())) ), icon="fa.gear", - constcolor="#FF69B4", ), 1, ), diff --git a/LunaTranslator/LunaTranslator/gui/setting_textinput.py b/LunaTranslator/LunaTranslator/gui/setting_textinput.py index c4547a21..7d5e2aa6 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_textinput.py +++ b/LunaTranslator/LunaTranslator/gui/setting_textinput.py @@ -18,7 +18,8 @@ from gui.inputdialog import regexedit from gui.usefulwidget import ( D_getsimplecombobox, D_getspinbox, - D_getcolorbutton, + D_getIconButton, + getIconButton, makegrid, yuitsu_switch, getvboxwidget, @@ -26,10 +27,24 @@ from gui.usefulwidget import ( makesubtab_lazy, makescrollgrid, FocusCombo, - FocusFontCombo + FocusFontCombo, ) +def __create(self): + self.selectbutton = getIconButton( + gobject.baseobject.createattachprocess, icon="fa.gear" + ) + return self.selectbutton + + +def __create2(self): + self.selecthookbutton = getIconButton( + lambda: gobject.baseobject.hookselectdialog.showsignal.emit(), icon="fa.gear" + ) + return self.selecthookbutton + + def gethookgrid(self): grids = [ @@ -40,28 +55,12 @@ def gethookgrid(self): [], [ ("选择游戏", 5), - D_getcolorbutton( - globalconfig, - "", - gobject.baseobject.createattachprocess, - name="selectbutton", - parent=self, - icon="fa.gear", - constcolor="#FF69B4", - ), + functools.partial(__create, self), ("", 5), ], [ ("选择文本", 5), - D_getcolorbutton( - globalconfig, - "", - lambda: gobject.baseobject.hookselectdialog.showsignal.emit(), - name="selecthookbutton", - parent=self, - icon="fa.gear", - constcolor="#FF69B4", - ), + functools.partial(__create2, self), ], [], [ @@ -71,92 +70,101 @@ def gethookgrid(self): [ ("已保存游戏", 5), ( - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( lambda: dialog_savedgame_integrated(self), icon="fa.gamepad", - constcolor="#FF69B4", ), 1, ), ], [], [ - ("代码页", 5), ( - D_getsimplecombobox( - _TRL(static_data["codepage_display"]), - globalconfig, - "codepage_index", - lambda x: gobject.baseobject.textsource.setsettings(), + dict( + title="默认设置", + type="grid", + grid=( + [ + "代码页", + ( + D_getsimplecombobox( + _TRL(static_data["codepage_display"]), + globalconfig, + "codepage_index", + lambda x: gobject.baseobject.textsource.setsettings(), + ), + 4, + ), + ], + [ + "移除非选定hook", + D_getsimpleswitch(globalconfig, "removeuseless"), + ], + [ + "过滤反复刷新的句子", + D_getsimpleswitch(globalconfig, "direct_filterrepeat"), + ], + [ + "刷新延迟(ms)", + ( + D_getspinbox( + 0, + 10000, + globalconfig, + "textthreaddelay", + callback=lambda x: gobject.baseobject.textsource.setsettings(), + ), + 2, + ), + ], + [ + "最大缓冲区长度", + ( + D_getspinbox( + 0, + 1000000, + globalconfig, + "maxBufferSize", + callback=lambda x: gobject.baseobject.textsource.setsettings(), + ), + 2, + ), + ], + [ + "最大缓存文本长度", + ( + D_getspinbox( + 0, + 1000000000, + globalconfig, + "maxHistorySize", + callback=lambda x: gobject.baseobject.textsource.setsettings(), + ), + 2, + ), + ], + [ + "过滤包含乱码的文本行", + D_getsimpleswitch(globalconfig, "filter_chaos_code"), + D_getIconButton( + icon="fa.gear", + callback=lambda: codeacceptdialog(self), + ), + ], + [ + "区分人名和文本", + D_getsimpleswitch(globalconfig, "allow_set_text_name"), + ], + [ + "使用YAPI注入", + D_getsimpleswitch(globalconfig, "use_yapi"), + ], + ), ), - 8, - ), + 0, + "group", + ) ], - [ - ("移除非选定hook", 5), - (D_getsimpleswitch(globalconfig, "removeuseless"), 1), - ], - [ - ("过滤反复刷新的句子", 5), - (D_getsimpleswitch(globalconfig, "direct_filterrepeat"), 1), - ], - [ - ("刷新延迟(ms)", 5), - ( - D_getspinbox( - 0, - 10000, - globalconfig, - "textthreaddelay", - callback=lambda x: gobject.baseobject.textsource.setsettings(), - ), - 3, - ), - ], - [ - ("最大缓冲区长度", 5), - ( - D_getspinbox( - 0, - 1000000, - globalconfig, - "maxBufferSize", - callback=lambda x: gobject.baseobject.textsource.setsettings(), - ), - 3, - ), - ], - [ - ("最大缓存文本长度", 5), - ( - D_getspinbox( - 0, - 1000000000, - globalconfig, - "maxHistorySize", - callback=lambda x: gobject.baseobject.textsource.setsettings(), - ), - 3, - ), - ], - [ - ("过滤包含乱码的文本行", 5), - (D_getsimpleswitch(globalconfig, "filter_chaos_code"), 1), - ( - D_getcolorbutton( - globalconfig, - "", - icon="fa.gear", - constcolor="#FF69B4", - callback=lambda: codeacceptdialog(self), - ), - 1, - ), - ], - [("区分人名和文本", 5), D_getsimpleswitch(globalconfig, "allow_set_text_name")], - [("使用YAPI注入", 5), D_getsimpleswitch(globalconfig, "use_yapi")], ] return grids @@ -288,12 +296,9 @@ def gethookembedgrid(self): grids = [ [ ("导出翻译补丁", 5), - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=lambda x: exportchspatch(self), icon="fa.gear", - constcolor="#FF69B4", ), ], [], @@ -379,14 +384,11 @@ def gethookembedgrid(self): [ ("内嵌安全性检查", 5), D_getsimpleswitch(globalconfig["embedded"], "safecheck_use"), - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=lambda x: regexedit( self, globalconfig["embedded"]["safecheckregexs"] ), icon="fa.gear", - constcolor="#FF69B4", ), ], ] @@ -409,40 +411,58 @@ def getTabclip(self): def outputgrid(self): grids = [ - [("自动输出提取的文本", 15)], + ["自动输出提取的文本"], [], - [("剪贴板", 0)], [ - "", - ("输出到剪贴板", 5), - (D_getsimpleswitch(globalconfig["textoutputer"]["clipboard"], "use"), 1), - ], - [("WebSocket", -1)], - [ - "", - ("输出到WebSocket", 5), ( - D_getsimpleswitch( - globalconfig["textoutputer"]["websocket"], - "use", - callback=lambda _: gobject.baseobject.startoutputer_re("websocket"), + dict( + title="剪贴板", + grid=( + [ + "自动输出", + D_getsimpleswitch( + globalconfig["textoutputer"]["clipboard"], "use" + ), + ], + ), ), - 1, - ), + 0, + "group", + ) ], + [], [ - "", - ("端口号", 5), ( - D_getspinbox( - 0, - 65535, - globalconfig["textoutputer"]["websocket"], - "port", - callback=lambda _: gobject.baseobject.startoutputer_re("websocket"), + dict( + title="WebSocket", + grid=( + [ + "自动输出", + D_getsimpleswitch( + globalconfig["textoutputer"]["websocket"], + "use", + callback=lambda _: gobject.baseobject.startoutputer_re( + "websocket" + ), + ), + ], + [ + "端口号", + D_getspinbox( + 0, + 65535, + globalconfig["textoutputer"]["websocket"], + "port", + callback=lambda _: gobject.baseobject.startoutputer_re( + "websocket" + ), + ), + ], + ), ), - 3, - ), + 0, + "group", + ) ], ] return grids diff --git a/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py b/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py index 84fa57fa..b1b518de 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py +++ b/LunaTranslator/LunaTranslator/gui/setting_textinput_ocr.py @@ -1,13 +1,14 @@ from qtsymbols import * import functools, os import gobject -from myutils.config import globalconfig, ocrsetting, _TRL, ocrerrorfix +from myutils.config import globalconfig, ocrsetting, _TRL, ocrerrorfix, _TR from gui.inputdialog import autoinitdialog, postconfigdialog, autoinitdialog_items from gui.usefulwidget import ( D_getsimplecombobox, D_getspinbox, - D_getcolorbutton, + D_getIconButton, yuitsu_switch, + D_getcolorbutton, D_getsimpleswitch, selectcolor, ) @@ -26,6 +27,7 @@ def __label2(self): def getocrgrid(self): grids = [] + grids_source = [] i = 0 self.ocrswitchs = {} @@ -37,14 +39,11 @@ def getocrgrid(self): continue if name in ocrsetting: items = autoinitdialog_items(ocrsetting[name]) - _3 = D_getcolorbutton( - globalconfig, - "", + _3 = D_getIconButton( callback=functools.partial( autoinitdialog, self, globalconfig["ocr"][name]["name"], 800, items ), icon="fa.gear", - constcolor="#FF69B4", ) else: @@ -73,145 +72,223 @@ def getocrgrid(self): _3, ] if i % 3 == 2: - grids.append(line) + grids_source.append(line) line = [] else: line += [""] i += 1 if len(line): - grids.append(line) + grids_source.append(line) + + def vissolvebtn(text): + _ = QPushButton() + _.setText(text) + _.clicked.connect(gobject.baseobject.createshowocrimage) + return _ grids += [ - [], - [(("竖向OCR识别"), 12), D_getsimpleswitch(globalconfig, "verticalocr")], - [(("合并多行识别结果"), 12), D_getsimpleswitch(globalconfig, "ocrmergelines")], - [], [ - ("OCR预处理方法", 8), ( - D_getsimplecombobox( - _TRL(["不处理", "灰度化", "阈值二值化", "OTSU二值化"]), - globalconfig, - "ocr_presolve_method", - ), - 12, - ), - "", - ], - [ - ("查看处理效果", 6), - D_getcolorbutton( - globalconfig, - "", - gobject.baseobject.createshowocrimage, - icon="fa.picture-o", - constcolor="#FF69B4", - ), - "", - (("二值化阈值"), 8), - (D_getspinbox(0, 255, globalconfig, "binary_thresh"), 4), + dict(title="引擎", type="grid", grid=grids_source), + 0, + "group", + ) ], [], - [ - ("OCR自动化方法", 8), - ( - D_getsimplecombobox( - _TRL(["分析图像更新", "周期执行", "分析图像更新+周期执行"]), - globalconfig, - "ocr_auto_method", - ), - 12, - ), - ], - [ - (("执行周期(s)"), 8), - ( - D_getspinbox( - 0.1, 100, globalconfig, "ocr_interval", double=True, step=0.1 - ), - 4, - ), - ], - [ - (("图像稳定性阈值"), 8), - ( - D_getspinbox( - 0, 1, globalconfig, "ocr_stable_sim", double=True, step=0.01, dec=3 - ), - 4, - ), - (functools.partial(__label1, self), 0), - ], - [ - (("图像一致性阈值"), 8), - ( - D_getspinbox( - 0, 1, globalconfig, "ocr_diff_sim", double=True, step=0.01, dec=3 - ), - 4, - ), - (functools.partial(__label2, self), 0), - ], - [ - (("文本相似度阈值"), 8), - (D_getspinbox(0, 100000, globalconfig, "ocr_text_diff"), 4), - ], - [], - [(("多重区域模式"), 12), D_getsimpleswitch(globalconfig, "multiregion")], - [(("记忆选定区域"), 12), D_getsimpleswitch(globalconfig, "rememberocrregions")], + [("竖向识别"), D_getsimpleswitch(globalconfig, "verticalocr"), ("", 4)], [], [ - (("OCR范围框颜色"), 12), ( - D_getcolorbutton( - globalconfig, - "ocrrangecolor", - callback=lambda: selectcolor( - self, - globalconfig, - "ocrrangecolor", - self.ocrrangecolor_button, - callback=lambda: gobject.baseobject.textsource.setstyle(), - ), - name="ocrrangecolor_button", - parent=self, + dict( + title="预处理", + type="grid", + grid=[ + [ + "预处理方法", + D_getsimplecombobox( + _TRL(["不处理", "灰度化", "阈值二值化", "OTSU二值化"]), + globalconfig, + "ocr_presolve_method", + ), + functools.partial(vissolvebtn, _TR("查看处理效果")), + ], + [ + "二值化阈值", + D_getspinbox(0, 255, globalconfig, "binary_thresh"), + ], + ], ), - 1, - ), + 0, + "group", + ) ], [ - (("OCR范围框宽度"), 12), ( - D_getspinbox( - 1, - 100, - globalconfig, - "ocrrangewidth", - callback=lambda x: gobject.baseobject.textsource.setstyle(), + dict( + title="后处理", + type="grid", + grid=[ + [ + (("合并多行识别结果"), 12), + D_getsimpleswitch(globalconfig, "ocrmergelines"), + ("", 12), + ], + [ + (("易错内容修正"), 12), + D_getsimpleswitch(ocrerrorfix, "use"), + D_getIconButton( + callback=functools.partial( + postconfigdialog, + self, + ocrerrorfix["args"], + "易错内容修正", + ), + icon="fa.gear", + ), + ], + ], ), - 4, - ), + 0, + "group", + ) ], [ - (("选取OCR范围后立即进行一次识别"), 12), - D_getsimpleswitch(globalconfig, "ocrafterrangeselect"), - ], - [ - (("选取OCR范围后显示范围框"), 12), - D_getsimpleswitch(globalconfig, "showrangeafterrangeselect"), - ], - [ - (("OCR识别易错内容修正"), 12), - D_getsimpleswitch(ocrerrorfix, "use"), - D_getcolorbutton( - globalconfig, - "", - callback=functools.partial( - postconfigdialog, self, ocrerrorfix["args"], "OCR识别易错内容修正" + ( + dict( + title="自动化执行", + type="grid", + grid=[ + [ + ("自动化执行方法", 8), + ( + D_getsimplecombobox( + _TRL( + [ + "分析图像更新", + "周期执行", + "分析图像更新+周期执行", + ] + ), + globalconfig, + "ocr_auto_method", + ), + 12, + ), + ], + [ + (("执行周期(s)"), 8), + ( + D_getspinbox( + 0.1, + 100, + globalconfig, + "ocr_interval", + double=True, + step=0.1, + ), + 4, + ), + ], + [ + (("图像稳定性阈值"), 8), + ( + D_getspinbox( + 0, + 1, + globalconfig, + "ocr_stable_sim", + double=True, + step=0.01, + dec=3, + ), + 4, + ), + (functools.partial(__label1, self), 0), + ], + [ + (("图像一致性阈值"), 8), + ( + D_getspinbox( + 0, + 1, + globalconfig, + "ocr_diff_sim", + double=True, + step=0.01, + dec=3, + ), + 4, + ), + (functools.partial(__label2, self), 0), + ], + [ + (("文本相似度阈值"), 8), + (D_getspinbox(0, 100000, globalconfig, "ocr_text_diff"), 4), + ], + ], ), - icon="fa.gear", - constcolor="#FF69B4", - ), + 0, + "group", + ) + ], + [ + ( + dict( + title="其他", + type="grid", + grid=[ + [ + "多重区域模式", + D_getsimpleswitch(globalconfig, "multiregion"), + ], + [ + "记忆选定区域", + D_getsimpleswitch(globalconfig, "rememberocrregions"), + ], + [ + "范围框颜色", + D_getcolorbutton( + globalconfig, + "ocrrangecolor", + callback=lambda: selectcolor( + self, + globalconfig, + "ocrrangecolor", + self.ocrrangecolor_button, + callback=lambda: gobject.baseobject.textsource.setstyle(), + ), + name="ocrrangecolor_button", + parent=self, + ), + ], + [ + "范围框宽度", + ( + D_getspinbox( + 1, + 100, + globalconfig, + "ocrrangewidth", + callback=lambda x: gobject.baseobject.textsource.setstyle(), + ), + 2, + ), + ], + [ + "选取OCR范围后立即进行一次识别", + D_getsimpleswitch(globalconfig, "ocrafterrangeselect"), + ], + [ + "选取OCR范围后显示范围框", + D_getsimpleswitch( + globalconfig, "showrangeafterrangeselect" + ), + ], + ], + ), + 0, + "group", + ) ], ] return grids diff --git a/LunaTranslator/LunaTranslator/gui/setting_translate.py b/LunaTranslator/LunaTranslator/gui/setting_translate.py index 012edb4d..ac1d54d9 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_translate.py +++ b/LunaTranslator/LunaTranslator/gui/setting_translate.py @@ -11,7 +11,7 @@ from gui.inputdialog import autoinitdialog, autoinitdialog_items from gui.usefulwidget import ( D_getspinbox, getspinbox, - D_getcolorbutton, + D_getcolorbutton,D_getIconButton, D_getsimpleswitch, selectcolor, makegrid, @@ -44,9 +44,7 @@ def initsome11(self, l, label=None): if fanyi in translatorsetting: items = autoinitdialog_items(translatorsetting[fanyi]) - last = D_getcolorbutton( - globalconfig, - "", + last = D_getIconButton( callback=functools.partial( autoinitdialog, self, @@ -54,16 +52,12 @@ def initsome11(self, l, label=None): 800, items, ), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) elif fanyi == "selfbuild": - last = D_getcolorbutton( - globalconfig, - "", + last = D_getIconButton( callback=lambda: selectdebugfile("./userconfig/selfbuild.py"), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) else: last = "" @@ -255,14 +249,11 @@ def setTabTwo_lazy(self, basel): [ ("Chromium_路径", 8), ( - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=functools.partial( autoinitdialog, self, "Chromium_路径", 800, _items ), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) ), ], diff --git a/LunaTranslator/LunaTranslator/gui/setting_transopti.py b/LunaTranslator/LunaTranslator/gui/setting_transopti.py index b805306a..ad966bcc 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_transopti.py +++ b/LunaTranslator/LunaTranslator/gui/setting_transopti.py @@ -13,9 +13,9 @@ from myutils.config import ( _TRL, ) from gui.codeacceptdialog import codeacceptdialog -from gui.usefulwidget import ( - getcolorbutton, - D_getcolorbutton, +from gui.usefulwidget import ( + D_getIconButton, + getIconButton, D_getsimpleswitch, makescrollgrid, getvboxwidget, @@ -42,12 +42,9 @@ def getcomparelayout(self): layout = QHBoxLayout() fromtext = QPlainTextEdit() totext = QPlainTextEdit() - solvebutton = getcolorbutton( - globalconfig, - "", + solvebutton = getIconButton( callback=lambda: totext.setPlainText(POSTSOLVE(fromtext.toPlainText())), - icon="fa.chevron-right", - constcolor="#FF69B4", + icon="fa.chevron-right", ) layout.addWidget(fromtext) @@ -100,22 +97,16 @@ def setTab7_lazy(self, basel): for i, post in enumerate(sortlist): if post == "_11": - config = D_getcolorbutton( - globalconfig, - "", + config = D_getIconButton( callback=lambda: selectdebugfile("./userconfig/mypost.py"), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) else: if post not in postprocessconfig: continue if post == "_remove_chaos": - config = D_getcolorbutton( - globalconfig, - "", - icon="fa.gear", - constcolor="#FF69B4", + config = D_getIconButton( + icon="fa.gear", callback=lambda: codeacceptdialog(self), ) elif "args" in postprocessconfig[post]: @@ -135,29 +126,20 @@ def setTab7_lazy(self, basel): 600, items, ) - config = D_getcolorbutton( - globalconfig, - "", + config = D_getIconButton( callback=callback, - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) else: config = "" - button_up = D_getcolorbutton( - globalconfig, - "", + button_up = D_getIconButton( callback=functools.partial(changerank, post, True), - icon="fa.arrow-up", - constcolor="#FF69B4", + icon="fa.arrow-up", ) - button_down = D_getcolorbutton( - globalconfig, - "", + button_down = D_getIconButton( callback=functools.partial(changerank, post, False), - icon="fa.arrow-down", - constcolor="#FF69B4", + icon="fa.arrow-down", ) l = [ @@ -178,17 +160,14 @@ def setTab7_lazy(self, basel): ) setting = loadpostsettingwindowmethod(name) - def __(_f, _1, _2): + def __(_f, _1): return _f(_1) if setting: grids2[-1].append( - D_getcolorbutton( - globalconfig, - "", + D_getIconButton( callback=functools.partial(__, setting, self), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) ) grids2 += [[("", 12)]] diff --git a/LunaTranslator/LunaTranslator/gui/setting_tts.py b/LunaTranslator/LunaTranslator/gui/setting_tts.py index f9c068e0..1b2a1c61 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_tts.py +++ b/LunaTranslator/LunaTranslator/gui/setting_tts.py @@ -7,7 +7,7 @@ from gui.usefulwidget import ( D_getsimplecombobox, D_getspinbox, makescrollgrid, - D_getcolorbutton, + D_getIconButton, yuitsu_switch, FocusCombo, D_getsimpleswitch, @@ -65,9 +65,7 @@ def getttsgrid(self): if "args" in globalconfig["reader"][name]: items = autoinitdialog_items(globalconfig["reader"][name]) items[-1]["callback"] = gobject.baseobject.startreader - _3 = D_getcolorbutton( - globalconfig, - "", + _3 = D_getIconButton( callback=functools.partial( autoinitdialog, self, @@ -75,8 +73,7 @@ def getttsgrid(self): 800, items, ), - icon="fa.gear", - constcolor="#FF69B4", + icon="fa.gear", ) else: @@ -116,61 +113,95 @@ def getttsgrid(self): def setTab5lz(self): - - grids = getttsgrid(self) + grids = [] grids += [ - [], - [("选择声音", 6), (functools.partial(createvoicecombo, self), 15)], [ - ("语速:(-10~10)", 6), - (D_getspinbox(-10, 10, globalconfig["ttscommon"], "rate"), 3), - ], - [ - ("音量:(0~100)", 6), - (D_getspinbox(0, 100, globalconfig["ttscommon"], "volume"), 3), - ], - [("自动朗读", 6), (D_getsimpleswitch(globalconfig, "autoread"), 1)], - [("不被打断", 6), (D_getsimpleswitch(globalconfig, "ttsnointerrupt"), 1)], - [ - ("朗读原文", 6), - (D_getsimpleswitch(globalconfig, "read_raw"), 1), - "", - "", - ("朗读翻译", 6), - (D_getsimpleswitch(globalconfig, "read_trans"), 1), - ], - [ - ("朗读的翻译", 6), ( - D_getsimplecombobox( - _TRL( - [ - globalconfig["fanyi"][x]["name"] - for x in globalconfig["fanyi"] - ] - ), - globalconfig, - "read_translator", - ), - 15, - ), + dict(title="引擎", type="grid", grid=getttsgrid(self)), + 0, + "group", + ) ], - [], [ - ("语音修正", 6), - D_getsimpleswitch(globalconfig["ttscommon"], "tts_repair"), - D_getcolorbutton( - globalconfig, - "", - callback=lambda x: noundictconfigdialog1( - self, - globalconfig["ttscommon"]["tts_repair_regex"], - "语音修正", - ["正则", "原文", "替换"], + ( + dict( + title="声音", + type="grid", + grid=[ + [ + "选择声音", + (functools.partial(createvoicecombo, self), 4), + ], + [ + "语速:(-10~10)", + D_getspinbox(-10, 10, globalconfig["ttscommon"], "rate"), + ], + [ + "音量:(0~100)", + D_getspinbox(0, 100, globalconfig["ttscommon"], "volume"), + ], + ], ), - icon="fa.gear", - constcolor="#FF69B4", - ), + 0, + "group", + ) + ], + [ + ( + dict( + title="行为", + type="grid", + grid=[ + [ + "自动朗读", + D_getsimpleswitch(globalconfig, "autoread"), + ], + [ + "不被打断", + D_getsimpleswitch(globalconfig, "ttsnointerrupt"), + ], + [ + "朗读原文", + D_getsimpleswitch(globalconfig, "read_raw"), + ], + [ + "朗读翻译", + D_getsimpleswitch(globalconfig, "read_trans"), + ], + [ + "朗读的翻译", + ( + D_getsimplecombobox( + _TRL( + [ + globalconfig["fanyi"][x]["name"] + for x in globalconfig["fanyi"] + ] + ), + globalconfig, + "read_translator", + ), + 4, + ), + ], + [ + "语音修正", + D_getsimpleswitch(globalconfig["ttscommon"], "tts_repair"), + D_getIconButton( + callback=lambda x: noundictconfigdialog1( + self, + globalconfig["ttscommon"]["tts_repair_regex"], + "语音修正", + ["正则", "原文", "替换"], + ), + icon="fa.gear", + ), + ], + ], + ), + 0, + "group", + ) ], ] return grids diff --git a/LunaTranslator/LunaTranslator/gui/showword.py b/LunaTranslator/LunaTranslator/gui/showword.py index c29f705f..c65bc6eb 100644 --- a/LunaTranslator/LunaTranslator/gui/showword.py +++ b/LunaTranslator/LunaTranslator/gui/showword.py @@ -21,8 +21,8 @@ from gui.usefulwidget import ( listediterline, getsimpleswitch, getsimplekeyseq, - getcolorbutton, makesubtab_lazy, + getIconButton, tabadd_lazy, ) @@ -502,14 +502,11 @@ class AnkiWindow(QWidget): self.audiopath, recordbtn1, soundbutton, - getcolorbutton( - "", - "", + getIconButton( functools.partial( self.selecfile, self.audiopath ), icon="fa.gear", - constcolor="#FF69B4", ), ] ), @@ -519,14 +516,11 @@ class AnkiWindow(QWidget): self.audiopath_sentence, recordbtn2, soundbutton2, - getcolorbutton( - "", - "", + getIconButton( functools.partial( self.selecfile, self.audiopath_sentence ), icon="fa.gear", - constcolor="#FF69B4", ), ] ), @@ -535,14 +529,11 @@ class AnkiWindow(QWidget): QLabel(_TR("截图")), self.editpath, cropbutton, - getcolorbutton( - "", - "", + getIconButton( functools.partial( self.selecfile, self.editpath ), icon="fa.gear", - constcolor="#FF69B4", ), ] ), @@ -737,7 +728,8 @@ class searchwordW(closeashidewindow): def showresfun(self, timestamp, k, res): if self.current != timestamp: return - self.cache_results[k] = res + if res is None: + self.cache_results[k] = res thisp = globalconfig["cishu"][k]["args"]["priority"] idx = 0 @@ -783,7 +775,9 @@ class searchwordW(closeashidewindow): soundbutton.clicked.connect(self.langdu) self.searchlayout.addWidget(soundbutton) - ankiconnect = statusbutton(icons=["fa.adn"], colors=["", "#FF69B4"]) + ankiconnect = statusbutton( + icons=["fa.adn"], colors=["", globalconfig["buttoncolor2"]] + ) ankiconnect.statuschanged2.connect(self.onceaddankiwindow) self.searchlayout.addWidget(ankiconnect) diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index c7f3d406..126c8f98 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -16,6 +16,14 @@ from gui.edittext import edittrans from gui.dialog_savedgame import browserdialog, dialog_savedgame_integrated +def contrastcolor(color): + color = QColor(globalconfig["buttoncolor"]) + r, g, b, a = color.getRgb() + + r, g, b = [hex((_ + 128) % 256)[2:] for _ in (r, g, b)] + return f"#{r}{g}{b}" + + class QUnFrameWindow(resizableframeless): displayglobaltooltip = pyqtSignal(str) displayres = pyqtSignal(dict) @@ -248,13 +256,14 @@ class QUnFrameWindow(resizableframeless): "bindwindow": self.isbindedwindow, "keepontop": globalconfig["keepontop"], } - onstatecolor = "#FF69B4" self._TitleLabel.setFixedHeight(int(globalconfig["buttonsize"] * 1.5)) for name in self.buttons: if name in colorstate: color = ( - onstatecolor if colorstate[name] else globalconfig["buttoncolor"] + contrastcolor(globalconfig["buttoncolor"]) + if colorstate[name] + else globalconfig["buttoncolor"] ) else: color = globalconfig["buttoncolor"] @@ -431,7 +440,6 @@ class QUnFrameWindow(resizableframeless): windows.SetForegroundWindow(int(self.winId())) def aftershowdosomething(self): - self.showline(clear=True, text=_TR("欢迎使用"), origin=False) windows.SetForegroundWindow(int(self.winId())) self.refreshtoolicon() @@ -584,6 +592,7 @@ class QUnFrameWindow(resizableframeless): self.initvalues() self.initsignals() self._TitleLabel = QLabel(self) + self._TitleLabel.setMouseTracking(True) self.addbuttons() self.translate_text = Textbrowser(self) self.translate_text.contentsChanged.connect(self.textAreaChanged) @@ -827,16 +836,19 @@ class QUnFrameWindow(resizableframeless): def textAreaChanged(self, size: QSize): - if globalconfig["fixedheight"]: - return if self.translate_text.cleared: return - newHeight = size.height() + self.translate_text._padding - width = self.width() - self.resize( - width, - int(newHeight + globalconfig["buttonsize"] * 1.5), + if not (globalconfig["auto_expand"] or globalconfig["auto_shrink"]): + return + newHeight = ( + size.height() + + self.translate_text._padding + + int(globalconfig["buttonsize"] * 1.5) ) + if (newHeight > self.height() and globalconfig["auto_expand"]) or ( + newHeight < self.height() and globalconfig["auto_shrink"] + ): + self.resize(self.width(), newHeight) def clickRange(self, auto): if globalconfig["sourcestatus2"]["ocr"]["use"] == False: diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index e388c7fc..de942a55 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -176,20 +176,174 @@ class closeashidewindow(saveposwindow): super().closeEvent(event) -class MySwitch(QPushButton): - def __init__( - self, parent=None, sign=True, enable=True, icons=None, size=25, colors=None - ): +class MySwitch(QWidget): + clicked = pyqtSignal(bool) + + def sizeHint(self): + return QSize( + int(1.62 * globalconfig["buttonsize2"]), globalconfig["buttonsize2"] + ) + + def __init__(self, parent=None, sign=True, enable=True): + super().__init__(parent) + self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) + self.checked = sign + self.setCursor(Qt.CursorShape.PointingHandCursor) + self.animation = QVariantAnimation() + self.animation.setDuration(80) + self.animation.setStartValue(0) + self.animation.setEndValue(20) + self.__currv = 0 + if sign: + self.__currv = 20 + self.animation.valueChanged.connect(self.update11) + self.animation.finished.connect(self.onAnimationFinished) + self.enable = enable + + def setEnabled(self, enable): + self.enable = enable + self.update() + + def isEnabled(self): + return self.enable + + def isChecked(self): + return self.checked + + def setChecked(self, check): + if check == self.checked: + return + self.checked = check + self.animation.setDirection( + QVariantAnimation.Direction.Forward + if self.checked + else QVariantAnimation.Direction.Backward + ) + self.animation.start() + + def update11(self): + self.__currv = self.animation.currentValue() + self.update() + + def paintEvent(self, event): + painter = QPainter(self) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.setPen(Qt.PenStyle.NoPen) + + __ = QColor( + [globalconfig["buttoncolor3"], globalconfig["buttoncolor2"]][self.checked] + ) + if not self.enable: + __ = QColor( + max(0, (__.red() - 64)), + max( + 0, + (__.green() - 64), + ), + max(0, (__.blue() - 64)), + ) + painter.setBrush(__) + bigw = self.size().width() - self.sizeHint().width() + bigh = self.size().height() - self.sizeHint().height() + x = bigw // 2 + y = bigh // 2 + painter.drawRoundedRect( + QRect(x, y, self.sizeHint().width(), self.sizeHint().height()), + self.sizeHint().height() // 2, + self.sizeHint().height() // 2, + ) + + offset = int( + self.__currv * (self.sizeHint().width() - self.sizeHint().height()) / 20 + ) + painter.setBrush(QColor(255, 255, 255)) + painter.drawEllipse( + QPoint( + x + self.sizeHint().height() // 2 + offset, + y + self.sizeHint().height() // 2, + ), + self.sizeHint().height() * 0.35, + self.sizeHint().height() * 0.35, + ) + + def mouseReleaseEvent(self, event) -> None: + if not self.enable: + return + if event.button() == Qt.MouseButton.LeftButton: + self.checked = not self.checked + self.clicked.emit(self.checked) + self.animation.setDirection( + QVariantAnimation.Direction.Forward + if self.checked + else QVariantAnimation.Direction.Backward + ) + self.animation.start() + + def onAnimationFinished(self): + pass + + +class IconButton(QWidget): + clicked = pyqtSignal() + + def sizeHint(self): + return QSize( + int(1.42 * globalconfig["buttonsize2"]), + int(1.42 * globalconfig["buttonsize2"]), + ) + + def __init__(self, icon, enable=True, qicon=None, parent=None): + super().__init__(parent) + self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed) + self.enable = enable + self._icon = icon + self._qicon = qicon + + def setEnabled(self, enable): + self.enable = enable + self.update() + + def isEnabled(self): + return self.enable + + def paintEvent(self, event): + painter = QPainter(self) + painter.setRenderHint(QPainter.RenderHint.Antialiasing) + painter.setPen(Qt.PenStyle.NoPen) + if self._qicon: + icon = self._qicon + + else: + + __ = QColor(globalconfig["buttoncolor2"]) + if not self.enable: + __ = QColor( + max(0, (__.red() - 64)), + max( + 0, + (__.green() - 64), + ), + max(0, (__.blue() - 64)), + ) + icon: QIcon = qtawesome.icon(self._icon, color=__) + bigw = self.size().width() - self.sizeHint().width() + bigh = self.size().height() - self.sizeHint().height() + x = bigw // 2 + y = bigh // 2 + painter.drawPixmap(x, y, icon.pixmap(self.sizeHint())) + + def mouseReleaseEvent(self, event) -> None: + if not self.enable: + return + if event.button() == Qt.MouseButton.LeftButton: + self.clicked.emit() + + +class MySwitch2(QPushButton): + def __init__(self, parent=None, sign=True, enable=True, icons=None, size=25): self.status1 = 0 self.status2 = 0 - if colors is None: - colors = [ - "#7f7f7f", - "#afafaf", - "#FFa9d4", - "#FF69B4", - ] - self.colors = colors + if icons is None: icons = ["fa.times", "fa.check"] self.icons = icons @@ -209,25 +363,37 @@ class MySwitch(QPushButton): self.setCheckable(True) self.setChecked(sign) - def setChecked(self, a0): - super().setChecked(a0) - self.status1 = a0 + def __seticon(self): + + __ = QColor( + [globalconfig["buttoncolor3"], globalconfig["buttoncolor2"]][self.status1] + ) + if not self.status2: + __ = QColor( + max(0, (__.red() - 64)), + max( + 0, + (__.green() - 64), + ), + max(0, (__.blue() - 64)), + ) + color = __ self.setIcon( qtawesome.icon( self.icons[self.status1], - color=self.colors[self.status1 * 2 + self.status2], + color=color, ) ) + def setChecked(self, a0): + super().setChecked(a0) + self.status1 = a0 + self.__seticon() + def setEnabled(self, a0): super().setEnabled(a0) self.status2 = a0 - self.setIcon( - qtawesome.icon( - self.icons[self.status1], - color=self.colors[self.status1 * 2 + self.status2], - ) - ) + self.__seticon() class resizableframeless(saveposwindow): @@ -236,84 +402,103 @@ class resizableframeless(saveposwindow): self.setMouseTracking(True) self._padding = 5 - # 设置鼠标跟踪判断扳机默认值 + self.resetflags() + + def resetflags(self): self._move_drag = False - self._corner_drag = False + self._corner_drag_youxia = False self._bottom_drag = False - self._lcorner_drag = False + self._top_drag = False + self._corner_drag_zuoxia = False self._right_drag = False self._left_drag = False + self._corner_drag_zuoshang = False + self._corner_drag_youshang = False def resizeEvent(self, e): if self._move_drag == False: self._right_rect = [ self.width() - self._padding, - self.width() + 1, - 0, + self.width() + self._padding, + self._padding, + self.height() - self._padding, + ] + self._left_rect = [ + -self._padding, + self._padding, + self._padding, self.height() - self._padding, ] - self._left_rect = [-1, self._padding, 0, self.height() - self._padding] self._bottom_rect = [ self._padding, self.width() - self._padding, self.height() - self._padding, - self.height() + 1, + self.height() + self._padding, ] - self._corner_rect = [ + self._top_rect = [ + self._padding, self.width() - self._padding, - self.width() + 1, - self.height() - self._padding, - self.height() + 1, + -self._padding, + self._padding, ] - self._lcorner_rect = [ - -1, + self._corner_youxia = [ + self.width() - self._padding, + self.width() + self._padding, + self.height() - self._padding, + self.height() + self._padding, + ] + self._corner_zuoxia = [ + -self._padding, self._padding, self.height() - self._padding, - self.height() + 1, + self.height() + self._padding, + ] + + self._corner_youshang = [ + self.width() - self._padding, + self.width() + self._padding, + -self._padding, + self._padding, + ] + + self._corner_zuoshang = [ + -self._padding, + self._padding, + -self._padding, + self._padding, ] super().resizeEvent(e) def mousePressEvent(self, event: QMouseEvent): - # 重写鼠标点击的事件 if isqt5: gpos = event.globalPos() else: gpos = event.globalPosition().toPoint() - if (event.button() == Qt.MouseButton.LeftButton) and ( - isinrect(event.pos(), self._corner_rect) - ): - # 鼠标左键点击右下角边界区域 - self._corner_drag = True - elif (event.button() == Qt.MouseButton.LeftButton) and ( - isinrect(event.pos(), self._right_rect) - ): - # 鼠标左键点击右侧边界区域 + if event.button() != Qt.MouseButton.LeftButton: + return + self.startxp = gpos - self.pos() + self.starty = gpos.y() + self.startx = gpos.x() + self.starth = self.height() + self.startw = self.width() + if isinrect(event.pos(), self._corner_youxia): + self._corner_drag_youxia = True + elif isinrect(event.pos(), self._right_rect): self._right_drag = True - elif (event.button() == Qt.MouseButton.LeftButton) and ( - isinrect(event.pos(), self._left_rect) - ): - # 鼠标左键点击右侧边界区域 + elif isinrect(event.pos(), self._left_rect): self._left_drag = True - self.startxp = gpos - self.pos() - self.startx = gpos.x() - self.startw = self.width() - elif (event.button() == Qt.MouseButton.LeftButton) and ( - isinrect(event.pos(), self._bottom_rect) - ): - # 鼠标左键点击下侧边界区域 + elif isinrect(event.pos(), self._top_rect): + self._top_drag = True + elif isinrect(event.pos(), self._bottom_rect): self._bottom_drag = True - elif (event.button() == Qt.MouseButton.LeftButton) and ( - isinrect(event.pos(), self._lcorner_rect) - ): - # 鼠标左键点击下侧边界区域 - self._lcorner_drag = True - self.startxp = gpos - self.pos() - self.startx = gpos.x() - self.startw = self.width() - # and (event.y() < self._TitleLabel.height()): - elif event.button() == Qt.MouseButton.LeftButton: - # 鼠标左键点击标题栏区域 + elif isinrect(event.pos(), self._corner_zuoxia): + self._corner_drag_zuoxia = True + elif isinrect(event.pos(), self._corner_youshang): + self._corner_drag_youshang = True + elif isinrect(event.pos(), self._corner_zuoshang): + self._corner_drag_zuoshang = True + else: self._move_drag = True self.move_DragPosition = gpos - self.pos() @@ -322,65 +507,78 @@ class resizableframeless(saveposwindow): return super().leaveEvent(a0) def mouseMoveEvent(self, event): - # 判断鼠标位置切换鼠标手势 pos = event.pos() if isqt5: gpos = event.globalPos() else: gpos = event.globalPosition().toPoint() - if self._move_drag == False: - if isinrect(pos, self._corner_rect): - self.setCursor(Qt.CursorShape.SizeFDiagCursor) - elif isinrect(pos, self._lcorner_rect): - self.setCursor(Qt.CursorShape.SizeBDiagCursor) - elif isinrect(pos, self._bottom_rect): - self.setCursor(Qt.CursorShape.SizeVerCursor) - elif isinrect(pos, self._right_rect): - self.setCursor(Qt.CursorShape.SizeHorCursor) - elif isinrect(pos, self._left_rect): - self.setCursor(Qt.CursorShape.SizeHorCursor) - else: - self.setCursor(Qt.CursorShape.ArrowCursor) - if Qt.MouseButton.LeftButton and self._right_drag: - # 右侧调整窗口宽度 + if isinrect(pos, self._corner_youxia): + self.setCursor(Qt.CursorShape.SizeFDiagCursor) + elif isinrect(pos, self._corner_zuoshang): + self.setCursor(Qt.CursorShape.SizeFDiagCursor) + elif isinrect(pos, self._corner_zuoxia): + self.setCursor(Qt.CursorShape.SizeBDiagCursor) + elif isinrect(pos, self._corner_youshang): + self.setCursor(Qt.CursorShape.SizeBDiagCursor) + elif isinrect(pos, self._bottom_rect): + self.setCursor(Qt.CursorShape.SizeVerCursor) + elif isinrect(pos, self._top_rect): + self.setCursor(Qt.CursorShape.SizeVerCursor) + elif isinrect(pos, self._right_rect): + self.setCursor(Qt.CursorShape.SizeHorCursor) + elif isinrect(pos, self._left_rect): + self.setCursor(Qt.CursorShape.SizeHorCursor) + else: + self.setCursor(Qt.CursorShape.ArrowCursor) + if self._right_drag: self.resize(pos.x(), self.height()) - elif Qt.MouseButton.LeftButton and self._left_drag: - # 右侧调整窗口宽度 + elif self._corner_drag_youshang: + self.setGeometry( + self.x(), + (gpos - self.startxp).y(), + pos.x(), + self.starth - (gpos.y() - self.starty), + ) + elif self._corner_drag_zuoshang: + self.setGeometry( + (gpos - self.startxp).x(), + (gpos - self.startxp).y(), + self.startw - (gpos.x() - self.startx), + self.starth - (gpos.y() - self.starty), + ) + + elif self._left_drag: self.setGeometry( (gpos - self.startxp).x(), self.y(), self.startw - (gpos.x() - self.startx), self.height(), ) - # self.resize(pos.x(), self.height()) - elif Qt.MouseButton.LeftButton and self._bottom_drag: - # 下侧调整窗口高度 + elif self._bottom_drag: self.resize(self.width(), event.pos().y()) - elif Qt.MouseButton.LeftButton and self._lcorner_drag: - # 下侧调整窗口高度 + elif self._top_drag: + self.setGeometry( + self.x(), + (gpos - self.startxp).y(), + self.width(), + self.starth - (gpos.y() - self.starty), + ) + elif self._corner_drag_zuoxia: self.setGeometry( (gpos - self.startxp).x(), self.y(), self.startw - (gpos.x() - self.startx), event.pos().y(), ) - elif Qt.MouseButton.LeftButton and self._corner_drag: - # 右下角同时调整高度和宽度 + elif self._corner_drag_youxia: self.resize(pos.x(), pos.y()) - elif Qt.MouseButton.LeftButton and self._move_drag: - # 标题栏拖放窗口位置 + elif self._move_drag: self.move(gpos - self.move_DragPosition) def mouseReleaseEvent(self, QMouseEvent): - # 鼠标释放后,各扳机复位 - self._move_drag = False - self._corner_drag = False - self._bottom_drag = False - self._lcorner_drag = False - self._right_drag = False - self._left_drag = False + self.resetflags() class Prompt_dialog(QDialog): @@ -491,6 +689,20 @@ def D_getspinbox(mini, maxi, d, key, double=False, step=1, callback=None, dec=1) return lambda: getspinbox(mini, maxi, d, key, double, step, callback, dec) +def getIconButton(callback=None, icon="fa.paint-brush", enable=True, qicon=None): + + b = IconButton(icon, enable, qicon) + + if callback: + b.clicked.connect(callback) + + return b + + +def D_getIconButton(callback=None, icon="fa.paint-brush", enable=True, qicon=None): + return lambda: getIconButton(callback, icon, enable, qicon) + + def getcolorbutton( d, key, @@ -509,9 +721,10 @@ def getcolorbutton( b = QPushButton() b.setIcon(qicon) b.setEnabled(enable) - b.setIconSize(QSize(20, 20)) + sz = int(1.42 * globalconfig["buttonsize2"]) + b.setIconSize(QSize(sz, sz)) if sizefixed: - b.setFixedSize(QSize(20, 20)) + b.setFixedSize(QSize(sz, sz)) if transparent: b.setStyleSheet( """background-color: rgba(255, 255, 255, 0); @@ -1058,6 +1271,50 @@ def tabadd_lazy(tab, title, getrealwidgetfunction): tab.addTab(q, title) +def makegroupingrid(args): + lis = args.get("grid") + title = args.get("title", None) + _type = args.get("type", "form") + group = QGroupBox() + if title: + group.setTitle(_TR(title)) + if _type == "grid": + grid = QGridLayout() + group.setLayout(grid) + automakegrid(grid, lis) + elif _type == "form": + lay = QFormLayout() + group.setLayout(lay) + for line in lis: + name, wid = line + if isinstance(wid, tuple) or isinstance(wid, list): + hb = QHBoxLayout() + hb.setContentsMargins(0, 0, 0, 0) + needstretch = False + for w in wid: + if callable(w): + w = w() + if w.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed: + needstretch = True + hb.addWidget(w) + if needstretch: + hb.insertStretch(0) + hb.addStretch() + wid = hb + else: + if callable(wid): + wid = wid() + if wid.sizePolicy().horizontalPolicy() == QSizePolicy.Policy.Fixed: + hb = QHBoxLayout() + hb.setContentsMargins(0, 0, 0, 0) + hb.addStretch(1) + hb.addWidget(wid) + hb.addStretch(1) + wid = hb + lay.addRow(_TR(name), wid) + return group + + def automakegrid(grid: QGridLayout, lis, save=False, savelist=None): maxl = 0 @@ -1097,6 +1354,8 @@ def automakegrid(grid: QGridLayout, lis, save=False, savelist=None): wid = QLabel((wid)) if arg == "link": wid.setOpenExternalLinks(True) + elif arg == "group": + wid = makegroupingrid(wid) if cols > 0: col = cols elif cols == 0: @@ -1389,7 +1648,7 @@ def getsimplepatheditor( e = QLineEdit(text) e.setReadOnly(True) if useiconbutton: - bu = getcolorbutton("", "", None, icon="fa.gear", constcolor="#FF69B4") + bu = getIconButton(icon="fa.gear") else: bu = QPushButton(_TR("选择" + ("文件夹" if isdir else "文件"))) bu.clicked.connect( diff --git a/LunaTranslator/LunaTranslator/myutils/config.py b/LunaTranslator/LunaTranslator/myutils/config.py index 9846d3bc..99b15bb3 100644 --- a/LunaTranslator/LunaTranslator/myutils/config.py +++ b/LunaTranslator/LunaTranslator/myutils/config.py @@ -69,9 +69,8 @@ def getdefaultsavehook(gamepath, title=None): # "mypost":# 设置时再加载 }, "lang_follow_default": True, - #"private_srclang": 0,# 显示时再加载,缺省用global中的键 - #"private_tgtlang": 0, - + # "private_srclang": 0,# 显示时再加载,缺省用global中的键 + # "private_tgtlang": 0, "localeswitcher": 0, "onloadautochangemode2": 0, "needinserthookcode": [], @@ -92,7 +91,7 @@ def getdefaultsavehook(gamepath, title=None): "hooktypeasname": {}, "use_saved_text_process": False, # "searchnoresulttime": 0, - "gamejsonfile": [],#之前是"",后面改成[] + "gamejsonfile": [], # 之前是"",后面改成[] "gamesqlitefile": "", "relationlinks": [], # "vndbtags": [],#->webtags @@ -112,7 +111,6 @@ def getdefaultsavehook(gamepath, title=None): "bgmsid": 0, "dlsiteid": "RJ/VJXXXX", "fanzaid": "", - "title": "", # "imagepath": None, # 封面->imagepath_all[0] # "imagepath_much2": [], # 截图->imagepath_all[1:] @@ -221,6 +219,17 @@ for key in ___: globalconfig["toolbutton"]["rank2"].remove(key) +for group in ["webview", "textbrowser"]: + + if ( + globalconfig["rendertext_using_internal"][group] + not in static_data["textrender"][group] + ): + globalconfig["rendertext_using_internal"][group] = static_data["textrender"][ + group + ][0] + + def getlanguse(): global language, languageshow return static_data["language_list_translator_inner"][language] diff --git a/LunaTranslator/LunaTranslator/qtsymbols.py b/LunaTranslator/LunaTranslator/qtsymbols.py index 866a8896..b90670ab 100644 --- a/LunaTranslator/LunaTranslator/qtsymbols.py +++ b/LunaTranslator/LunaTranslator/qtsymbols.py @@ -1,14 +1,14 @@ try: from PyQt5 import QtSvg from PyQt5.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QAction,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider,QToolTip,QGroupBox - from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent - from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer + from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent + from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer,QRectF,QVariantAnimation isqt5 = True except: #from traceback import print_exc #print_exc() from PyQt6 import QtSvg from PyQt6.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider,QToolTip,QGroupBox - from PyQt6.QtGui import QIconEngine,QIntValidator,QAction,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent - from PyQt6.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer + from PyQt6.QtGui import QIconEngine,QIntValidator,QAction,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent,QWheelEvent,QPaintEvent + from PyQt6.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer,QRectF,QVariantAnimation isqt5 = False \ No newline at end of file diff --git a/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html b/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html new file mode 100644 index 00000000..64e80c2f --- /dev/null +++ b/LunaTranslator/LunaTranslator/rendertext/exampleextrahtml.html @@ -0,0 +1,27 @@ + + + \ No newline at end of file diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/yinying.py b/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/yinying.py deleted file mode 100644 index 59fb6908..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/yinying.py +++ /dev/null @@ -1,15 +0,0 @@ -from qtsymbols import * -from rendertext.internal.textbrowser.normal import TextLine as TextLabel_0 - - -class TextLine(TextLabel_0): - def usingcolor(self): - return QColor(self.config["fillcolor"]) - - def setShadow(self): - font = self.font() - self.setShadow_internal( - self.basecolor, - font.pointSizeF() * self.config["shadowR"], - self.config["shadowforce"], - ) diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/base.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/base.py deleted file mode 100644 index 62331529..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/base.py +++ /dev/null @@ -1,75 +0,0 @@ -from qtsymbols import * -from myutils.config import globalconfig -from dataclasses import dataclass -import uuid - - -@dataclass -class datas: - font_family: str - font_size: float - bold: bool - atcenter: bool - color: str - extra_space: float - - -class base: - - @property - def config(self): - return globalconfig["rendertext"]["webview"][self.typename].get("args", {}) - - def __init__(self, typename, webview, parent) -> None: - self.typename = typename - self.parent = parent - self.webview = webview - - def gen_html__( - self, text, font_family, font_size, bold, atcenter, color, extra_space - ): - self.data_ = datas(font_family, font_size, bold, atcenter, color, extra_space) - return self.gen_html(text, self.data_) - - def gen_html(self, text, data: datas): - raise - - def eval(self, js): - self.parent.testeval(js) - - def bind(self, name, func): - self.webview.bind(name, func) - - def measureH(self, font_family, font_size): - font = QFont() - font.setFamily(font_family) - font.setPointSizeF(font_size) - fmetrics = QFontMetrics(font) - - return fmetrics.height() - - @property - def line_height(self): - if self.data_.extra_space == 0: - return "" - else: - return f"line-height: {self.measureH(self.data_.font_family,self.data_.font_size)+self.data_.extra_space}px;" - - @property - def align(self): - align = "text-align: center;" if self.data_.atcenter else "" - return align - - @property - def fontinfo(self): - bold = "font-weight: bold;" if self.data_.bold else "" - fms = f"font-family: {self.data_.font_family};font-size: {self.data_.font_size}pt;" - return fms + bold - - def getuid(self): - _id = f"luna_{uuid.uuid4()}" - return _id - - def makedivstyle(self, _id, inner, style): - - return f'
{inner}
' diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian0.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian0.py deleted file mode 100644 index 5d5dccb2..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian0.py +++ /dev/null @@ -1,18 +0,0 @@ -from qtsymbols import * -from rendertext.internal.webview.base import base, datas - - -class TextLine(base): - - def gen_html(self, text, data: datas): - _id = self.getuid() - - style = f"""#{_id}{{ - {self.fontinfo} - color:{self.config["fillcolor"]}; - {self.align} - {self.line_height} - -webkit-text-stroke: {self.config['width']}px {data.color}; - }} - """ - return self.makedivstyle(_id, text, style) diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian1.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian1.py deleted file mode 100644 index 510e1707..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian1.py +++ /dev/null @@ -1,37 +0,0 @@ -from qtsymbols import * -from rendertext.internal.webview.base import base, datas - - -class TextLine(base): - - def colorpair(self, color): - return self.config["fillcolor"], color - - def gen_html(self, text, data: datas): - c1, c2 = self.colorpair(data.color) - _id = self.getuid() - _text = text.replace('"', '\\"') - - style = f"""#{_id} .text{{ - {self.fontinfo} - {self.align} - {self.line_height} - }} - #{_id} .stroke {{ - -webkit-text-stroke: {self.config['width']}px {c1}; - position: relative; - }} - #{_id} .stroke::after {{ - content: "{_text}"; - color: {c2}; - position: absolute; - left: 0; - right: 0; - top: 0; - -webkit-text-stroke-width: 0; - }} - """ - text = f"""
- {text} -
""" - return self.makedivstyle(_id, text, style) diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian2.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian2.py deleted file mode 100644 index 1bed9c87..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/miaobian2.py +++ /dev/null @@ -1,8 +0,0 @@ -from qtsymbols import * -from rendertext.internal.webview.miaobian1 import TextLine as TL1 - - -class TextLine(TL1): - - def colorpair(self, color): - return color, self.config["fillcolor"] diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/normal.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/normal.py deleted file mode 100644 index 7e9e1f28..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/normal.py +++ /dev/null @@ -1,17 +0,0 @@ -from qtsymbols import * -from rendertext.internal.webview.base import base, datas - - -class TextLine(base): - - def gen_html(self, text, data: datas): - _id = self.getuid() - - style = f"""#{_id}{{ - {self.fontinfo} - color:{data.color}; - {self.align} - {self.line_height} - }} - """ - return self.makedivstyle(_id, text, style) diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/webview/yinying.py b/LunaTranslator/LunaTranslator/rendertext/internal/webview/yinying.py deleted file mode 100644 index ea4af704..00000000 --- a/LunaTranslator/LunaTranslator/rendertext/internal/webview/yinying.py +++ /dev/null @@ -1,24 +0,0 @@ -from qtsymbols import * -from rendertext.internal.webview.base import base, datas - - -class TextLine(base): - - def gen_html(self, text, data: datas): - _id = self.getuid() - ntimes = "" - for i in range(self.config["shadowforce"]): - ntimes += f"0px 0px {data.font_size*self.config['shadowR']}px {data.color}" - if i == self.config["shadowforce"] - 1: - ntimes += ";" - else: - ntimes += "," - style = f"""#{_id}{{ - {self.fontinfo} - color:{self.config['fillcolor']}; - text-shadow:{ntimes}; - {self.align} - {self.line_height} - }} - """ - return self.makedivstyle(_id, text, style) diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py index 96c034cc..e1872c7b 100644 --- a/LunaTranslator/LunaTranslator/rendertext/textbrowser.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser.py @@ -4,7 +4,7 @@ from myutils.config import globalconfig from rendertext.somefunctions import dataget import gobject, functools, importlib from traceback import print_exc -from rendertext.internal.textbrowser.base import base +from rendertext.textbrowser_imp.base import base class Qlabel_c(QLabel): @@ -109,17 +109,10 @@ class TextBrowser(QWidget, dataget): def resets1(self): self.currenttype = globalconfig["rendertext_using_internal"]["textbrowser"] - try: - __ = importlib.import_module( - f"rendertext.internal.textbrowser.{self.currenttype}" - ) - except: - self.currenttype = globalconfig["rendertext_using_internal"][ - "textbrowser" - ] = list(globalconfig["rendertext"]["textbrowser"].keys())[0] - __ = importlib.import_module( - f"rendertext.internal.textbrowser.{self.currenttype}" - ) + __ = importlib.import_module( + f"rendertext.textbrowser_imp.{self.currenttype}" + ) + self.currentclass = functools.partial(__.TextLine, self.currenttype) def resets(self): diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/base.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py similarity index 79% rename from LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/base.py rename to LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py index 836f423d..6e3874b4 100644 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/base.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/base.py @@ -1,17 +1,6 @@ from qtsymbols import * from myutils.config import globalconfig - -class QGraphicsDropShadowEffect_multi(QGraphicsDropShadowEffect): - def __init__(self, x) -> None: - self.x = x - super().__init__() - - def draw(self, painter) -> None: - for i in range(self.x): - super().draw(painter) - - class base(QLabel): def paintText(self, painter: QPainter): raise Exception @@ -90,18 +79,6 @@ class base(QLabel): def clearShadow(self): self.setGraphicsEffect(None) - def setShadow_internal(self, colorshadow, width=1, deepth=1, trace=False): - - shadow2 = QGraphicsDropShadowEffect_multi(deepth) - if trace: - shadow2.setBlurRadius(width) - shadow2.setOffset(QPointF(width, width)) - else: - shadow2.setBlurRadius(width) - shadow2.setOffset(0) - shadow2.setColor(QColor(colorshadow)) - self.setGraphicsEffect(shadow2) - def text(self): return self._m_text diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian0.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py similarity index 94% rename from LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian0.py rename to LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py index a16e305d..2076c374 100644 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian0.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian0.py @@ -1,5 +1,5 @@ from qtsymbols import * -from rendertext.internal.textbrowser.base import base +from rendertext.textbrowser_imp.base import base class TextLine(base): diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian1.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian1.py similarity index 94% rename from LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian1.py rename to LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian1.py index 94532b07..bf4f4a0e 100644 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian1.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian1.py @@ -1,5 +1,5 @@ from qtsymbols import * -from rendertext.internal.textbrowser.base import base +from rendertext.textbrowser_imp.base import base class TextLine(base): diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian2.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian2.py similarity index 67% rename from LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian2.py rename to LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian2.py index 62284e4d..c3a2a141 100644 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/miaobian2.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/miaobian2.py @@ -1,5 +1,5 @@ from qtsymbols import * -from rendertext.internal.textbrowser.miaobian1 import TextLine as TB1 +from rendertext.textbrowser_imp.miaobian1 import TextLine as TB1 class TextLine(TB1): diff --git a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/normal.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/normal.py similarity index 89% rename from LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/normal.py rename to LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/normal.py index 6ff900aa..81e04056 100644 --- a/LunaTranslator/LunaTranslator/rendertext/internal/textbrowser/normal.py +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/normal.py @@ -1,5 +1,5 @@ from qtsymbols import * -from rendertext.internal.textbrowser.base import base +from rendertext.textbrowser_imp.base import base class TextLine(base): diff --git a/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/yinying.py b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/yinying.py new file mode 100644 index 00000000..2f1315bc --- /dev/null +++ b/LunaTranslator/LunaTranslator/rendertext/textbrowser_imp/yinying.py @@ -0,0 +1,34 @@ +from qtsymbols import * +from rendertext.textbrowser_imp.normal import TextLine as TextLabel_0 + + +class QGraphicsDropShadowEffect_multi(QGraphicsDropShadowEffect): + def __init__(self, x) -> None: + self.x = x + super().__init__() + + def draw(self, painter) -> None: + for i in range(self.x): + super().draw(painter) + + +class TextLine(TextLabel_0): + def usingcolor(self): + return QColor(self.config["fillcolor"]) + + def setShadow_internal(self, colorshadow, width=1, deepth=1): + + shadow2 = QGraphicsDropShadowEffect_multi(deepth) + + shadow2.setBlurRadius(width) + shadow2.setOffset(0) + shadow2.setColor(QColor(colorshadow)) + self.setGraphicsEffect(shadow2) + + def setShadow(self): + font = self.font() + self.setShadow_internal( + self.basecolor, + font.pointSizeF() * self.config["shadowR"], + self.config["shadowforce"], + ) diff --git a/LunaTranslator/LunaTranslator/rendertext/webview.html b/LunaTranslator/LunaTranslator/rendertext/webview.html new file mode 100644 index 00000000..9ee145a2 --- /dev/null +++ b/LunaTranslator/LunaTranslator/rendertext/webview.html @@ -0,0 +1,281 @@ +
+
+
+
+ + + + + + + + \ No newline at end of file diff --git a/LunaTranslator/LunaTranslator/rendertext/webview.py b/LunaTranslator/LunaTranslator/rendertext/webview.py index f6082fad..05c11c86 100644 --- a/LunaTranslator/LunaTranslator/rendertext/webview.py +++ b/LunaTranslator/LunaTranslator/rendertext/webview.py @@ -1,38 +1,14 @@ from PyQt5.QtWidgets import QWidget from qtsymbols import * from rendertext.somefunctions import dataget -import gobject, uuid, json, importlib, base64, os -from urllib.parse import quote, unquote +import gobject, uuid, json, os +from urllib.parse import quote from myutils.config import globalconfig from gui.usefulwidget import WebivewWidget testsavejs = False -# example -def extrastyle(rootdivid): - with open( - r"example.png", - "rb", - ) as ff: - b64 = base64.b64encode(ff.read()).decode("utf-8") - - extra = f"""#{rootdivid}::before - {{ - background-image: url('data:image/jpeg;base64,{b64}') ; - background-size: 100% auto; - opacity: 0.5; - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - z-index: -1; - }}""" - return extra - - class TextBrowser(QWidget, dataget): contentsChanged = pyqtSignal(QSize) @@ -40,65 +16,76 @@ class TextBrowser(QWidget, dataget): self.webivewwidget.resize(event.size().width(), event.size().height()) def __init__(self, parent) -> None: + gobject.refwebview = self super().__init__(parent) self.webivewwidget = WebivewWidget(self) - self.webivewwidget.navigate("about:blank") + self.webivewwidget.navigate( + os.path.abspath(r"LunaTranslator\rendertext\webview.html") + ) self.webivewwidget.set_transparent_background() self.webivewwidget.webview.bind("calllunaclickedword", self.calllunaclickedword) self.webivewwidget.webview.bind( "calllunaheightchange", self.calllunaheightchange ) - self.rootdivid = f"luna_{uuid.uuid4()}" self.saveiterclasspointer = {} - self.testeval( - f""" - document.write(`
`); - """ - ) - self.setglobalstyle(self.rootdivid) + self.isfirst = True - def testeval(self, js): - js += ";\n" - if testsavejs: - with open("1.js", "a", encoding="utf8") as ff: - ff.write(js) + def showEvent(self, e): + if not self.isfirst: + return + + self.isfirst = False + if os.path.exists("userconfig/extrahtml.html"): + with open("userconfig/extrahtml.html", "r", encoding="utf8") as ff: + self.set_extra_html(ff.read()) + + def debugeval(self, js): + # print(js) self.webivewwidget.webview.eval(js) - def setglobalstyle(self, rootdivid): + # js api - if 0: - extra = extrastyle(rootdivid) - else: - if os.path.exists("userconfig/extrastyle.py"): - extrastyle = importlib.import_module("extrastyle").extrastyle - extra = extrastyle(rootdivid) - else: - extra = "" - self.testeval( - f""" - document.write(``); - """ + def create_div_line_id(self, _id): + self.debugeval(f'create_div_line_id("{_id}");') + + def clear_all(self): + self.debugeval(f"clear_all()") + + def set_extra_html(self, html): + html = quote(html) + self.debugeval(f'set_extra_html("{html}")') + + def create_internal_text(self, style, styleargs, _id, text, args): + text = quote(text) + args = quote(json.dumps(args)) + styleargs = quote(json.dumps(styleargs)) + self.debugeval( + f'create_internal_text("{style}","{styleargs}","{_id}","{text}","{args}");' ) - def setselectable(self, b): - pass + def create_internal_rubytext(self, style, styleargs, _id, tag, args): + tag = quote(json.dumps(tag)) + args = quote(json.dumps(args)) + styleargs = quote(json.dumps(styleargs)) + self.debugeval( + f'create_internal_rubytext("{style}","{styleargs}","{_id}","{tag}","{args}");' + ) + + # js api end + # native api def calllunaheightchange(self, h): self.contentsChanged.emit( QSize(self.width(), int(h * self.webivewwidget.get_ZoomFactor())) ) - def internalheighchange(self): - self.webivewwidget.webview.eval( - f'calllunaheightchange(document.getElementById("{self.rootdivid}").offsetHeight)' - ) + def calllunaclickedword(self, packedwordinfo): + gobject.baseobject.clickwordcallback(packedwordinfo, False) + + # native api end + + def setselectable(self, b): + pass def iter_append(self, iter_context_class, origin, atcenter, text, color, cleared): @@ -109,17 +96,10 @@ class TextBrowser(QWidget, dataget): _id = self.saveiterclasspointer[iter_context_class] self._webview_append(_id, origin, atcenter, text, [], [], color) - self.internalheighchange() - def createtextlineid(self): _id = f"luna_{uuid.uuid4()}" - ptext = f'
' - self.testeval( - f""" - document.getElementById("{self.rootdivid}").innerHTML+=`{ptext}`; - """ - ) + self.create_div_line_id(_id) return _id def append(self, origin, atcenter, text, tag, flags, color, cleared): @@ -127,102 +107,56 @@ class TextBrowser(QWidget, dataget): _id = self.createtextlineid() self._webview_append(_id, origin, atcenter, text, tag, flags, color) - def calllunaclickedword(self, packedwordinfo): - gobject.baseobject.clickwordcallback(json.loads(unquote(packedwordinfo)), False) + def measureH(self, font_family, font_size): + font = QFont() + font.setFamily(font_family) + font.setPointSizeF(font_size) + fmetrics = QFontMetrics(font) - def gen_html(self, *args): - currenttype = globalconfig["rendertext_using_internal"]["webview"] - try: - __ = importlib.import_module( - f"rendertext.internal.webview.{currenttype}" - ).TextLine - except: - from traceback import print_exc - - print_exc() - globalconfig["rendertext_using_internal"]["webview"] = currenttype = list( - globalconfig["rendertext"]["webview"].keys() - )[0] - __ = importlib.import_module( - f"rendertext.internal.webview.{currenttype}" - ).TextLine - return __(currenttype, self.webivewwidget.webview, self).gen_html__(*args) + return fmetrics.height() def _webview_append(self, _id, origin, atcenter, text, tag, flags, color): - text = text.replace("\n", "
").replace("\\", "\\\\") fmori, fsori, boldori = self._getfontinfo(origin) fmkana, fskana, boldkana = self._getfontinfo_kana() kanacolor = self._getkanacolor() + line_height = self.measureH(fmori, fsori) + globalconfig["extra_space"] + style = globalconfig["rendertext_using_internal"]["webview"] + styleargs = globalconfig["rendertext"]["webview"][style].get("args", {}) if len(tag): - rb, rb2 = "", "" isshowhira, isshow_fenci, isfenciclick = flags - if isshowhira: - rt, rt2 = "", "" - else: - rt, rt2 = "", "" - text = rb - for word in tag: - if word["orig"] == "\n": - text = text + rb2 + "
" + rb - continue - if isfenciclick: - click = f'''onclick="calllunaclickedword('{quote(json.dumps(word))}')"''' - else: - click = "" - _maskid = f"luna_{uuid.uuid4()}" - textori = word["orig"].replace("\\", "\\\\") - textori = self.gen_html( - textori, - fmori, - fsori, - boldori, - atcenter, - color, - globalconfig["extra_space"], - ) - text += f"""
""" + textori + "
" - if isshow_fenci: + if isshow_fenci: + for word in tag: color1 = self._randomcolor(word) - _style = f""" - """ - text += _style - if (word["orig"] != word["hira"]) and isshowhira: - inner = self.gen_html( - word["hira"].replace("\\", "\\\\"), - fmkana, - fskana, - boldkana, - True, - kanacolor, - 0, - ) - else: - inner = "" - text += rt + inner + rt2 - text = text + rb2 - if atcenter: - text = f'
{text}
' - else: - text = self.gen_html( - text, - fmori, - fsori, - boldori, - atcenter, - color, - globalconfig["extra_space"], + word["color"] = color1 + args = dict( + atcenter=atcenter, + fmori=fmori, + fsori=fsori, + boldori=boldori, + color=color, + fmkana=fmkana, + fskana=fskana, + boldkana=boldkana, + kanacolor=kanacolor, + isshowhira=isshowhira, + isshow_fenci=isshow_fenci, + isfenciclick=isfenciclick, + line_height=line_height, ) - self.testeval(f"document.getElementById(`{_id}`).innerHTML=`{text}`") - self.internalheighchange() + self.create_internal_rubytext(style, styleargs, _id, tag, args) + else: + args = dict( + atcenter=atcenter, + fm=fmori, + fs=fsori, + bold=boldori, + color=color, + line_height=line_height, + ) + self.create_internal_text(style, styleargs, _id, text, args) def clear(self): - self.testeval( - f""" - document.getElementById("{self.rootdivid}").innerHTML=""; - """ - ) + self.clear_all() self.saveiterclasspointer.clear() diff --git a/LunaTranslator/LunaTranslator/translator/baidu_ai.py b/LunaTranslator/LunaTranslator/translator/baidu_ai.py index a8076a30..0688e06e 100644 --- a/LunaTranslator/LunaTranslator/translator/baidu_ai.py +++ b/LunaTranslator/LunaTranslator/translator/baidu_ai.py @@ -86,6 +86,8 @@ class TS(basetrans): if len(text) == 0 or text[:5] != b"data:": continue js = json.loads(text[5:].decode("utf8")) + if js["data"] is None: + continue event = js["data"]["event"] if event == "Translating": trans = "\n".join([_["dst"] for _ in js["data"]["list"]]) diff --git a/LunaTranslator/LunaTranslator/translator/youdaodict.py b/LunaTranslator/LunaTranslator/translator/youdaodict.py index ceb56931..1bf6eeb4 100644 --- a/LunaTranslator/LunaTranslator/translator/youdaodict.py +++ b/LunaTranslator/LunaTranslator/translator/youdaodict.py @@ -129,7 +129,7 @@ class TS(basetrans): return "".join( [ "".join([__["tgt"] for __ in _]) - for _ in response.json()["translateResult"] + for _ in response.json().get("translateResult", []) ] ) except: diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index e7f7ded2..785f3e53 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -186,7 +186,7 @@ "args": { "fillcolor": "#eeeeee", "shadowforce": 5, - "shadowR":1 + "shadowR": 1 }, "argstype": { "fillcolor": { @@ -286,6 +286,7 @@ "requestinterval": 1, "keepontop": true, "buttonsize": 20, + "buttonsize2": 18, "language_setted_2.4.5": false, "postprocess_rank": [], "transoptimi": { @@ -297,7 +298,8 @@ "arabic_reshaper": false }, "uselongtermcache": false, - "fixedheight": false, + "auto_expand": true, + "auto_shrink": true, "showintab": true, "showintab_sub": true, "remove_useless_hook": false, @@ -314,6 +316,12 @@ 1200, 200 ], + "geo_extrahtml": [ + 100, + 100, + 1000, + 300 + ], "hist_geo": [ 100, 100, @@ -462,6 +470,8 @@ "accept_use_unicode_end": 65535, "premtsimiuse": false, "buttoncolor": "#001f9f", + "buttoncolor2": "#FF69B4", + "buttoncolor3": "#afafaf", "premtsimi2": 100, "ocrrangecolor": "#000000", "ocrrangewidth": 2, diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index 123e83a9..d01ae13b 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -1673,5 +1673,21 @@ "audio_sentence", "rubytext", "explain" - ] + ], + "textrender": { + "textbrowser": [ + "normal", + "yinying", + "miaobian0", + "miaobian1", + "miaobian2" + ], + "webview": [ + "normal", + "yinying", + "miaobian0", + "miaobian1", + "miaobian2" + ] + } } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index 39953724..4fa2f3a3 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -33,7 +33,6 @@ "用户词典": "قاموس المستخدم", "预翻译采用模糊匹配": "غامض مطابقة", "汉语翻译结果繁简转换": "الترجمة الصينية نتيجة التحويل", - "分词&假名分析器": "اسم مستعار و محلل", "时间间隔": "الفاصل الزمني", "字数统计": "كلمة إحصائيات", "添加游戏": "إضافة لعبة", @@ -53,7 +52,6 @@ "字符串偏移量": "سلسلة تعويض", "窗口置顶": "نافذة السقف", "西里尔": "سيريل", - "欢迎使用": "مرحبا بكم في استخدام", "设置界面字体类型": "مجموعة واجهة نوع الخط", "月読アイ": "مون 読アイ", "小学馆": "قاعة المدرسة الابتدائية", @@ -98,7 +96,6 @@ "语法加亮": "تسليط الضوء على بناء الجملة", "火山api": "بركان API", "用户词典2(可选)": "قاموس المستخدم 2 ( اختياري )", - "OCR范围框宽度": "التعرف الضوئي على الحروف مجموعة مربع العرض", "東北イタコ": "شرقية ココ", "最新版本": "أحدث إصدار", "缩放时调整光标速度": "ضبط سرعة المؤشر عند التكبير", @@ -160,7 +157,6 @@ "翻译器显示语言(重启生效)": "مترجم لغة العرض ( إعادة تشغيل )", "日语(CP932,SHIFT-JIS)": "اليابانية ( cp932 shift-jis , )", "显示朗读按钮": "عرض زر القراءة", - "OCR范围框颜色": "التعرف الضوئي على الحروف مجموعة مربع اللون", "语速:(-10~10)": "سرعة الكلام : ( - 10-10 )", "北欧": "نورد", "到进程": "في عملية", @@ -220,7 +216,6 @@ "过滤latin-1字符集": "تصفية مجموعة الأحرف latin-1", "俄语": "روسي", "文本输入": "إدخال النص", - "OCR一致性阈值": "التعرف الضوئي على الحروف الاتساق عتبة", "有道4": "هناك طريق", "暂不支持64程序": "لا يدعم البرنامج مؤقتا", "执行周期": "فترة التنفيذ", @@ -323,9 +318,6 @@ "单次负载个数": "عدد من الأحمال في وقت واحد", "附加音源": "مصدر إضافي", "竖向OCR识别": "التعرف الضوئي على الحروف العمودية", - "本软件显示语言(重启生效)": "هذا البرنامج يعرض اللغة ( إعادة تشغيل فعالة )", - "优化横向OCR漏字": "الأمثل الجانبي التعرف الضوئي على الحروف", - "OCR识别易错内容修正": "التعرف الضوئي على الحروف ، التعرف الضوئي على الحروف", "修改字体字符集": "تعديل الخط مجموعة الأحرف", "是否使用快捷键": "استخدام مفاتيح الاختصار", "备忘录": "مذكرة", @@ -337,7 +329,6 @@ "复制特殊码": "نسخ رمز خاص", "字体": "فونت", "显示翻译器名称": "عرض اسم المترجم", - "固定窗口尺寸": "حجم النافذة الثابتة", "不切换": "لا تبديل", "将汉字转换成繁体/日式汉字": "تحويل الأحرف الصينية إلى الأحرف الصينية التقليدية / اليابانية", "选择文本": "اختيار النص", @@ -358,7 +349,6 @@ "自动更新": "التحديثات التلقائية", "越南语": "الفيتنامية", "希伯来语": "العبرية", - "OCR自动化方法": "التعرف الضوئي على الحروف طريقة التشغيل الآلي", "游戏": "لعبة .", "全字符(UTF-8)": "حرف كامل ( UTF-8 )", "工具按钮大小": "أداة حجم الزر", @@ -388,7 +378,6 @@ "取消": "ألغى", "京町セイカ": "كيوماتشي مركز", "路径": "مسار", - "OCR最长间隔时间(s)": "التعرف الضوئي على الحروف أطول الفاصل الزمني ( ق )", "过滤尖括号<>": "تصفية بين قوسين", "过滤包含乱码的文本行": "تصفية خط النص الذي يحتوي على كلمة", "接尾辞": "كلمة ختامية", @@ -424,7 +413,6 @@ "翻译结果修正": "تصحيح نتيجة الترجمة", "设置刷新延迟": "تعيين تأخير التحديث", "过滤数字和英文字母": "تصفية الأرقام و الحروف الانجليزية", - "OCR稳定性阈值": "التعرف الضوئي على الحروف عتبة الاستقرار", "原文颜色": "اللون الأصلي", "和源窗口相同": "نفس المصدر نافذة", "翻译结果替换设置": "نتيجة استبدال إعدادات الترجمة", @@ -495,7 +483,6 @@ "日文": "اللغة اليابانية", "显示移动按钮": "عرض زر الانتقال", "简单字符串替换": "سلسلة بسيطة استبدال", - "OCR最短间隔时间(s)": "التعرف الضوئي على الحروف أقصر الفاصل الزمني ( ق )", "形状詞": "شكل الكلمات", "保存": "حفظ .", "前景窗口截屏": "لقطة من النافذة الأمامية", @@ -527,7 +514,6 @@ "字体样式": "نمط الخط", "选择声音": "اختيار الصوت", "使用Unicode范围过滤": "استخدام يونيكود مجموعة فلتر", - "使用竖排OCR(效果不佳)": "استخدام عمودي التعرف الضوئي على الحروف", "插入特殊码延迟(ms)": "إدراج رمز خاص تأخير ( ماجستير )", "朗读原文": "قراءة النص", "朗读翻译": "قراءة الترجمة", @@ -578,7 +564,6 @@ "路径不存在": "المسار غير موجود", "不处理": "لا تعامل", "灰度化": "مقياس الرمادية", - "OCR预处理方法": "التعرف الضوئي على الحروف طريقة المعالجة", "阈值二值化": "عتبة binarization", "OTSU二值化": "أوتسو binarization", "二值化阈值": "العتبة الثنائية", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "استبدال اسم الشخص مع بيانات فندب", "文本输出": "النص الناتج", "自动输出提取的文本": "التلقائي استخراج النص الناتج", - "输出到剪贴板": "الإخراج إلى الحافظة", - "输出到WebSocket": "الإخراج إلى WebSocket", "缩放": "تحجيم", "填充": "ملأ", "适应": "تكيف", @@ -792,5 +775,33 @@ "调试浏览器": "تصحيح المتصفح", "手动翻译": "دليل الترجمة", "显示引擎": "عرض المحرك", - "阴影字体": "خطوط الظل" + "阴影字体": "خطوط الظل", + "额外的html": "أتش تي أم أل إضافية", + "测试": "اختبار .", + "窗口尺寸": "حجم النافذة", + "自动延展": "التمديد التلقائي", + "自动收缩": "الانكماش التلقائي", + "范围框颜色": "مجموعة مربع اللون", + "伴随游戏窗口": "نافذة اللعبة المصاحبة", + "主题": "موضوع .", + "自动输出": "الانتاج الآلي", + "引擎": "محرك .", + "注音": "لفظي", + "字体缩放": "حجم الخط", + "显示行为": "عرض السلوك", + "主界面": "الواجهة الرئيسية", + "设置界面": "وضع واجهة", + "声音": "صوت .", + "行为": "تصرف", + "自动化执行": "التنفيذ الآلي", + "预处理": "المعالجة", + "自动化执行方法": "طريقة التنفيذ التلقائي", + "后处理": "بعد العلاج", + "竖向识别": "تحديد عمودي", + "易错内容修正": "تصحيح محتوى خاطئ", + "范围框宽度": "عرض النطاق الترددي", + "按钮颜色": "زر اللون", + "按钮大小": "حجم الزر", + "软件显示语言": "عرض برامج اللغة", + "重启生效": "إعادة تشغيل" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index 068e4b40..2099400e 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -21,7 +21,6 @@ "&显示": "&顯示", "&设置": "&設定", "&退出": "&退出", - "欢迎使用": "歡迎使用", "设置": "設定", "基本设置": "基本設定", "选择文本输入源": "選擇文字輸入源", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "重繪延遲(ms)", "OCR设置": "OCR設定", "本地OCR": "本地OCR", - "OCR最长间隔时间(s)": "OCR最長間隔時間(s)", - "OCR最短间隔时间(s)": "OCR最短間隔時間(s)", - "OCR范围框颜色": "OCR範圍框顏色", - "OCR范围框宽度": "OCR範圍框寬度", "普通字体": "普通字體", "描边字体": "描邊字體", "显示设置": "顯示設定", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "顯示遊戲靜音按鈕", "游戏最小化时窗口隐藏": "遊戲最小化時視窗隱藏", "游戏窗口移动时同步移动": "遊戲視窗移動時同步移動", - "固定窗口尺寸": "固定視窗尺寸", "翻译结果繁简体显示": "翻譯結果繁簡體顯示", "翻译器显示语言(重启生效)": "翻譯器顯示語言(重啓生效)", "语音设置": "語音設定", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "去除重複字元(若為1則自動分析去重)", "专有名词翻译设置(游戏ID 0表示全局)": "專有名詞翻譯設定(遊戲ID 0表示全域)", "密钥": "金鑰", - "优化横向OCR漏字": "優化橫向OCR漏字", "記号": "記號", "选择文件": "選擇檔案", "缩放时禁用窗口大小调整": "縮放時禁用視窗大小調整", @@ -191,7 +184,6 @@ "删除游戏": "删除遊戲", "和源窗口相同": "和源視窗相同", "光标缩放系数": "光標縮放係數", - "使用竖排OCR(效果不佳)": "使用豎排OCR(效果不佳)", "3D游戏模式": "3D遊戲模式", "接続詞": "接続詞", "缩放时调整光标速度": "縮放時調整光標速度", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "隱藏延遲(s)", "选取OCR范围——立即": "選取OCR範圍——立即", "未查到": "未查到", - "OCR识别易错内容修正": "OCR識別易錯內容修正", "保存": "保存", "当前版本": "當前版本", "最新版本": "最新版本", @@ -271,7 +262,6 @@ "编辑专有名词": "編輯專有名詞", "专有名词翻译设置": "專有名詞翻譯設定", "设置Token": "設定Token", - "分词&假名分析器": "分詞&假名分析器", "内置": "內寘", "token设置": "token設定", "不同词性颜色(需要Mecab)": "不同詞性顏色(需要Mecab)", @@ -279,9 +269,6 @@ "!未选定进程!": "! 未選定行程!", "该功能可能会导致游戏崩溃!": "該功能可能會導致遊戲崩潰!", "警告": "警告", - "OCR稳定性阈值": "OCR穩定性閾值", - "OCR一致性阈值": "OCR一致性閾值", - "OCR自动化方法": "OCR自動化方法", "文字更新分析": "文字更新分析", "时间间隔": "時間間隔", "时间周期执行": "時間週期執行", @@ -374,7 +361,6 @@ "火山OCR": "火山OCR", "密钥获取": "金鑰獲取", "翻译及OCR语言": "翻譯及OCR語言", - "本软件显示语言(重启生效)": "本軟件顯示語言(重啓生效)", "成功": "成功", "特殊码": "特殊碼", "删除特殊码": "删除特殊碼", @@ -578,7 +564,6 @@ "路径不存在": "路徑不存在", "不处理": "不處理", "灰度化": "灰度化", - "OCR预处理方法": "OCR預處理方法", "阈值二值化": "閾值二值化", "OTSU二值化": "OTSU二值化", "二值化阈值": "二值化閾值", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "使用VNDB數據替換人名", "文本输出": "文字輸出", "自动输出提取的文本": "自動輸出選取的文字", - "输出到剪贴板": "輸出到剪貼板", - "输出到WebSocket": "輸出到WebSocket", "缩放": "縮放", "填充": "填充", "适应": "適應", @@ -792,5 +775,33 @@ "调试浏览器": "調試瀏覽器", "手动翻译": "手動翻譯", "显示引擎": "顯示引擎", - "阴影字体": "陰影字體" + "阴影字体": "陰影字體", + "额外的html": "額外的html", + "测试": "測試", + "窗口尺寸": "視窗尺寸", + "自动延展": "自動延展", + "自动收缩": "自動收縮", + "范围框颜色": "範圍框顏色", + "伴随游戏窗口": "伴隨遊戲視窗", + "主题": "主題", + "自动输出": "自動輸出", + "引擎": "引擎", + "注音": "注音", + "字体缩放": "字體縮放", + "显示行为": "顯示行為", + "主界面": "主介面", + "设置界面": "設定介面", + "声音": "聲音", + "行为": "行為", + "自动化执行": "自動化執行", + "预处理": "預處理", + "自动化执行方法": "自動化執行方法", + "后处理": "後處理", + "竖向识别": "豎向識別", + "易错内容修正": "易錯內容修正", + "范围框宽度": "範圍框寬度", + "按钮颜色": "按鈕顏色", + "按钮大小": "按鈕大小", + "软件显示语言": "軟件顯示語言", + "重启生效": "重啓生效" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index 61069157..1530576c 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -24,7 +24,6 @@ "翻译器显示语言(重启生效)": "Translator display language (effective after restart)", "专有名词翻译设置(游戏ID 0表示全局)": "Proper noun translation settings (game ID 0 indicates global)", "密钥": "secret key", - "优化横向OCR漏字": "Optimize horizontal OCR leakage", "使用VNR共享辞书": "Use VNR to share dictionaries", "显示复制原文按钮": "Show Copy Original Button", "快捷键设置": "Shortcut key settings", @@ -46,13 +45,11 @@ "基本设置": "Basic settings", "搜索": "search", "显示游戏静音按钮": "Show game mute button", - "OCR最长间隔时间(s)": "Maximum OCR interval (s)", "動詞": "Verbs", "共享辞书": "Sharing dictionaries", "注册网址": "Registration website", "显示帧率": "Display Frame Rate", "自动翻译": "Automatic translation", - "OCR最短间隔时间(s)": "Minimum OCR interval (s)", "锁定工具栏": "Lock Toolbars", "辞书设置": "Dictionary Settings", "绑定截图窗口": "Bind screenshot window", @@ -103,7 +100,6 @@ "音量:(0~100)": "Volume: (0~100)", "光标缩放系数": "Cursor zoom factor", "前景窗口截屏": "Screenshot of foreground window", - "使用竖排OCR(效果不佳)": "Use vertical OCR (poor effect)", "3D游戏模式": "3D game mode", "普通字体": "Normal font", "朗读": "Reading aloud", @@ -169,7 +165,6 @@ "小学馆辞书": "Dictionary of Primary School Hall", "简体中文": "Simplified Chinese", "原文内容": "Original content", - "固定窗口尺寸": "Fixed window size", "简单替换内容(若替换为空则直接过滤)": "Simple replacement content (filter directly if it is blank)", "次数统计": "Frequency statistics", "代名詞": "Pronoun", @@ -194,7 +189,6 @@ "&显示": "&Show", "&设置": "&Settings", "&退出": "&Exit", - "欢迎使用": "Welcome", "有道api": "Youdao API", "导出的第一翻译源": "First translation source exported", "日语(CP932,SHIFT-JIS)": "Japanese (CP932, SHIFT-JIS)", @@ -213,8 +207,6 @@ "拉丁(CP1252)": "Latin (CP1252)", "代码页": "code page", "刷新延迟(ms)": "Refresh Delay (ms)", - "OCR范围框颜色": "OCR Range Box Color", - "OCR范围框宽度": "OCR Scope Box Width", "文本预处理": "Text preprocessing", "调整执行顺序": "Adjust execution order", "搜索特殊码": "Search for special codes", @@ -247,7 +239,6 @@ "自动隐藏窗口": "Auto hide window", "隐藏延迟(s)": "Hide Delay (s)", "选取OCR范围——立即": "Select OCR Range - Immediately", - "OCR识别易错内容修正": "Correction of error prone content identified by OCR", "当前版本": "current version", "最新版本": "Latest version", "项目网站": "Project website", @@ -271,7 +262,6 @@ "编辑专有名词": "Edit proper nouns", "专有名词翻译设置": "Proper noun translation settings", "设置Token": "Set Token", - "分词&假名分析器": "Participle&kana analyzer", "内置": "built-in", "token设置": "Token settings", "不同词性颜色(需要Mecab)": "Different parts of speech colors (Mecab required)", @@ -279,9 +269,6 @@ "!未选定进程!": "! No process selected!", "该功能可能会导致游戏崩溃!": "This function may cause the game to crash!", "警告": "warning", - "OCR稳定性阈值": "OCR stability threshold", - "OCR一致性阈值": "OCR consistency threshold", - "OCR自动化方法": "OCR automation method", "文字更新分析": "Text update analysis", "时间间隔": "time interval", "时间周期执行": "Time cycle execution", @@ -374,7 +361,6 @@ "火山OCR": "Volcano OCR", "密钥获取": "Key acquisition", "翻译及OCR语言": "Translation and OCR language", - "本软件显示语言(重启生效)": "Display language of the software (restart takes effect)", "成功": "success", "特殊码": "specific code", "删除特殊码": "Delete special code", @@ -578,7 +564,6 @@ "路径不存在": "path does not exist", "不处理": "Not handled", "灰度化": "Grayscale", - "OCR预处理方法": "OCR preprocessing method", "阈值二值化": "Threshold binarization", "OTSU二值化": "OTSU binarization", "二值化阈值": "Binarization threshold", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Replace person names with VNDB data", "文本输出": "Text output", "自动输出提取的文本": "Automatically output extracted text", - "输出到剪贴板": "Output to clipboard", - "输出到WebSocket": "Output to WebSocket", "缩放": "zoom", "填充": "filling", "适应": "adapt", @@ -792,5 +775,33 @@ "调试浏览器": "Debugging browser", "手动翻译": "Manual translation", "显示引擎": "Display Engine", - "阴影字体": "Shadow font" + "阴影字体": "Shadow font", + "额外的html": "Additional HTML", + "测试": "test", + "窗口尺寸": "Window size", + "自动延展": "Auto Scaling ", + "自动收缩": "Auto shrink", + "范围框颜色": "Range box color", + "伴随游戏窗口": "Accompanying the game window", + "主题": "theme", + "自动输出": "Automatic output", + "引擎": "engine", + "注音": "Zhuyin", + "字体缩放": "Font scaling", + "显示行为": "Display behavior", + "主界面": "main interface", + "设置界面": "Settings interface", + "声音": "voice", + "行为": "behavior", + "自动化执行": "Automated execution", + "预处理": "Preprocessing", + "自动化执行方法": "Automated execution methods", + "后处理": "Post processing", + "竖向识别": "Vertical recognition", + "易错内容修正": "Error prone content correction", + "范围框宽度": "Range box width", + "按钮颜色": "Button color", + "按钮大小": "Button size", + "软件显示语言": "Software Display Language", + "重启生效": "Restart takes effect" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index 8a0929c5..c1147466 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -21,7 +21,6 @@ "&显示": "& mostrar", "&设置": "Configuración", "&退出": "Salida", - "欢迎使用": "Bienvenido a usar", "设置": "Configuración", "基本设置": "Configuración básica", "选择文本输入源": "Seleccionar fuente de entrada de texto", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Retraso de actualización (ms)", "OCR设置": "Configuración OCR", "本地OCR": "OCR local", - "OCR最长间隔时间(s)": "Intervalo máximo OCR (s)", - "OCR最短间隔时间(s)": "Intervalo mínimo OCR (s)", - "OCR范围框颜色": "Color del cuadro de rango OCR", - "OCR范围框宽度": "Ancho del marco de rango OCR", "普通字体": "Fuente normal", "描边字体": "Fuente de dibujo", "显示设置": "Configuración de la pantalla", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Muestra el botón de silencio del juego", "游戏最小化时窗口隐藏": "Ventanas ocultas al minimizar el juego", "游戏窗口移动时同步移动": "La ventana del juego se mueve simultáneamente cuando se mueve", - "固定窗口尺寸": "Tamaño de la ventana fija", "翻译结果繁简体显示": "Visualización simplificada de los resultados de la traducción", "翻译器显示语言(重启生效)": "Lenguaje de visualización del traductor (reinicio efectivo)", "语音设置": "Configuración de voz", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Eliminar caracteres duplicados (si es 1, se analiza automáticamente para eliminar el peso)", "专有名词翻译设置(游戏ID 0表示全局)": "Configuración de traducción de términos propios (el ID del juego 0 significa global)", "密钥": "Clave", - "优化横向OCR漏字": "Optimizar las fugas de OCR horizontales", "記号": "Marca", "选择文件": "Seleccionar archivo", "缩放时禁用窗口大小调整": "Desactivar el ajuste de tamaño de la ventana al ampliar", @@ -191,7 +184,6 @@ "删除游戏": "Eliminar el juego", "和源窗口相同": "Igual que la ventana de origen", "光标缩放系数": "Coeficiente de escala del cursor", - "使用竖排OCR(效果不佳)": "Uso de OCR vertical (mal efecto)", "3D游戏模式": "Modo de juego 3D", "接続詞": "Conectar palabras", "缩放时调整光标速度": "Ajustar la velocidad del cursor al ampliar", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Retraso oculto (s)", "选取OCR范围——立即": "Selección del rango OCR - inmediatamente", "未查到": "No se ha detectado", - "OCR识别易错内容修正": "OCR identifica correcciones de contenido propensas a errores", "保存": "Guardar", "当前版本": "Versión actual", "最新版本": "La última versión", @@ -271,7 +262,6 @@ "编辑专有名词": "Editar términos propios", "专有名词翻译设置": "Configuración de traducción de términos propios", "设置Token": "Establecer Token", - "分词&假名分析器": "Analizador de participio y seudónimo", "内置": "Incorporado", "token设置": "Configuración Token", "不同词性颜色(需要Mecab)": "Diferentes colores del habla (se necesita mecab)", @@ -279,9 +269,6 @@ "!未选定进程!": "¡! ¡Proceso no seleccionado!", "该功能可能会导致游戏崩溃!": "¡¡ esta función puede causar un colapso del juego!", "警告": "Aviso", - "OCR稳定性阈值": "Umbral de estabilidad OCR", - "OCR一致性阈值": "Umbral de coherencia OCR", - "OCR自动化方法": "Método de automatización OCR", "文字更新分析": "Análisis de actualización de texto", "时间间隔": "Intervalo de tiempo", "时间周期执行": "Ejecución del ciclo de tiempo", @@ -374,7 +361,6 @@ "火山OCR": "Volcán OCR", "密钥获取": "Adquisición de claves", "翻译及OCR语言": "Idiomas de traducción y OCR", - "本软件显示语言(重启生效)": "El lenguaje de visualización de este software (el reinicio es válido)", "成功": "éxito", "特殊码": "Código especial", "删除特殊码": "Eliminar el código especial", @@ -578,7 +564,6 @@ "路径不存在": "El camino no existe", "不处理": "No procesar", "灰度化": "Escala de grises", - "OCR预处理方法": "Método de preprocesamiento OCR", "阈值二值化": "Binarización del umbral", "OTSU二值化": "Binarización de Otsu", "二值化阈值": "Umbral de binarización", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Reemplazar nombres con datos vndb", "文本输出": "Salida de texto", "自动输出提取的文本": "Salida automática del Texto extraído", - "输出到剪贴板": "Exportar al portapapeles", - "输出到WebSocket": "Exportar a websocket", "缩放": "Zoom", "填充": "Relleno", "适应": "Adaptación", @@ -792,5 +775,33 @@ "调试浏览器": "Depurar el navegador", "手动翻译": "Traducción manual", "显示引擎": "Motor de visualización", - "阴影字体": "Fuente de sombra" + "阴影字体": "Fuente de sombra", + "额外的html": "Htmls adicionales", + "测试": "Prueba", + "窗口尺寸": "Tamaño de la ventana", + "自动延展": "Extensión automática", + "自动收缩": "Contracción automática", + "范围框颜色": "Color del marco de rango", + "伴随游戏窗口": "Acompañar la ventana del juego", + "主题": "Tema", + "自动输出": "Salida automática", + "引擎": "Motor", + "注音": "Anotación fonética", + "字体缩放": "Tamaño de la fuente", + "显示行为": "Mostrar comportamiento", + "主界面": "Interfaz principal", + "设置界面": "Configurar la interfaz", + "声音": "Sonido", + "行为": "Comportamiento", + "自动化执行": "Ejecución automatizada", + "预处理": "Preprocesamiento", + "自动化执行方法": "Método de ejecución automatizado", + "后处理": "Reprocesamiento", + "竖向识别": "Identificación vertical", + "易错内容修正": "Corrección de contenido propenso a errores", + "范围框宽度": "Ancho del marco de alcance", + "按钮颜色": "Color del botón", + "按钮大小": "Tamaño del botón", + "软件显示语言": "Lenguaje de visualización de software", + "重启生效": "El reinicio entra en vigor" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index 2b8c2af4..785bceaf 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -21,7 +21,6 @@ "&显示": "Afficher", "&设置": "Paramètres", "&退出": "Quitter", - "欢迎使用": "Bienvenue.", "设置": "Paramètres", "基本设置": "Paramètres de base", "选择文本输入源": "Sélectionner la source d'entrée de texte", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Délai de rafraîchissement (MS)", "OCR设置": "Paramètres ocr", "本地OCR": "OCR local", - "OCR最长间隔时间(s)": "OCR intervalle maximal (s)", - "OCR最短间隔时间(s)": "OCR minimum Interval Time (s)", - "OCR范围框颜色": "Couleur de la boîte de plage ocr", - "OCR范围框宽度": "Largeur de la boîte de plage ocr", "普通字体": "Police normale", "描边字体": "Police de bord", "显示设置": "Paramètres d 'affichage", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Afficher le bouton mute du jeu", "游戏最小化时窗口隐藏": "Fenêtre cachée lorsque le jeu est minimisé", "游戏窗口移动时同步移动": "Synchroniser le mouvement lorsque la fenêtre de jeu se déplace", - "固定窗口尺寸": "Taille fixe de la fenêtre", "翻译结果繁简体显示": "Affichage simplifié des résultats de la traduction", "翻译器显示语言(重启生效)": "Langue d'affichage du traducteur (redémarrage en vigueur)", "语音设置": "Paramètres vocaux", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Supprimer les caractères dupliqués (analyser automatiquement si 1)", "专有名词翻译设置(游戏ID 0表示全局)": "Paramètres de traduction de noms propres (id de jeu 0 pour global)", "密钥": "Clé secrète", - "优化横向OCR漏字": "Optimisation des fuites transversales de roc", "記号": "Marque", "选择文件": "Sélectionner un fichier", "缩放时禁用窗口大小调整": "Désactiver le redimensionnement de la fenêtre lors du zoom", @@ -191,7 +184,6 @@ "删除游戏": "Supprimer le jeu", "和源窗口相同": "Identique à la fenêtre source", "光标缩放系数": "Facteur d'échelle du curseur", - "使用竖排OCR(效果不佳)": "Utiliser la Roc verticale (mauvais effet)", "3D游戏模式": "Mode de jeu 3D", "接続詞": "Prends le bon mot.", "缩放时调整光标速度": "Ajuster la vitesse du curseur à l'échelle", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Masquer le délai", "选取OCR范围——立即": "Sélectionnez la plage OCR - maintenant", "未查到": "Non trouvé", - "OCR识别易错内容修正": "Correction des erreurs de reconnaissance ocr", "保存": "Enregistrer", "当前版本": "Version actuelle", "最新版本": "Dernière version", @@ -271,7 +262,6 @@ "编辑专有名词": "Modifier un nom propre", "专有名词翻译设置": "Paramètres de traduction des noms propriétaires", "设置Token": "Configurer token", - "分词&假名分析器": "Analyseur de participe & pseudonyme", "内置": "Intégré", "token设置": "Paramètres token", "不同词性颜色(需要Mecab)": "Différentes couleurs lexicales (mecab requis)", @@ -279,9 +269,6 @@ "!未选定进程!": "- Oui! Aucun processus sélectionné!", "该功能可能会导致游戏崩溃!": "Cette fonctionnalité peut provoquer un crash du jeu!", "警告": "Avertissement", - "OCR稳定性阈值": "Seuil de stabilité ocr", - "OCR一致性阈值": "Seuil de conformité ocr", - "OCR自动化方法": "Méthode d'automatisation ocr", "文字更新分析": "Analyse des mises à jour textuelles", "时间间隔": "Intervalle de temps", "时间周期执行": "Exécution du cycle de temps", @@ -374,7 +361,6 @@ "火山OCR": "OCR volcanique", "密钥获取": "Acquisition de clé", "翻译及OCR语言": "Traduction et langage ocr", - "本软件显示语言(重启生效)": "Langue d'affichage de ce logiciel (redémarrage effectif)", "成功": "Succès", "特殊码": "Code spécial", "删除特殊码": "Supprimer le code spécial", @@ -578,7 +564,6 @@ "路径不存在": "Le chemin n'existe pas", "不处理": "Ne pas traiter", "灰度化": "Gradation de gris", - "OCR预处理方法": "Méthode de prétraitement ocr", "阈值二值化": "Binarisation des seuils", "OTSU二值化": "Binarisation Otsu", "二值化阈值": "Seuil de binarisation", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Remplacement des noms de personnes par des données vndb", "文本输出": "Sortie de texte", "自动输出提取的文本": "Sortie automatique du texte extrait", - "输出到剪贴板": "Sortie vers le presse - papiers", - "输出到WebSocket": "Sortie vers websocket", "缩放": "Zoom", "填充": "Remplissage", "适应": "Adaptation", @@ -792,5 +775,33 @@ "调试浏览器": "Déboguer le Navigateur", "手动翻译": "Traduction manuelle", "显示引擎": "Moteur d'affichage", - "阴影字体": "Shadow font" + "阴影字体": "Shadow font", + "额外的html": "Html supplémentaire", + "测试": "Test", + "窗口尺寸": "Dimensions de la fenêtre", + "自动延展": "Extension automatique", + "自动收缩": "Contraction automatique", + "范围框颜色": "Gamme Box couleur", + "伴随游戏窗口": "Accompagner la fenêtre du jeu", + "主题": "Thèmes", + "自动输出": "Sortie automatique", + "引擎": "Moteur", + "注音": "Accent", + "字体缩放": "Zoom de police", + "显示行为": "Afficher le comportement", + "主界面": "Interface principale", + "设置界面": "Configurer l'interface", + "声音": "La voix", + "行为": "Comportement", + "自动化执行": "Exécution automatisée", + "预处理": "Pré - traitement", + "自动化执行方法": "Méthode d'exécution automatisée", + "后处理": "Post - traitement", + "竖向识别": "Identification verticale", + "易错内容修正": "Correction de contenu faillible", + "范围框宽度": "Largeur de la boîte de gamme", + "按钮颜色": "Couleur du bouton", + "按钮大小": "Taille du bouton", + "软件显示语言": "Langue d'affichage du logiciel", + "重启生效": "Redémarrage effectif" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index de4534a4..6c3b9e40 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -21,7 +21,6 @@ "&显示": "& Mostra", "&设置": "& Impostazioni", "&退出": "& Esci", - "欢迎使用": "Benvenuti a", "设置": "istituito", "基本设置": "Impostazioni di base", "选择文本输入源": "Seleziona sorgente di input testo", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Ritardo di aggiornamento (ms)", "OCR设置": "Impostazioni OCR", "本地OCR": "OCR locale", - "OCR最长间隔时间(s)": "Tempo massimo di intervallo OCR (s)", - "OCR最短间隔时间(s)": "Tempo minimo di intervallo OCR (s)", - "OCR范围框颜色": "Colore casella intervallo OCR", - "OCR范围框宽度": "Larghezza casella intervallo OCR", "普通字体": "Carattere normale", "描边字体": "Carattere tratto", "显示设置": "Impostazioni di visualizzazione", @@ -104,7 +99,6 @@ "描边宽度": "Larghezza tratto", "游戏最小化时窗口隐藏": "Nascondi finestra quando il gioco è minimizzato", "游戏窗口移动时同步移动": "Sincronizza il movimento quando la finestra di gioco si muove", - "固定窗口尺寸": "Dimensione finestra fissa", "翻译结果繁简体显示": "Visualizzazione tradizionale e semplificata dei risultati della traduzione", "翻译器显示语言(重启生效)": "Lingua di visualizzazione del traduttore (efficace dopo il riavvio)", "语音设置": "Impostazioni vocali", @@ -158,7 +152,6 @@ "去除重复字符(若为1则自动分析去重)": "Rimuovere i caratteri duplicati (se è 1, analizzare e rimuovere automaticamente i duplicati)", "专有名词翻译设置(游戏ID 0表示全局)": "Impostazioni di traduzione del sostantivo appropriato (ID gioco 0 significa globale)", "密钥": "chiave segreta", - "优化横向OCR漏字": "Ottimizza l'omissione OCR orizzontale", "記号": "Simbolo", "选择文件": "Seleziona file", "缩放时禁用窗口大小调整": "Disabilita il ridimensionamento delle finestre durante lo zoom", @@ -185,7 +178,6 @@ "删除游戏": "Elimina gioco", "和源窗口相同": "Stessa finestra sorgente", "光标缩放系数": "Fattore di scala del cursore", - "使用竖排OCR(效果不佳)": "Uso di OCR verticale (effetto scadente)", "3D游戏模式": "Modalità di gioco 3D", "接続詞": "Prendere parole appropriate", "缩放时调整光标速度": "Regola la velocità del cursore durante lo zoom", @@ -240,7 +232,6 @@ "隐藏延迟(s)": "Nascondi ritardo (s)", "选取OCR范围——立即": "Seleziona intervallo OCR - Immediato", "未查到": "Non trovato", - "OCR识别易错内容修正": "Correzione del contenuto soggetta a errori di riconoscimento OCR", "保存": "conservare", "当前版本": "versione corrente", "最新版本": "Ultima versione", @@ -263,7 +254,6 @@ "编辑专有名词": "Modifica nome proprio", "专有名词翻译设置": "Impostazioni di traduzione del sostantivo corrette", "设置Token": "Imposta gettone", - "分词&假名分析器": "Segmentazione delle parole e analizzatore kana", "内置": "integrato", "token设置": "Impostazioni token", "不同词性颜色(需要Mecab)": "Diverse parti dei colori del discorso (Mecab richiesto)", @@ -271,9 +261,6 @@ "!未选定进程!": "! Nessun processo selezionato!", "该功能可能会导致游戏崩溃!": "Questa funzione può causare il crash del gioco!", "警告": "avviso", - "OCR稳定性阈值": "Soglia di stabilità OCR", - "OCR一致性阈值": "Soglia di coerenza OCR", - "OCR自动化方法": "Metodo di automazione OCR", "文字更新分析": "Analisi dell'aggiornamento del testo", "时间间隔": "intervallo di tempo", "时间周期执行": "Esecuzione del ciclo temporale", @@ -364,7 +351,6 @@ "火山OCR": "OCR del vulcano", "密钥获取": "Acquisizione chiave", "翻译及OCR语言": "Traduzione e linguaggio OCR", - "本软件显示语言(重启生效)": "La lingua di visualizzazione di questo software (entra in vigore dopo il riavvio)", "成功": "successo", "特殊码": "codice specifico", "删除特殊码": "Elimina codice speciale", @@ -578,7 +564,6 @@ "路径不存在": "percorso non esiste", "不处理": "Non gestito", "灰度化": "Scala di grigi", - "OCR预处理方法": "Metodo di pre-elaborazione OCR", "阈值二值化": "binario soglia", "OTSU二值化": "Binarizzazione OTSU", "二值化阈值": "Soglia di binarizzazione", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Sostituisci i nomi delle persone con dati VNDB", "文本输出": "Output testo", "自动输出提取的文本": "Estrai automaticamente il testo estratto", - "输出到剪贴板": "Output negli appunti", - "输出到WebSocket": "Uscita su WebSocket", "缩放": "zoom", "填充": "riempimento", "适应": "adattare", @@ -792,5 +775,33 @@ "调试浏览器": "Browser di debug", "手动翻译": "Traduzione manuale", "显示引擎": "Motore di visualizzazione", - "阴影字体": "Carattere ombra" + "阴影字体": "Carattere ombra", + "额外的html": "HTML aggiuntivo", + "测试": "prova", + "窗口尺寸": "Dimensione finestra", + "自动延展": "Scalamento automatico", + "自动收缩": "Riduzione automatica", + "范围框颜色": "Colore della casella intervallo", + "伴随游戏窗口": "Accompagnando la finestra del gioco", + "主题": "tema", + "自动输出": "Uscita automatica", + "引擎": "motore", + "注音": "Zhuyin", + "字体缩放": "Scalamento dei caratteri", + "显示行为": "Comportamento della visualizzazione", + "主界面": "interfaccia principale", + "设置界面": "Interfaccia impostazioni", + "声音": "voce", + "行为": "comportamento", + "自动化执行": "Esecuzione automatica", + "预处理": "Preelaborazione", + "自动化执行方法": "Metodi di esecuzione automatizzati", + "后处理": "Post-elaborazione", + "竖向识别": "Riconoscimento verticale", + "易错内容修正": "Correzione del contenuto incline agli errori", + "范围框宽度": "Larghezza casella intervallo", + "按钮颜色": "Colore pulsante", + "按钮大小": "Dimensione pulsante", + "软件显示语言": "Linguaggio di visualizzazione del software", + "重启生效": "Il riavvio ha effetto" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index d0f31c74..47ec9511 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -21,7 +21,6 @@ "&显示": "&表示", "&设置": "&設定", "&退出": "&終了", - "欢迎使用": "ようこそ", "设置": "設定#セッテイ#", "基本设置": "基本設定", "选择文本输入源": "テキスト入力ソースの選択", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "リフレッシュ遅延(ms)", "OCR设置": "OCR設定", "本地OCR": "ローカルOCR", - "OCR最长间隔时间(s)": "OCR最長間隔時間(s)", - "OCR最短间隔时间(s)": "OCR最短間隔時間(s)", - "OCR范围框颜色": "OCR範囲ボックス色", - "OCR范围框宽度": "OCR範囲枠幅", "普通字体": "標準フォント", "描边字体": "線フォント", "显示设置": "表示設定", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "ゲームミュートボタンを表示", "游戏最小化时窗口隐藏": "ゲーム最小化時にウィンドウを隠す", "游戏窗口移动时同步移动": "ゲームウィンドウ移動時に同期移動", - "固定窗口尺寸": "固定ウィンドウサイズ", "翻译结果繁简体显示": "翻訳結果の簡体字表示", "翻译器显示语言(重启生效)": "翻訳機表示言語(再起動有効)", "语音设置": "音声設定", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "重複した文字を除去する(1の場合は自動解析で重複除外)", "专有名词翻译设置(游戏ID 0表示全局)": "固有名詞翻訳設定(ゲームID 0はグローバルを表す)", "密钥": "キー", - "优化横向OCR漏字": "最適化された横方向OCRドレイン", "記号": "記号", "选择文件": "ファイルを選択", "缩放时禁用窗口大小调整": "ズーム時にウィンドウのサイズ変更を無効にする", @@ -191,7 +184,6 @@ "删除游戏": "ゲームを削除", "和源窗口相同": "ソースウィンドウと同じ", "光标缩放系数": "カーソルスケーリング係数", - "使用竖排OCR(效果不佳)": "垂直OCRの使用(効果が低い)", "3D游戏模式": "3 Dゲームモード", "接続詞": "接続詞", "缩放时调整光标速度": "ズーム時のカーソル速度の調整", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "隠蔽遅延(s)", "选取OCR范围——立即": "OCR範囲を選択して、すぐに", "未查到": "検出されませんでした", - "OCR识别易错内容修正": "OCR認識エラー内容修正", "保存": "保存#ホゾン#", "当前版本": "現在のバージョン", "最新版本": "最新バージョン", @@ -271,7 +262,6 @@ "编辑专有名词": "固有名詞の編集", "专有名词翻译设置": "固有名詞の翻訳設定", "设置Token": "トークンの設定", - "分词&假名分析器": "単語解析&仮名解析器", "内置": "組み込み", "token设置": "token設定", "不同词性颜色(需要Mecab)": "異なる品詞色(Mecabが必要)", @@ -279,9 +269,6 @@ "!未选定进程!": "!プロセスが選択されていません!", "该功能可能会导致游戏崩溃!": "この機能はゲームをクラッシュさせる可能性があります!", "警告": "に警告", - "OCR稳定性阈值": "OCR安定性閾値", - "OCR一致性阈值": "OCR一貫性閾値", - "OCR自动化方法": "OCR自動化方法", "文字更新分析": "テキスト更新解析", "时间间隔": "時間間隔", "时间周期执行": "タイムサイクル実行", @@ -374,7 +361,6 @@ "火山OCR": "火山OCR", "密钥获取": "鍵の取得", "翻译及OCR语言": "翻訳とOCR言語", - "本软件显示语言(重启生效)": "本ソフトウェアの表示言語(再起動が有効)", "成功": "成功", "特殊码": "とくしゅコード", "删除特殊码": "特殊コードの削除", @@ -578,7 +564,6 @@ "路径不存在": "パスが存在しません", "不处理": "処理しない", "灰度化": "グレースケール", - "OCR预处理方法": "OCR前処理方法", "阈值二值化": "しきい値二値化", "OTSU二值化": "OTSU二値化", "二值化阈值": "二値化閾値", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "VNDBデータを使用した人名の置換", "文本输出": "テキスト出力", "自动输出提取的文本": "抽出されたテキストを自動的に出力", - "输出到剪贴板": "クリップボードに出力", - "输出到WebSocket": "WebSocketに出力", "缩放": "ズーム", "填充": "じゅうてん", "适应": "じゅんのう", @@ -792,5 +775,33 @@ "调试浏览器": "デバッグブラウザ", "手动翻译": "手動翻訳", "显示引擎": "ディスプレイエンジン", - "阴影字体": "シャドウフォント" + "阴影字体": "シャドウフォント", + "额外的html": "余分なhtml", + "测试": "テスト", + "窗口尺寸": "ウィンドウサイズ", + "自动延展": "自動延長", + "自动收缩": "じどうしゅうしゅく", + "范围框颜色": "範囲ボックスの色", + "伴随游戏窗口": "随伴ゲームウィンドウ", + "主题": "トピック#トピック#", + "自动输出": "じどうしゅつりょく", + "引擎": "エンジン台", + "注音": "ルビ", + "字体缩放": "フォントスケール", + "显示行为": "表示動作", + "主界面": "メインインタフェース", + "设置界面": "インタフェースの設定", + "声音": "サウンド", + "行为": "動作", + "自动化执行": "自動実行", + "预处理": "前処理", + "自动化执行方法": "自動実行方法", + "后处理": "後処理", + "竖向识别": "すいちょくしきべつ", + "易错内容修正": "エラー内容修正", + "范围框宽度": "範囲ボックスの幅", + "按钮颜色": "ボタンの色", + "按钮大小": "ボタンサイズ", + "软件显示语言": "ソフトウェア表示言語", + "重启生效": "再起動の有効化" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index ebfe6e31..c0dda76f 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -21,7 +21,6 @@ "&显示": "& 표시", "&设置": "& 설정", "&退出": "& 종료", - "欢迎使用": "시작", "设置": "설치", "基本设置": "기본 설정", "选择文本输入源": "텍스트 입력 소스 선택", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "새로 고침 지연 (ms)", "OCR设置": "OCR 설정", "本地OCR": "로컬 OCR", - "OCR最长间隔时间(s)": "OCR 최대 간격(s)", - "OCR最短间隔时间(s)": "OCR 최소 간격(s)", - "OCR范围框颜色": "OCR 범위 상자 색상", - "OCR范围框宽度": "OCR 범위 상자 폭", "普通字体": "일반 글꼴", "描边字体": "테두리 글꼴", "显示设置": "디스플레이 설정", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "게임 무음 버튼 보이기", "游戏最小化时窗口隐藏": "게임을 최소화할 때 창 숨기기", "游戏窗口移动时同步移动": "게임 창 이동 시 동기화", - "固定窗口尺寸": "고정 창 크기", "翻译结果繁简体显示": "번역 결과 요약 표시", "翻译器显示语言(重启生效)": "번역기 표시 언어 (재시작 적용)", "语音设置": "음성 설정", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "중복 문자 제거 (1인 경우 자동으로 분석 중복 제거)", "专有名词翻译设置(游戏ID 0表示全局)": "고유 명사 번역 설정(게임 ID 0은 전역을 나타냄)", "密钥": "키", - "优化横向OCR漏字": "가로 OCR 누수 최적화", "記号": "기호", "选择文件": "파일 선택", "缩放时禁用窗口大小调整": "확대 / 축소 시 창 크기 조정 비활성화", @@ -191,7 +184,6 @@ "删除游戏": "게임 삭제", "和源窗口相同": "소스 창과 동일", "光标缩放系数": "커서 배율 계수", - "使用竖排OCR(效果不佳)": "세로 OCR 사용(좋지 않음)", "3D游戏模式": "3D 게임 모드", "接続詞": "접속어", "缩放时调整光标速度": "확대 / 축소 시 커서 속도 조정", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "지연 숨기기 (s)", "选取OCR范围——立即": "OCR 범위 선택 - 지금", "未查到": "찾을 수 없음", - "OCR识别易错内容修正": "OCR 인식 오류 수정 내용", "保存": "저장", "当前版本": "현재 버전", "最新版本": "최신 버전", @@ -271,7 +262,6 @@ "编辑专有名词": "고유 명사 편집", "专有名词翻译设置": "고유 명사 번역 설정", "设置Token": "Token 설정", - "分词&假名分析器": "분사 & 가명 분석기", "内置": "내장형", "token设置": "token 설정", "不同词性颜色(需要Mecab)": "다른 단어 색상(Mecab 필요)", @@ -279,9 +269,6 @@ "!未选定进程!": "!선택한 프로세스가 없습니다!", "该功能可能会导致游戏崩溃!": "이 기능은 게임 충돌을 일으킬 수 있습니다!", "警告": "경고", - "OCR稳定性阈值": "OCR 안정성 임계값", - "OCR一致性阈值": "OCR 정합성 보장 임계값", - "OCR自动化方法": "OCR 자동화 방법", "文字更新分析": "텍스트 업데이트 분석", "时间间隔": "시간 간격", "时间周期执行": "시간 주기 실행", @@ -374,7 +361,6 @@ "火山OCR": "화산 OCR", "密钥获取": "키 가져오기", "翻译及OCR语言": "번역 및 OCR 언어", - "本软件显示语言(重启生效)": "이 소프트웨어 표시 언어 (재시작 적용)", "成功": "성공", "特殊码": "특수 코드", "删除特殊码": "특수 코드 삭제", @@ -578,7 +564,6 @@ "路径不存在": "경로가 없습니다.", "不处理": "처리하지 않음", "灰度化": "그레이스케일", - "OCR预处理方法": "OCR 사전 처리 방법", "阈值二值化": "임계값 2값화", "OTSU二值化": "OTSU 이치화", "二值化阈值": "2값화 임계값", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "VNDB 데이터로 사람 이름 바꾸기", "文本输出": "텍스트 출력", "自动输出提取的文本": "추출된 텍스트 자동 내보내기", - "输出到剪贴板": "클립보드로 내보내기", - "输出到WebSocket": "WebSocket으로 내보내기", "缩放": "줌", "填充": "채우기", "适应": "적응", @@ -792,5 +775,33 @@ "调试浏览器": "디버그 브라우저", "手动翻译": "수동 번역", "显示引擎": "디스플레이 엔진", - "阴影字体": "그림자 글꼴" + "阴影字体": "그림자 글꼴", + "额外的html": "추가 html", + "测试": "테스트", + "窗口尺寸": "창 크기", + "自动延展": "자동 확장", + "自动收缩": "자동 수축", + "范围框颜色": "범위 상자 색상", + "伴随游戏窗口": "게임 창과 함께", + "主题": "주제", + "自动输出": "자동 출력", + "引擎": "엔진", + "注音": "주음", + "字体缩放": "글꼴 크기 조절", + "显示行为": "표시 동작", + "主界面": "메인 인터페이스", + "设置界面": "인터페이스 설정", + "声音": "소리", + "行为": "행위", + "自动化执行": "자동화된 실행", + "预处理": "사전 처리", + "自动化执行方法": "자동화된 실행 방법", + "后处理": "후처리", + "竖向识别": "세로 인식", + "易错内容修正": "잘못된 내용 수정", + "范围框宽度": "범위 상자 너비", + "按钮颜色": "버튼 색상", + "按钮大小": "버튼 크기", + "软件显示语言": "소프트웨어 디스플레이 언어", + "重启生效": "재시작 유효" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index b5febdd0..dc783f42 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -21,7 +21,6 @@ "&显示": "&Wyświetlacz", "&设置": "&Ustawienia", "&退出": "&Wyjście", - "欢迎使用": "Witamy w", "设置": "ustawić", "基本设置": "Ustawienia podstawowe", "选择文本输入源": "Wybierz źródło wejścia tekstu", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Opóźnienie odświeżania (ms)", "OCR设置": "Ustawienia OCR", "本地OCR": "Lokalne OCR", - "OCR最长间隔时间(s)": "Maksymalny czas interwału OCR (s)", - "OCR最短间隔时间(s)": "Minimalny czas interwału OCR (s)", - "OCR范围框颜色": "Kolor pola zakresu OCR", - "OCR范围框宽度": "Szerokość pola zakresu OCR", "普通字体": "Normalna czcionka", "描边字体": "Czcionka kresu", "显示设置": "Ustawienia wyświetlania", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Pokaż przycisk wyciszenia gry", "游戏最小化时窗口隐藏": "Ukryj okno, gdy gra jest zminimalizowana", "游戏窗口移动时同步移动": "Synchronizuj ruch podczas poruszania się okna gry", - "固定窗口尺寸": "Stały rozmiar okna", "翻译结果繁简体显示": "Tradycyjne i uproszczone wyświetlanie wyników tłumaczeń", "翻译器显示语言(重启生效)": "Język wyświetlania tłumacza (skuteczny po ponownym uruchomieniu)", "语音设置": "Ustawienia głosu", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Usuń duplikaty znaków (jeśli jest to 1, automatycznie analizuj i usuń duplikaty)", "专有名词翻译设置(游戏ID 0表示全局)": "Ustawienia tłumaczenia rzeczownika właściwego (ID gry 0 oznacza globalny)", "密钥": "tajny klucz", - "优化横向OCR漏字": "Optymalizuj poziome pominięcie OCR", "記号": "Symbol", "选择文件": "Wybierz plik", "缩放时禁用窗口大小调整": "Wyłącz zmianę rozmiaru okna podczas powiększania", @@ -191,7 +184,6 @@ "删除游戏": "Usuń grę", "和源窗口相同": "Tak samo jak okno źródłowe", "光标缩放系数": "Współczynnik skalowania kursora", - "使用竖排OCR(效果不佳)": "Zastosowanie pionowego OCR (słaby efekt)", "3D游戏模式": "Tryb gry 3D", "接続詞": "Przyjmowanie odpowiednich słów", "缩放时调整光标速度": "Dostosowanie prędkości kursora podczas powiększania", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Ukryj opóźnienie (s)", "选取OCR范围——立即": "Wybierz zakres OCR. Natychmiastowy", "未查到": "Nie znaleziono", - "OCR识别易错内容修正": "Korekta treści podatna na błędy rozpoznawania OCR", "保存": "konserwacja", "当前版本": "bieżąca wersja", "最新版本": "Najnowsza wersja", @@ -271,7 +262,6 @@ "编辑专有名词": "Edytuj rzeczownik właściwy", "专有名词翻译设置": "Ustawienia tłumaczenia właściwego rzeczownika", "设置Token": "Ustaw token", - "分词&假名分析器": "Segmentacja słów i analizator kana", "内置": "wbudowany", "token设置": "Ustawienia tokenu", "不同词性颜色(需要Mecab)": "Różne części kolorów mowy (wymagany mecab)", @@ -279,9 +269,6 @@ "!未选定进程!": "! Nie wybrano procesu!", "该功能可能会导致游戏崩溃!": "Ta funkcja może spowodować awarię gry!", "警告": "ostrzeżenie", - "OCR稳定性阈值": "Próg stabilności OCR", - "OCR一致性阈值": "Próg spójności OCR", - "OCR自动化方法": "Metoda automatyzacji OCR", "文字更新分析": "Analiza aktualizacji tekstu", "时间间隔": "przedział czasowy", "时间周期执行": "Wykonanie cyklu czasowego", @@ -374,7 +361,6 @@ "火山OCR": "OCR wulkanu", "密钥获取": "Kluczowe nabycie", "翻译及OCR语言": "Tłumaczenia i język OCR", - "本软件显示语言(重启生效)": "Język wyświetlania tego oprogramowania (wchodzi w życie po ponownym uruchomieniu)", "成功": "sukces", "特殊码": "kod szczegółowy", "删除特殊码": "Usuń kod specjalny", @@ -578,7 +564,6 @@ "路径不存在": "ścieżka nie istnieje", "不处理": "Nie obsługiwane", "灰度化": "Skala szarości", - "OCR预处理方法": "Metoda wstępnego przetwarzania OCR", "阈值二值化": "Binaryzacja progu", "OTSU二值化": "Binaryzacja OTSU", "二值化阈值": "Próg binaryzacji", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Zastąp nazwiska osób na dane VNDB", "文本输出": "Wyjście tekstowe", "自动输出提取的文本": "Automatycznie wyświetlać wyodrębniony tekst", - "输出到剪贴板": "Wyjście do schowka", - "输出到WebSocket": "Wyjście do WebSocket", "缩放": "powiększenie", "填充": "napełnienie", "适应": "dostosować się", @@ -792,5 +775,33 @@ "调试浏览器": "Debugowanie przeglądarki", "手动翻译": "Tłumaczenie ręczne", "显示引擎": "Silnik wyświetlania", - "阴影字体": "Czcionka cienia" + "阴影字体": "Czcionka cienia", + "额外的html": "Dodatkowy HTML", + "测试": "badanie", + "窗口尺寸": "Rozmiar okna", + "自动延展": "Automatyczne skalowanie", + "自动收缩": "Automatyczne kurczenie", + "范围框颜色": "Kolor pola zakresu", + "伴随游戏窗口": "Towarzyszące oknie gry", + "主题": "motyw", + "自动输出": "Automatyczne wyjście", + "引擎": "silnik", + "注音": "Zhuyin.", + "字体缩放": "Skalowanie czcionki", + "显示行为": "Zachowanie wyświetlania", + "主界面": "główny interfejs", + "设置界面": "Interfejs ustawień", + "声音": "głos", + "行为": "zachowanie", + "自动化执行": "Automatyczne wykonanie", + "预处理": "Przetwarzanie wstępne", + "自动化执行方法": "Automatyczne metody wykonywania", + "后处理": "Przetwarzanie po przetwarzaniu", + "竖向识别": "Rozpoznawanie pionowe", + "易错内容修正": "Korekta zawartości podatnej na błędy", + "范围框宽度": "Szerokość pola zakresu", + "按钮颜色": "Kolor przycisku", + "按钮大小": "Rozmiar przycisku", + "软件显示语言": "Język wyświetlania oprogramowania", + "重启生效": "Ponowne uruchomienie wchodzi w życie" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index 971f313f..afc1d2ce 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -21,7 +21,6 @@ "&显示": "& Показать", "&设置": "& Настройка", "&退出": "& Выход", - "欢迎使用": "Добро пожаловать!", "设置": "Настройки", "基本设置": "Основные настройки", "选择文本输入源": "Выбор источника", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Задержка обновления (ms)", "OCR设置": "Настройки OCR", "本地OCR": "Локальный OCR", - "OCR最长间隔时间(s)": "Максимальный интервал (s)", - "OCR最短间隔时间(s)": "Минимальный интервал (s)", - "OCR范围框颜色": "Цвет рамки распознавания", - "OCR范围框宽度": "Ширина рамки распознавания", "普通字体": "Обычный шрифт", "描边字体": "Жирный шрифт", "显示设置": "Настройки дисплея", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Кнопка звука в игре", "游戏最小化时窗口隐藏": "Скрыть окно при сворачивании игры", "游戏窗口移动时同步移动": "Синхронизировать перемещение окна игры", - "固定窗口尺寸": "Фиксированный размер окна", "翻译结果繁简体显示": "Отображение результатов перевода", "翻译器显示语言(重启生效)": "Язык переводчика (Необходим перезапуск)", "语音设置": "Настройка звука", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Удалить повторяющиеся символы (1 - автоматически)", "专有名词翻译设置(游戏ID 0表示全局)": "Настройка перевода имен собственных (идентификатор игры 0 означает глобальный)", "密钥": "Ключ", - "优化横向OCR漏字": "Оптимизация горизонтального распознавания пропущенных слов", "記号": "знак", "选择文件": "Выбор файла", "缩放时禁用窗口大小调整": "Отключить изменение размера окна при масштабировании", @@ -191,7 +184,6 @@ "删除游戏": "Удалить игру", "和源窗口相同": "& исток окна", "光标缩放系数": "коэффициент масштабирования курсора", - "使用竖排OCR(效果不佳)": "использовать распознавание по вертикали (плохо работает)", "3D游戏模式": "режим игры 3D", "接続詞": "слова", "缩放时调整光标速度": "изменение скорости курсора при масштабировании", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Задержка скрытия (s)", "选取OCR范围——立即": "Выбрать диапазон распознавания при нажатии", "未查到": "обнаружить", - "OCR识别易错内容修正": "коррекция распознавания распознаваемых элементов", "保存": "Сохранить", "当前版本": "Текущая версия", "最新版本": "Последняя версия", @@ -271,7 +262,6 @@ "编辑专有名词": "Редактирование собственных терминов", "专有名词翻译设置": "Параметры перевода собственных терминов", "设置Token": "Настройка Token", - "分词&假名分析器": "Анализатор словосочетаний и псевдонимов", "内置": "Встроенные", "token设置": "Настройка Token", "不同词性颜色(需要Mecab)": "Разные цвета слов (требуется Mecab)", @@ -279,9 +269,6 @@ "!未选定进程!": "Эй! Не выбранный процесс!", "该功能可能会导致游戏崩溃!": "Эта функция может привести к сбою игры!", "警告": "предупреждение", - "OCR稳定性阈值": "Порог стабильности OCR", - "OCR一致性阈值": "Порог согласованности OCR", - "OCR自动化方法": "Метод автоматизации OCR", "文字更新分析": "Анализ текстовых обновлений", "时间间隔": "Временные интервалы", "时间周期执行": "Сроки осуществления", @@ -374,7 +361,6 @@ "火山OCR": "Вулкан OCR", "密钥获取": "Получение ключей", "翻译及OCR语言": "Перевод и язык OCR", - "本软件显示语言(重启生效)": "Программа отображает язык (перезагрузка вступает в силу)", "成功": "Успех", "特殊码": "Специальный код", "删除特殊码": "Удалить специальный код", @@ -578,7 +564,6 @@ "路径不存在": "Путь не существует", "不处理": "Не обрабатывать", "灰度化": "Серость", - "OCR预处理方法": "Метод предварительной обработки OCR", "阈值二值化": "Пороговая двузначность", "OTSU二值化": "Бинализация OTSU", "二值化阈值": "Порог двузначности", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Использование данных VNDB для замены имен", "文本输出": "Вывод текста", "自动输出提取的文本": "Автоматический вывод извлеченного текста", - "输出到剪贴板": "Экспорт в буфер обмена", - "输出到WebSocket": "Экспорт в WebSocket", "缩放": "Масштаб", "填充": "Заполнение", "适应": "Адаптация", @@ -792,5 +775,33 @@ "调试浏览器": "Отладка браузера", "手动翻译": "Ручной перевод", "显示引擎": "Показать движок", - "阴影字体": "Шрифт теней" + "阴影字体": "Шрифт теней", + "额外的html": "Дополнительный HTML", + "测试": "Испытания", + "窗口尺寸": "Размер окна", + "自动延展": "Автоматическое расширение", + "自动收缩": "Автосокращение", + "范围框颜色": "Цвет рамки", + "伴随游戏窗口": "Окно сопровождающей игры", + "主题": "Тема", + "自动输出": "Автоматический вывод", + "引擎": "Двигатель", + "注音": "Звук", + "字体缩放": "Масштаб шрифта", + "显示行为": "Показать поведение", + "主界面": "Главный интерфейс", + "设置界面": "Настройка интерфейса", + "声音": "Голос", + "行为": "Поведение", + "自动化执行": "Автоматизированное выполнение", + "预处理": "Предварительная обработка", + "自动化执行方法": "Автоматизированные методы осуществления", + "后处理": "Обработка", + "竖向识别": "Вертикальное распознавание", + "易错内容修正": "Исправление ошибок", + "范围框宽度": "Ширина рамки", + "按钮颜色": "Цвет кнопки", + "按钮大小": "Размер кнопки", + "软件显示语言": "Язык отображения программного обеспечения", + "重启生效": "Перезагрузка вступает в силу" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 9370eabe..97017082 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -5,7 +5,6 @@ "显示编辑按钮": "แสดงปุ่มแก้ไข", "过滤换行符": "กรองบรรทัดแบ่ง", "绑定窗口(部分软件不支持)(点击自己取消)": "หน้าต่างผูกพัน (บางส่วนของซอฟต์แวร์ไม่รองรับ) (คลิกที่ตัวเองเพื่อยกเลิก)", - "OCR最长间隔时间(s)": "ช่วงเวลา OCR สูงสุด (s)", "文本设置": "การตั้งค่าข้อความ", "过滤数字": "กรองตัวเลข", "插入特殊码": "แทรกรหัสพิเศษ", @@ -80,12 +79,10 @@ "图标2": "ไอคอน 2", "如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "หากคุณรู้สึกว่าซอฟต์แวร์นี้เป็นประโยชน์สำหรับคุณยินดีต้อนรับสู่การสนับสนุนการสแกนรหัส WeChat ขอบคุณ ~", "前景窗口截屏": "ภาพหน้าจอของหน้าต่างเบื้องหน้า", - "OCR最短间隔时间(s)": "OCR ช่วงเวลาสั้นที่สุด (s)", "自动获取系统代理": "รับพร็อกซีระบบอัตโนมัติ", "是否使用快捷键": "จะใช้ปุ่มลัดหรือไม่", "历史翻译": "การแปลประวัติศาสตร์", "最小化到托盘": "ลดขนาดลงในถาด", - "欢迎使用": "ยินดีต้อนรับสู่", "打开目录": "เปิดไดเรกทอรี", "手动设置代理(ip:port)": "ตั้งค่าพร็อกซี่ด้วยตนเอง (ip: port)", "录制翻译文件": "บันทึกไฟล์แปล", @@ -113,7 +110,6 @@ "将汉字转换成繁体/日式汉字": "แปลงคันจิเป็นตัวอักษรจีนแบบดั้งเดิม/ญี่ปุ่น", "失败": "ล้มเหลว", "token设置": "การตั้งค่า token", - "固定窗口尺寸": "แก้ไขขนาดหน้าต่าง", "简体中文(CP936,GBK)": "ภาษาจีนตัวย่อ (CP936, GBK)", "其他": "อื่นๆ", "设置所有词条为全局词条": "ตั้งค่ารายการทั้งหมดเป็นรายการทั่วโลก", @@ -151,13 +147,11 @@ "繁简转换": "การแปลงที่ง่ายดาย", "设置": "การตั้งค่า", "接受的编码": "การเข้ารหัสที่ยอมรับ", - "OCR自动化方法": "วิธีการอัตโนมัติ OCR", "专有名词翻译设置(游戏ID 0表示全局)": "การตั้งค่าการแปลคำนามที่เป็นกรรมสิทธิ์ (เกม ID 0 หมายถึงทั่วโลก)", "自定义搜索": "ปรับแต่งการค้นหา", "補助記号": "เครื่องหมายเงินอุดหนุน", "小学馆辞书": "หนังสือลาออกจากโรงเรียนประถมศึกษา", "项目地址": "ที่อยู่โครงการ", - "OCR稳定性阈值": "เกณฑ์ความเสถียรของ OCR", "内嵌的翻译器": "นักแปลแบบอินไลน์", "高级": "ระดับพรีเมี่ยม", "查词": "ค้นหาคำ", @@ -168,11 +162,9 @@ "显示": "แสดง", "选择文本输入源": "เลือกแหล่งป้อนข้อความ", "获取中": "ได้รับ", - "分词&假名分析器": "วิเคราะห์คำและนามแฝง", "接頭辞": "คำพูดร่วม", "注册在线翻译": "ลงทะเบียนการแปลออนไลน์", "泰语": "ภาษาไทย", - "优化横向OCR漏字": "เพิ่มประสิทธิภาพการรั่วไหลของ OCR ด้านข้าง", "win7适配版": "win7 รุ่นปรับ", "导出sqlite文件为json文件": "ส่งออกไฟล์ sqlite เป็นไฟล์ json", "搜狗": "ค้นหาหมา", @@ -226,9 +218,7 @@ "显示复制原文按钮": "แสดงปุ่มคัดลอกต้นฉบับ", "希伯来语": "ภาษาฮิบรู", "非管理员": "ไม่ใช่ผู้ดูแลระบบ", - "OCR范围框颜色": "สีของกล่องช่วง OCR", "助詞": "คำช่วย", - "使用竖排OCR(效果不佳)": "ใช้แถวแนวตั้ง OCR (ไม่ได้ผล)", "离线翻译": "การแปลออฟไลน์", "東北イタコ/东北伊达子": "ทัวร์โทโฮคุ / โทโฮคุอิดะโกะ", "开始搜索": "เริ่มการค้นหา", @@ -292,7 +282,6 @@ "时间间隔": "ช่วงเวลา", "去除重复字符(若为1则自动分析去重)": "ลบอักขระที่ซ้ำกัน (วิเคราะห์น้ำหนักโดยอัตโนมัติถ้าเป็น 1)", "搜索特殊码": "ค้นหารหัสพิเศษ", - "OCR一致性阈值": "เกณฑ์ความสอดคล้องของ OCR", "复制特殊码": "คัดลอกรหัสพิเศษ", "图像稳定性阈值": "เกณฑ์ความเสถียรของภาพ", "不能为空": "ไม่สามารถว่างได้", @@ -356,8 +345,6 @@ "感動詞": "สัมผัสคำ", "西里尔": "ไซริล", "设置代码页": "ตั้งค่าหน้ารหัส", - "本软件显示语言(重启生效)": "ซอฟต์แวร์นี้แสดงภาษา (การรีสตาร์ทมีผล)", - "OCR范围框宽度": "OCR ช่วงความกว้างของกรอบ", "保存路径": "บันทึกพาธ", "编辑": "บรรณาธิการ", "ついなちゃん": "ついなちゃん", @@ -548,7 +535,6 @@ "所选文件格式错误!": "รูปแบบแฟ้มที่เลือกไม่ถูกต้อง!", "显示移动按钮": "แสดงปุ่มย้าย", "单次负载个数": "จำนวนชิ้นโหลดเดียว", - "OCR识别易错内容修正": "OCR ระบุการแก้ไขเนื้อหาที่ผิดพลาดได้ง่าย", "过滤英文字母": "กรองตัวอักษรภาษาอังกฤษ", "过滤包含乱码的文本行": "กรองบรรทัดข้อความที่มีรหัสยุ่งเหยิง", "进行一次OCR": "ทำ OCR หนึ่งครั้ง", @@ -578,7 +564,6 @@ "路径不存在": "เส้นทางไม่มีอยู่", "不处理": "ไม่ได้รับการจัดการ", "灰度化": "ระดับสีเทา", - "OCR预处理方法": "วิธีการปรับสภาพ OCR", "阈值二值化": "เกณฑ์ Dualization", "OTSU二值化": "OTSU สอง", "二值化阈值": "เกณฑ์การทำให้เป็นสองเท่า", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "แทนที่ชื่อบุคคลด้วยข้อมูล VNDB", "文本输出": "ข้อความออก", "自动输出提取的文本": "ส่งออกข้อความที่สกัดโดยอัตโนมัติ", - "输出到剪贴板": "ส่งออกไปยังคลิปบอร์ด", - "输出到WebSocket": "ส่งออกไปยัง WebSocket", "缩放": "ซูม", "填充": "เติม", "适应": "การปรับตัว", @@ -792,5 +775,33 @@ "调试浏览器": "ดีบักเบราว์เซอร์", "手动翻译": "การแปลด้วยตนเอง", "显示引擎": "แสดงเครื่องยนต์", - "阴影字体": "Shadow ตัวอักษร" + "阴影字体": "Shadow ตัวอักษร", + "额外的html": "HTML เพิ่มเติม", + "测试": "การทดสอบ", + "窗口尺寸": "ขนาดหน้าต่าง", + "自动延展": "ขยายอัตโนมัติ", + "自动收缩": "หดอัตโนมัติ", + "范围框颜色": "สีของกล่องช่วง", + "伴随游戏窗口": "มาพร้อมกับหน้าต่างเกม", + "主题": "หัวข้อ", + "自动输出": "เอาท์พุทอัตโนมัติ", + "引擎": "เครื่องยนต์", + "注音": "หมายเหตุ", + "字体缩放": "ปรับขนาดตัวอักษร", + "显示行为": "แสดงพฤติกรรม", + "主界面": "อินเตอร์เฟซหลัก", + "设置界面": "ตั้งค่าอินเตอร์เฟซ", + "声音": "เสียง", + "行为": "พฤติกรรม", + "自动化执行": "การดำเนินการอัตโนมัติ", + "预处理": "การปรับสภาพ", + "自动化执行方法": "วิธีการดำเนินการอัตโนมัติ", + "后处理": "โพสต์การประมวลผล", + "竖向识别": "การรับรู้ในแนวตั้ง", + "易错内容修正": "แก้ไขเนื้อหาที่ผิดง่าย", + "范围框宽度": "ความกว้างของกรอบช่วง", + "按钮颜色": "สีปุ่ม", + "按钮大小": "ขนาดปุ่ม", + "软件显示语言": "ภาษาการแสดงผลของซอฟต์แวร์", + "重启生效": "การรีสตาร์ทมีผล" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 079f8e86..e5d5561b 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -21,7 +21,6 @@ "&显示": "& Gösterim", "&设置": "& Ayarlar", "&退出": "& Çıkın", - "欢迎使用": "Hoşgeldiniz.", "设置": "ayarlandır", "基本设置": "Temel ayarlar", "选择文本输入源": "Metin girdi kaynağını seç", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Yeniden geçirme (ms)", "OCR设置": "OCR ayarları", "本地OCR": "Yerel OCR", - "OCR最长间隔时间(s)": "Maksimum OCR aralığı (s)", - "OCR最短间隔时间(s)": "Minimum OCR aralığı (s)", - "OCR范围框颜色": "OCR Aralık Kutusu Rengi", - "OCR范围框宽度": "OCR menzili kutu genişliği", "普通字体": "Normal yazıtipi", "描边字体": "Sıçrama yazıtipi", "显示设置": "Gösterim ayarları", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Oyun sessiz düğmesini göster", "游戏最小化时窗口隐藏": "Oyun azaltıldığında gizlenen pencere", "游戏窗口移动时同步移动": "Oyun penceresi hareket ettiğinde eşzamanlı hareket et", - "固定窗口尺寸": "Tam pencere ölçüsi", "翻译结果繁简体显示": "Çeviri sonuçlarının geleneksel ve basitleştirilmesi", "翻译器显示语言(重启生效)": "Çevirme dili (yeniden başlatma etkisi oluyor)", "语音设置": "Ses ayarları", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Çiftli karakterleri sil (1 ise otomatik analiz edilecek ve silecek)", "专有名词翻译设置(游戏ID 0表示全局)": "Özel isim tercüme ayarları (oyun kimliği 0 küresel gösteriyor)", "密钥": "gizli anahtar", - "优化横向OCR漏字": "Ufqiy OCR itirazını iyileştir", "記号": "Simbol", "选择文件": "Dosya Seç", "缩放时禁用窗口大小调整": "Ulaştırırken pencere ölçüsünü değiştirmeyi etkinleştir", @@ -191,7 +184,6 @@ "删除游戏": "Oyunu sil", "和源窗口相同": "Kaynak penceresi gibi aynı", "光标缩放系数": "İmleç büyüme faktörü", - "使用竖排OCR(效果不佳)": "Dikey OCR kullan (kötü etki)", "3D游戏模式": "3B oyun modu", "接続詞": "Doğru kelimelere uyun", "缩放时调整光标速度": "Yetiştirildiğinde kursor hızını ayarla", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Gizli gecikme (s)", "选取OCR范围——立即": "OCR menzilini seç - hemen", "未查到": "Bulmadı", - "OCR识别易错内容修正": "OCR kimliğin hatası içerik düzeltmesini yakın düzeltme", "保存": "koruması", "当前版本": "şu anki sürüm", "最新版本": "Son sürüm", @@ -271,7 +262,6 @@ "编辑专有名词": "Doğru isimleri düzenle", "专有名词翻译设置": "Özel isim çeviri ayarları", "设置Token": "Token ayarlayın", - "分词&假名分析器": "Participle&kana analizicisi", "内置": "in şa edilmiş", "token设置": "Token ayarları", "不同词性颜色(需要Mecab)": "Konuşma renklerinin farklı parçaları (Mecab gerekli)", @@ -279,9 +269,6 @@ "!未选定进程!": "- Ne? İşlemiz seçilmedi!", "该功能可能会导致游戏崩溃!": "Bu fonksiyon oyunu mahvedebilir!", "警告": "uyarı", - "OCR稳定性阈值": "OCR stabillik sınırı", - "OCR一致性阈值": "OCR konsistenci eşiği", - "OCR自动化方法": "OCR otomatik yöntemi", "文字更新分析": "Metin güncelleştirme analizi", "时间间隔": "Zaman aralığı", "时间周期执行": "Zaman döngüsü çalışması", @@ -374,7 +361,6 @@ "火山OCR": "Volkan OCR", "密钥获取": "Anahtar alma", "翻译及OCR语言": "Çeviri ve OCR dili", - "本软件显示语言(重启生效)": "Yazılımın dilini göster (yeniden başlatma etkisi alır)", "成功": "başarılı", "特殊码": "özel kodu", "删除特殊码": "Özel kodu sil", @@ -578,7 +564,6 @@ "路径不存在": "yol yok", "不处理": "İdare edilmemiş", "灰度化": "Grayscale", - "OCR预处理方法": "OCR ön işleme yöntemi", "阈值二值化": "Eşit ikinizasyonu", "OTSU二值化": "OTSU ikinizasyonu", "二值化阈值": "Binarizasyon eşiği", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "İnsan isimlerini VNDB veriyle değiştir", "文本输出": "Metin çıkış", "自动输出提取的文本": "Automatically output extracted text", - "输出到剪贴板": "Output to clipboard", - "输出到WebSocket": "WebSocket'e çıkış", "缩放": "zoom", "填充": "dolduruyor", "适应": "adapt", @@ -792,5 +775,33 @@ "调试浏览器": "Hata ayıklama tarayıcısı", "手动翻译": "Elle çevirim", "显示引擎": "Gösterim Motoru", - "阴影字体": "Gölge yazıtipi" + "阴影字体": "Gölge yazıtipi", + "额外的html": "Ekstra HTML", + "测试": "test", + "窗口尺寸": "Pencere ölçüsi", + "自动延展": "Otomatik Ölçüm", + "自动收缩": "Otomatik küçük", + "范围框颜色": "Aralık kutusu rengi", + "伴随游戏窗口": "Oyun penceresini birleştiriyor", + "主题": "tema", + "自动输出": "Otomatik çıkış", + "引擎": "motor", + "注音": "Zhuyin", + "字体缩放": "Yazıtipi ölçü", + "显示行为": "Davranışlarını göster", + "主界面": "Ana arayüz", + "设置界面": "Ayarlar arayüzü", + "声音": "sesi", + "行为": "davranış", + "自动化执行": "Otomatik çalışma", + "预处理": "Ön işleme", + "自动化执行方法": "Otomatik çalışma metodları", + "后处理": "İşlemi", + "竖向识别": "Dikey tanıma", + "易错内容修正": "İçindeki düzeltme sırasında hata", + "范围框宽度": "Aralık kutusu genişliği", + "按钮颜色": "Düğme rengi", + "按钮大小": "Düğme ölçüsi", + "软件显示语言": "Yazılım Gösterim Dili", + "重启生效": "Yeniden başlatma etkisi oluyor" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index 80ff98a3..4e3eb1e4 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -21,7 +21,6 @@ "&显示": "& Показати", "&设置": "& Параметри", "&退出": "& Вийти", - "欢迎使用": "Ласкаво просимо до", "设置": "встановлено", "基本设置": "Основні параметри", "选择文本输入源": "Виберіть джерело вводу тексту", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Оновити затримку (мс)", "OCR设置": "Параметри OCR", "本地OCR": "Локальний OCR", - "OCR最长间隔时间(s)": "OCR maximum interval time (s)", - "OCR最短间隔时间(s)": "Мінімальний час інтервалу OCR (с)", - "OCR范围框颜色": "Колір діапазону OCR", - "OCR范围框宽度": "Ширина діапазону OCR", "普通字体": "Звичайний шрифт", "描边字体": "Шрифт удару", "显示设置": "Параметри показу", @@ -104,7 +99,6 @@ "描边宽度": "Ширина", "游戏最小化时窗口隐藏": "Сховати вікно під час мінімізації гри", "游戏窗口移动时同步移动": "Синхронізувати рух під час пересування вікна гри", - "固定窗口尺寸": "Визначений розмір вікна", "翻译结果繁简体显示": "Традиційний і спрощений показ результатів перекладу", "翻译器显示语言(重启生效)": "Мова показу перекладача (ефективна після перезапуску)", "语音设置": "Параметри голосу", @@ -158,7 +152,6 @@ "去除重复字符(若为1则自动分析去重)": "Вилучити дублікати символи (якщо це 1, автоматично аналізувати і вилучити дублікати)", "专有名词翻译设置(游戏ID 0表示全局)": "Параметри перекладу належної назви (ІД гри 0 означає глобальну)", "密钥": "секретний ключ", - "优化横向OCR漏字": "Оптимізувати горизонтальну пропуску OCR", "記号": "Символ", "选择文件": "Виберіть файл", "缩放时禁用窗口大小调整": "Вимкнути зміну розміру вікна під час масштабу", @@ -185,7 +178,6 @@ "删除游戏": "Вилучити гру", "和源窗口相同": "Те ж саме, що і вікно джерела", "光标缩放系数": "Фактор масштабу курсора", - "使用竖排OCR(效果不佳)": "Використання вертикального OCR (поганий ефект)", "3D游戏模式": "Режим 3D гри", "接続詞": "Прийняття відповідних слов", "缩放时调整光标速度": "Змінити швидкість курсора під час масштабу", @@ -240,7 +232,6 @@ "隐藏延迟(s)": "Сховати затримку (s)", "选取OCR范围——立即": "Виберіть діапазон OCR — Негайно", "未查到": "Не знайдено", - "OCR识别易错内容修正": "Виправлення вмісту схильного до помилок розпізнавання OCR", "保存": "збереження", "当前版本": "поточна версія", "最新版本": "Остання версія", @@ -263,7 +254,6 @@ "编辑专有名词": "Змінити правильну назву", "专有名词翻译设置": "Власні параметри перекладу назв", "设置Token": "Встановити позначку", - "分词&假名分析器": "Сегментація слів і аналізатор kana", "内置": "вбудований", "token设置": "Параметри символів", "不同词性颜色(需要Mecab)": "Різні частини кольорів мовлення (потрібен Mecab)", @@ -271,9 +261,6 @@ "!未选定进程!": "[UNK] Не вибрано жодного процесу!", "该功能可能会导致游戏崩溃!": "Ця можливість може призвести до аварії гри!", "警告": "попередження", - "OCR稳定性阈值": "Праг стабільності OCR", - "OCR一致性阈值": "OCR consistency threshold", - "OCR自动化方法": "Метод автоматизації OCR", "文字更新分析": "Аналіз оновлення тексту", "时间间隔": "інтервал часу", "时间周期执行": "Виконання часового циклу", @@ -364,7 +351,6 @@ "火山OCR": "Волкановий ОКР", "密钥获取": "Отримання ключа", "翻译及OCR语言": "Переклад і мова OCR", - "本软件显示语言(重启生效)": "Мова показу цього програмного забезпечення (впливає після перезапуску)", "成功": "успіх", "特殊码": "специфічний код", "删除特殊码": "Вилучити спеціальний код", @@ -578,7 +564,6 @@ "路径不存在": "шлях не існує", "不处理": "Не оброблено", "灰度化": "Сірі skalи", - "OCR预处理方法": "Метод переробки OCR", "阈值二值化": "Бінарізація межі", "OTSU二值化": "Бінарізація OTSU", "二值化阈值": "Праг бінарізації", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Замінити назви людей даними VNDB", "文本输出": "Вивід тексту", "自动输出提取的文本": "Автоматично виводити вилучений текст", - "输出到剪贴板": "Вивід до буфера обміну даними", - "输出到WebSocket": "Вивід у веб- сокет", "缩放": "масштаб", "填充": "заповнення", "适应": "адаптувати", @@ -792,5 +775,33 @@ "调试浏览器": "Відладка навігатора", "手动翻译": "Ручний переклад", "显示引擎": "Рушій показу", - "阴影字体": "Шрифт тіні" + "阴影字体": "Шрифт тіні", + "额外的html": "Додатковий HTML", + "测试": "тест", + "窗口尺寸": "Розмір вікна", + "自动延展": "Автоматичне масштабування", + "自动收缩": "Автоматичне зменшення", + "范围框颜色": "Колір діапазону", + "伴随游戏窗口": "Приєднання до вікна гри", + "主题": "тема", + "自动输出": "Автоматичний вивід", + "引擎": "рушій", + "注音": "Жуїнchina. kgm", + "字体缩放": "Масштабування шрифтів", + "显示行为": "Показувати поведінку", + "主界面": "головний інтерфейс", + "设置界面": "Інтерфейс параметрів", + "声音": "голос", + "行为": "поведінка", + "自动化执行": "Автоматичне виконання", + "预处理": "Попереднє обробка", + "自动化执行方法": "Автоматичні методи виконання", + "后处理": "Посля обробки", + "竖向识别": "Вертикальне розпізнавання", + "易错内容修正": "Виправлення вмісту прихильного до помилок", + "范围框宽度": "Ширина діапазону", + "按钮颜色": "Колір кнопок", + "按钮大小": "Розмір кнопки", + "软件显示语言": "Мова показу програмного забезпечення", + "重启生效": "Перезапуск впливає" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index f80fed47..a9916c62 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -21,7 +21,6 @@ "&显示": "&Hiện", "&设置": "Thiết lập", "&退出": "&Thoát", - "欢迎使用": "Chào mừng đến với", "设置": "Thiết lập", "基本设置": "Cài đặt cơ bản", "选择文本输入源": "Chọn nguồn nhập văn bản", @@ -83,10 +82,6 @@ "刷新延迟(ms)": "Độ trễ làm mới (ms)", "OCR设置": "Thiết lập OCR", "本地OCR": "OCR địa phương", - "OCR最长间隔时间(s)": "OCR Khoảng thời gian tối đa (s)", - "OCR最短间隔时间(s)": "OCR Khoảng thời gian ngắn nhất (s)", - "OCR范围框颜色": "Màu hộp dải OCR", - "OCR范围框宽度": "Chiều rộng khung dải OCR", "普通字体": "Phông thường", "描边字体": "Phông viền", "显示设置": "Thiết lập hiển thị", @@ -110,7 +105,6 @@ "显示游戏静音按钮": "Hiện nút tắt tiếng trò chơi", "游戏最小化时窗口隐藏": "Cửa sổ ẩn khi trò chơi được thu nhỏ", "游戏窗口移动时同步移动": "Đồng bộ di chuyển khi cửa sổ trò chơi di chuyển", - "固定窗口尺寸": "Kích thước cửa sổ cố định", "翻译结果繁简体显示": "Kết quả phiên dịch Hiển thị đơn giản", "翻译器显示语言(重启生效)": "Ngôn ngữ hiển thị trình dịch (có hiệu lực khởi động lại)", "语音设置": "Thiết lập giọng nói", @@ -164,7 +158,6 @@ "去除重复字符(若为1则自动分析去重)": "Loại bỏ các ký tự trùng lặp (nếu là 1 thì tự động phân tích trọng lượng)", "专有名词翻译设置(游戏ID 0表示全局)": "Cài đặt dịch danh từ độc quyền (ID trò chơi 0 cho toàn cầu)", "密钥": "Chìa khóa", - "优化横向OCR漏字": "Tối ưu hóa từ rò rỉ OCR ngang", "記号": "Đánh dấu", "选择文件": "Chọn tập tin", "缩放时禁用窗口大小调整": "Tắt thay đổi kích cỡ cửa sổ khi phóng to", @@ -191,7 +184,6 @@ "删除游戏": "Xóa trò chơi", "和源窗口相同": "Tương tự với Source Window", "光标缩放系数": "Hệ số thu phóng con trỏ", - "使用竖排OCR(效果不佳)": "Sử dụng OCR dọc (không hoạt động tốt)", "3D游戏模式": "Chế độ trò chơi 3D", "接続詞": "Tiếp lời.", "缩放时调整光标速度": "Điều chỉnh tốc độ con trỏ khi thu phóng", @@ -246,7 +238,6 @@ "隐藏延迟(s)": "Độ trễ ẩn (s)", "选取OCR范围——立即": "Chọn phạm vi OCR - Ngay lập tức", "未查到": "Không tìm thấy", - "OCR识别易错内容修正": "OCR xác định lỗi nội dung sửa chữa", "保存": "Lưu", "当前版本": "Phiên bản hiện tại", "最新版本": "Phiên bản mới nhất", @@ -271,7 +262,6 @@ "编辑专有名词": "Danh từ độc quyền biên tập", "专有名词翻译设置": "Thiết lập dịch danh từ độc quyền", "设置Token": "Thiết lập Token", - "分词&假名分析器": "Phân từ&bộ phân tích kana", "内置": "Được xây dựng trong", "token设置": "Thiết lập Token", "不同词性颜色(需要Mecab)": "Màu sắc khác nhau của từ (yêu cầu Mecab)", @@ -279,9 +269,6 @@ "!未选定进程!": "! Quá trình chưa chọn!", "该功能可能会导致游戏崩溃!": "Tính năng này có thể gây ra sự cố trò chơi!", "警告": "Cảnh báo", - "OCR稳定性阈值": "Ngưỡng ổn định OCR", - "OCR一致性阈值": "Ngưỡng phù hợp OCR", - "OCR自动化方法": "Phương pháp tự động hóa OCR", "文字更新分析": "Phân tích cập nhật văn bản", "时间间隔": "Khoảng thời gian", "时间周期执行": "Thực hiện chu kỳ thời gian", @@ -374,7 +361,6 @@ "火山OCR": "Núi lửa OCR", "密钥获取": "Lấy chìa khóa", "翻译及OCR语言": "Dịch và ngôn ngữ OCR", - "本软件显示语言(重启生效)": "Ngôn ngữ hiển thị phần mềm này (có hiệu lực khởi động lại)", "成功": "Thành công", "特殊码": "Mã đặc biệt", "删除特殊码": "Xóa mã đặc biệt", @@ -578,7 +564,6 @@ "路径不存在": "Đường dẫn không tồn tại", "不处理": "Không xử lý", "灰度化": "Mức xám", - "OCR预处理方法": "Phương pháp tiền xử lý OCR", "阈值二值化": "Ngưỡng nhị phân", "OTSU二值化": "Phân loại OTSU", "二值化阈值": "Ngưỡng nhị phân", @@ -674,8 +659,6 @@ "使用VNDB数据替换人名": "Thay tên người bằng dữ liệu VNDB", "文本输出": "Xuất văn bản", "自动输出提取的文本": "Tự động xuất văn bản đã trích xuất", - "输出到剪贴板": "Xuất ra bảng nháp", - "输出到WebSocket": "Xuất ra WebSocket", "缩放": "Phóng to", "填充": "Điền", "适应": "Điều chỉnh", @@ -792,5 +775,33 @@ "调试浏览器": "Gỡ lỗi trình duyệt", "手动翻译": "Dịch thủ công", "显示引擎": "Công cụ hiển thị", - "阴影字体": "Phông bóng" + "阴影字体": "Phông bóng", + "额外的html": "Thêm HTML", + "测试": "Thử nghiệm", + "窗口尺寸": "Kích thước cửa sổ", + "自动延展": "Tự động mở rộng", + "自动收缩": "Thu nhỏ tự động", + "范围框颜色": "Màu hộp phạm vi", + "伴随游戏窗口": "Đi kèm với cửa sổ trò chơi", + "主题": "Chủ đề", + "自动输出": "Đầu ra tự động", + "引擎": "Động cơ", + "注音": "Ghi chú", + "字体缩放": "Thu phóng phông chữ", + "显示行为": "Hiện hành vi", + "主界面": "Giao diện chính", + "设置界面": "Thiết lập giao diện", + "声音": "Âm thanh", + "行为": "Ứng xử", + "自动化执行": "Thực hiện tự động", + "预处理": "Tiền xử lý", + "自动化执行方法": "Phương pháp thực hiện tự động", + "后处理": "Hậu xử lý", + "竖向识别": "Nhận dạng dọc", + "易错内容修正": "Sửa lỗi dễ dàng", + "范围框宽度": "Chiều rộng hộp phạm vi", + "按钮颜色": "Màu nút", + "按钮大小": "Kích thước nút", + "软件显示语言": "Ngôn ngữ hiển thị phần mềm", + "重启生效": "Khởi động lại có hiệu lực" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index c7963c8e..8fe0816c 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -5,7 +5,6 @@ "显示编辑按钮": "", "过滤换行符": "", "绑定窗口(部分软件不支持)(点击自己取消)": "", - "OCR最长间隔时间(s)": "", "文本设置": "", "过滤数字": "", "插入特殊码": "", @@ -81,11 +80,9 @@ "图标2": "", "如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~": "", "窗口截图": "", - "OCR最短间隔时间(s)": "", "自动获取系统代理": "", "是否使用快捷键": "", "最小化到托盘": "", - "欢迎使用": "", "打开目录": "", "手动设置代理(ip:port)": "", "录制翻译文件": "", @@ -113,7 +110,6 @@ "将汉字转换成繁体/日式汉字": "", "失败": "", "token设置": "", - "固定窗口尺寸": "", "简体中文(CP936,GBK)": "", "其他": "", "设置所有词条为全局词条": "", @@ -152,13 +148,11 @@ "统计": "", "设置": "", "接受的编码": "", - "OCR自动化方法": "", "手动翻译": "", "专有名词翻译设置(游戏ID 0表示全局)": "", "補助記号": "", "小学馆辞书": "", "项目地址": "", - "OCR稳定性阈值": "", "内嵌的翻译器": "", "高级": "", "查词": "", @@ -169,11 +163,9 @@ "显示": "", "选择文本输入源": "", "获取中": "", - "分词&假名分析器": "", "接頭辞": "", "注册在线翻译": "", "泰语": "", - "优化横向OCR漏字": "", "win7适配版": "", "导出sqlite文件为json文件": "", "搜狗": "", @@ -226,9 +218,8 @@ "显示复制原文按钮": "", "希伯来语": "", "非管理员": "", - "OCR范围框颜色": "", + "范围框颜色": "", "助詞": "", - "使用竖排OCR(效果不佳)": "", "离线翻译": "", "東北イタコ/东北伊达子": "", "开始搜索": "", @@ -291,7 +282,6 @@ "时间间隔": "", "去除重复字符(若为1则自动分析去重)": "", "搜索特殊码": "", - "OCR一致性阈值": "", "复制特殊码": "", "图像稳定性阈值": "", "不能为空": "", @@ -354,8 +344,6 @@ "感動詞": "", "西里尔": "", "设置代码页": "", - "本软件显示语言(重启生效)": "", - "OCR范围框宽度": "", "保存路径": "", "编辑": "", "ついなちゃん": "", @@ -546,7 +534,6 @@ "所选文件格式错误!": "", "显示移动按钮": "", "单次负载个数": "", - "OCR识别易错内容修正": "", "过滤英文字母": "", "过滤包含乱码的文本行": "", "进行一次OCR": "", @@ -575,7 +562,6 @@ "路径不存在": "", "不处理": "", "灰度化": "", - "OCR预处理方法": "", "阈值二值化": "", "OTSU二值化": "", "二值化阈值": "", @@ -678,8 +664,6 @@ "使用VNDB数据替换人名": "", "文本输出": "", "自动输出提取的文本": "", - "输出到剪贴板": "", - "输出到WebSocket": "", "缩放": "", "填充": "", "适应": "", @@ -792,5 +776,32 @@ "超过时截断而非过滤": "", "调试浏览器": "", "显示引擎": "", - "阴影字体": "" + "阴影字体": "", + "额外的html": "", + "测试": "", + "窗口尺寸": "", + "自动延展": "", + "自动收缩": "", + "伴随游戏窗口": "", + "主题": "", + "自动输出": "", + "引擎": "", + "注音": "", + "字体缩放": "", + "显示行为": "", + "主界面": "", + "设置界面": "", + "声音": "", + "行为": "", + "自动化执行": "", + "预处理": "", + "自动化执行方法": "", + "后处理": "", + "竖向识别": "", + "易错内容修正": "", + "范围框宽度": "", + "按钮颜色": "", + "按钮大小": "", + "软件显示语言": "", + "重启生效": "" } \ No newline at end of file diff --git a/LunaTranslator/requirements.txt b/LunaTranslator/requirements.txt index e474b415..8b379abb 100644 --- a/LunaTranslator/requirements.txt +++ b/LunaTranslator/requirements.txt @@ -2,6 +2,6 @@ PyQt5==5.15.10 PyQt5-Qt5==5.15.2 -webviewpy==1.2.1 +webviewpy==1.3.0 pefile tinycss2 \ No newline at end of file diff --git a/LunaTranslator/requirements_qt6.txt b/LunaTranslator/requirements_qt6.txt index 2a638ec7..1efb12ca 100644 --- a/LunaTranslator/requirements_qt6.txt +++ b/LunaTranslator/requirements_qt6.txt @@ -2,6 +2,6 @@ PyQt6==6.7.0 PyQt6-Qt6==6.7.0 -webviewpy==1.2.1 +webviewpy==1.3.0 pefile tinycss2 \ No newline at end of file diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 7b76d856..27faad83 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -28,7 +28,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version) include(generate_product_version) set(VERSION_MAJOR 5) -set(VERSION_MINOR 1) +set(VERSION_MINOR 2) set(VERSION_PATCH 0) add_library(pch pch.cpp)