mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
.
This commit is contained in:
parent
9ebcd8ec37
commit
71362ac91a
@ -3,7 +3,7 @@ import functools
|
|||||||
from myutils.config import _TRL
|
from myutils.config import _TRL
|
||||||
from gui.setting_display_buttons import createbuttonwidget
|
from gui.setting_display_buttons import createbuttonwidget
|
||||||
from gui.setting_display_text import xianshigrid_style, xianshigrid_text
|
from gui.setting_display_text import xianshigrid_style, xianshigrid_text
|
||||||
from gui.setting_display_ui import uisetting,themesetting
|
from gui.setting_display_ui import uisetting
|
||||||
from gui.setting_display_scale import makescalew
|
from gui.setting_display_scale import makescalew
|
||||||
from gui.usefulwidget import (
|
from gui.usefulwidget import (
|
||||||
makesubtab_lazy,
|
makesubtab_lazy,
|
||||||
@ -14,12 +14,11 @@ from gui.usefulwidget import (
|
|||||||
def setTabThree_lazy(self, basel):
|
def setTabThree_lazy(self, basel):
|
||||||
|
|
||||||
tab, do = makesubtab_lazy(
|
tab, do = makesubtab_lazy(
|
||||||
_TRL(["字体样式", "显示内容", "界面设置", "主题效果", "工具按钮", "窗口缩放"]),
|
_TRL(["字体样式", "显示内容", "界面设置", "工具按钮", "窗口缩放"]),
|
||||||
[
|
[
|
||||||
lambda l: makescrollgrid(xianshigrid_style(self), l),
|
lambda l: makescrollgrid(xianshigrid_style(self), l),
|
||||||
lambda l: makescrollgrid(xianshigrid_text(self), l),
|
lambda l: makescrollgrid(xianshigrid_text(self), l),
|
||||||
lambda l: makescrollgrid(uisetting(self), l),
|
functools.partial(uisetting, self),
|
||||||
lambda l: makescrollgrid(themesetting(self), l),
|
|
||||||
functools.partial(createbuttonwidget, self),
|
functools.partial(createbuttonwidget, self),
|
||||||
functools.partial(makescalew, self),
|
functools.partial(makescalew, self),
|
||||||
],
|
],
|
||||||
|
@ -451,9 +451,16 @@ def xianshigrid_text(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
(
|
||||||
|
dict(
|
||||||
|
type="grid",
|
||||||
|
grid=(
|
||||||
[
|
[
|
||||||
("语法加亮"),
|
("语法加亮"),
|
||||||
D_getsimpleswitch(globalconfig, "show_fenci"),
|
D_getsimpleswitch(
|
||||||
|
globalconfig, "show_fenci"
|
||||||
|
),
|
||||||
"",
|
"",
|
||||||
("词性颜色_需要Mecab"),
|
("词性颜色_需要Mecab"),
|
||||||
D_getIconButton(
|
D_getIconButton(
|
||||||
@ -465,20 +472,26 @@ def xianshigrid_text(self):
|
|||||||
[
|
[
|
||||||
("点击单词查词"),
|
("点击单词查词"),
|
||||||
(
|
(
|
||||||
D_getsimpleswitch(globalconfig, "usesearchword"),
|
D_getsimpleswitch(
|
||||||
|
globalconfig, "usesearchword"
|
||||||
|
),
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
"",
|
"",
|
||||||
("点击单词复制"),
|
("点击单词复制"),
|
||||||
(
|
(
|
||||||
D_getsimpleswitch(globalconfig, "usecopyword"),
|
D_getsimpleswitch(
|
||||||
|
globalconfig, "usecopyword"
|
||||||
|
),
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
("使用原型查询"),
|
("使用原型查询"),
|
||||||
(
|
(
|
||||||
D_getsimpleswitch(globalconfig, "usewordorigin"),
|
D_getsimpleswitch(
|
||||||
|
globalconfig, "usewordorigin"
|
||||||
|
),
|
||||||
1,
|
1,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@ -488,6 +501,12 @@ def xianshigrid_text(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
"group",
|
||||||
|
)
|
||||||
|
],
|
||||||
]
|
]
|
||||||
return textgrid
|
return textgrid
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@ from gui.usefulwidget import (
|
|||||||
D_getsimpleswitch,
|
D_getsimpleswitch,
|
||||||
getsimpleswitch,
|
getsimpleswitch,
|
||||||
getboxlayout,
|
getboxlayout,
|
||||||
|
makesubtab_lazy,
|
||||||
|
makescrollgrid,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -236,15 +238,22 @@ def __changeuibuttonstate(self, x):
|
|||||||
gobject.baseobject.translation_ui.enterfunction()
|
gobject.baseobject.translation_ui.enterfunction()
|
||||||
|
|
||||||
|
|
||||||
def uisetting(self):
|
def uisetting(self, l):
|
||||||
|
tab, do = makesubtab_lazy(
|
||||||
uigrid = [
|
_TRL(["主界面", "其他界面"]),
|
||||||
[
|
[
|
||||||
(
|
lambda l: makescrollgrid(mainuisetting(self), l),
|
||||||
dict(
|
lambda l: makescrollgrid(otheruisetting(self), l),
|
||||||
title="主界面",
|
],
|
||||||
type="grid",
|
delay=True,
|
||||||
grid=(
|
)
|
||||||
|
l.addWidget(tab)
|
||||||
|
do()
|
||||||
|
|
||||||
|
|
||||||
|
def mainuisetting(self):
|
||||||
|
|
||||||
|
return (
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
dict(
|
dict(
|
||||||
@ -254,14 +263,10 @@ def uisetting(self):
|
|||||||
[
|
[
|
||||||
"不透明度",
|
"不透明度",
|
||||||
(
|
(
|
||||||
functools.partial(
|
functools.partial(createhorizontal_slider, self),
|
||||||
createhorizontal_slider, self
|
|
||||||
),
|
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
functools.partial(
|
functools.partial(createhorizontal_slider_label, self),
|
||||||
createhorizontal_slider_label, self
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"背景颜色",
|
"背景颜色",
|
||||||
@ -306,9 +311,7 @@ def uisetting(self):
|
|||||||
[
|
[
|
||||||
"不透明度",
|
"不透明度",
|
||||||
(
|
(
|
||||||
functools.partial(
|
functools.partial(createhorizontal_slider_tool, self),
|
||||||
createhorizontal_slider_tool, self
|
|
||||||
),
|
|
||||||
0,
|
0,
|
||||||
),
|
),
|
||||||
functools.partial(
|
functools.partial(
|
||||||
@ -366,18 +369,14 @@ def uisetting(self):
|
|||||||
),
|
),
|
||||||
"",
|
"",
|
||||||
"进入时才显示",
|
"进入时才显示",
|
||||||
D_getsimpleswitch(
|
D_getsimpleswitch(globalconfig, "toolviswhenenter"),
|
||||||
globalconfig, "toolviswhenenter"
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"锁定工具栏",
|
"锁定工具栏",
|
||||||
D_getsimpleswitch(
|
D_getsimpleswitch(
|
||||||
globalconfig,
|
globalconfig,
|
||||||
"locktools",
|
"locktools",
|
||||||
callback=lambda x: __changeuibuttonstate(
|
callback=lambda x: __changeuibuttonstate(self, x),
|
||||||
self, x
|
|
||||||
),
|
|
||||||
name="locktoolsbutton",
|
name="locktoolsbutton",
|
||||||
parent=self,
|
parent=self,
|
||||||
),
|
),
|
||||||
@ -404,6 +403,25 @@ def uisetting(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
(
|
||||||
|
dict(
|
||||||
|
grid=(
|
||||||
|
[
|
||||||
|
"窗口特效",
|
||||||
|
functools.partial(createxxx, self),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
"group",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
[
|
||||||
|
(
|
||||||
|
dict(
|
||||||
|
type="grid",
|
||||||
|
grid=(
|
||||||
[
|
[
|
||||||
"窗口置顶",
|
"窗口置顶",
|
||||||
D_getsimpleswitch(
|
D_getsimpleswitch(
|
||||||
@ -414,11 +432,18 @@ def uisetting(self):
|
|||||||
name="keepontopbutton",
|
name="keepontopbutton",
|
||||||
),
|
),
|
||||||
"",
|
"",
|
||||||
("自动调整高度"),
|
"自动调整高度",
|
||||||
D_getsimpleswitch(globalconfig, "adaptive_height"),
|
D_getsimpleswitch(globalconfig, "adaptive_height"),
|
||||||
|
"",
|
||||||
|
"任务栏中显示",
|
||||||
|
D_getsimpleswitch(
|
||||||
|
globalconfig,
|
||||||
|
"showintab",
|
||||||
|
callback=lambda _: gobject.baseobject.setshowintab(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
("鼠标穿透窗口"),
|
"鼠标穿透窗口",
|
||||||
D_getsimpleswitch(
|
D_getsimpleswitch(
|
||||||
globalconfig,
|
globalconfig,
|
||||||
"mousetransparent",
|
"mousetransparent",
|
||||||
@ -428,16 +453,21 @@ def uisetting(self):
|
|||||||
),
|
),
|
||||||
"",
|
"",
|
||||||
"自动隐藏窗口",
|
"自动隐藏窗口",
|
||||||
getboxlayout(
|
|
||||||
[
|
|
||||||
D_getsimpleswitch(globalconfig, "autodisappear"),
|
D_getsimpleswitch(globalconfig, "autodisappear"),
|
||||||
|
"",
|
||||||
"隐藏延迟(s)",
|
"隐藏延迟(s)",
|
||||||
D_getspinbox(
|
D_getspinbox(
|
||||||
1, 100, globalconfig, "disappear_delay"
|
1,
|
||||||
|
100,
|
||||||
|
globalconfig,
|
||||||
|
"disappear_delay",
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
makewidget=True,
|
|
||||||
),
|
),
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
"group",
|
||||||
|
)
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
@ -465,20 +495,24 @@ def uisetting(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
),
|
|
||||||
),
|
|
||||||
0,
|
|
||||||
"group",
|
|
||||||
)
|
)
|
||||||
],
|
|
||||||
|
|
||||||
|
def otheruisetting(self):
|
||||||
|
|
||||||
|
def themelist(t):
|
||||||
|
return [_["name"] for _ in static_data["themes"][t]]
|
||||||
|
|
||||||
|
return (
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
dict(
|
dict(
|
||||||
title="其他界面",
|
|
||||||
type="grid",
|
type="grid",
|
||||||
grid=(
|
grid=(
|
||||||
["字体", (createfontcombo, 0)],
|
|
||||||
[
|
[
|
||||||
|
"字体",
|
||||||
|
(createfontcombo, 0),
|
||||||
|
"",
|
||||||
"字体大小",
|
"字体大小",
|
||||||
D_getspinbox(
|
D_getspinbox(
|
||||||
1,
|
1,
|
||||||
@ -489,7 +523,8 @@ def uisetting(self):
|
|||||||
step=0.1,
|
step=0.1,
|
||||||
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
|
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
|
||||||
),
|
),
|
||||||
"",
|
],
|
||||||
|
[
|
||||||
"按钮颜色",
|
"按钮颜色",
|
||||||
D_getcolorbutton(
|
D_getcolorbutton(
|
||||||
globalconfig,
|
globalconfig,
|
||||||
@ -518,6 +553,13 @@ def uisetting(self):
|
|||||||
"",
|
"",
|
||||||
"按钮大小",
|
"按钮大小",
|
||||||
D_getspinbox(5, 100, globalconfig, "buttonsize2"),
|
D_getspinbox(5, 100, globalconfig, "buttonsize2"),
|
||||||
|
"",
|
||||||
|
"任务栏中显示",
|
||||||
|
D_getsimpleswitch(
|
||||||
|
globalconfig,
|
||||||
|
"showintab_sub",
|
||||||
|
callback=lambda _: gobject.baseobject.setshowintab(),
|
||||||
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -528,24 +570,48 @@ def uisetting(self):
|
|||||||
[
|
[
|
||||||
(
|
(
|
||||||
dict(
|
dict(
|
||||||
title="任务栏中显示",
|
title="主题",
|
||||||
type="grid",
|
|
||||||
grid=(
|
grid=(
|
||||||
[
|
[
|
||||||
"主界面",
|
"明暗",
|
||||||
D_getsimpleswitch(
|
D_getsimplecombobox(
|
||||||
|
_TRL(["跟随系统", "明亮", "黑暗"]),
|
||||||
globalconfig,
|
globalconfig,
|
||||||
"showintab",
|
"darklight2",
|
||||||
callback=lambda _: gobject.baseobject.setshowintab(),
|
lambda _: gobject.baseobject.setcommonstylesheet(),
|
||||||
),
|
),
|
||||||
"",
|
],
|
||||||
"其他界面",
|
[
|
||||||
D_getsimpleswitch(
|
"明亮主题",
|
||||||
|
(
|
||||||
|
D_getsimplecombobox(
|
||||||
|
_TRL(["默认"]) + themelist("light"),
|
||||||
globalconfig,
|
globalconfig,
|
||||||
"showintab_sub",
|
"lighttheme",
|
||||||
callback=lambda _: gobject.baseobject.setshowintab(),
|
functools.partial(
|
||||||
|
checkthemesettingvisandapply,
|
||||||
|
self,
|
||||||
|
False,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
functools.partial(createbtnthemelight, self),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
[
|
||||||
|
"黑暗主题",
|
||||||
|
(
|
||||||
|
D_getsimplecombobox(
|
||||||
|
themelist("dark"),
|
||||||
|
globalconfig,
|
||||||
|
"darktheme",
|
||||||
|
functools.partial(
|
||||||
|
checkthemesettingvisandapply,
|
||||||
|
self,
|
||||||
|
True,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
functools.partial(createbtnthemedark, self),
|
||||||
),
|
),
|
||||||
"",
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@ -553,8 +619,31 @@ def uisetting(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
]
|
[
|
||||||
return uigrid
|
(
|
||||||
|
dict(
|
||||||
|
grid=(
|
||||||
|
[
|
||||||
|
"窗口特效",
|
||||||
|
D_getsimplecombobox(
|
||||||
|
[
|
||||||
|
"Solid",
|
||||||
|
"Acrylic",
|
||||||
|
"Mica",
|
||||||
|
"MicaAlt",
|
||||||
|
],
|
||||||
|
globalconfig,
|
||||||
|
"WindowBackdrop",
|
||||||
|
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
"group",
|
||||||
|
)
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def createxxx(self):
|
def createxxx(self):
|
||||||
@ -590,85 +679,3 @@ def createxxx(self):
|
|||||||
makewidget=True,
|
makewidget=True,
|
||||||
margin0=True,
|
margin0=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
def themesetting(self):
|
|
||||||
|
|
||||||
def themelist(t):
|
|
||||||
return [_["name"] for _ in static_data["themes"][t]]
|
|
||||||
|
|
||||||
uigrid = [
|
|
||||||
[
|
|
||||||
(
|
|
||||||
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),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
0,
|
|
||||||
"group",
|
|
||||||
)
|
|
||||||
],
|
|
||||||
[
|
|
||||||
(
|
|
||||||
dict(
|
|
||||||
title="窗口特效",
|
|
||||||
grid=(
|
|
||||||
[
|
|
||||||
"主界面",
|
|
||||||
functools.partial(createxxx, self),
|
|
||||||
],
|
|
||||||
[
|
|
||||||
"其他界面",
|
|
||||||
D_getsimplecombobox(
|
|
||||||
["Solid", "Acrylic", "Mica", "MicaAlt"],
|
|
||||||
globalconfig,
|
|
||||||
"WindowBackdrop",
|
|
||||||
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
0,
|
|
||||||
"group",
|
|
||||||
)
|
|
||||||
],
|
|
||||||
]
|
|
||||||
return uigrid
|
|
||||||
|
@ -122,9 +122,22 @@ def getocrgrid(self):
|
|||||||
"group",
|
"group",
|
||||||
)
|
)
|
||||||
],
|
],
|
||||||
[],
|
[
|
||||||
["竖向识别", D_getsimpleswitch(globalconfig, "verticalocr"), ("", 4)],
|
(
|
||||||
[],
|
dict(
|
||||||
|
type="grid",
|
||||||
|
grid=[
|
||||||
|
[
|
||||||
|
"竖向识别",
|
||||||
|
D_getsimpleswitch(globalconfig, "verticalocr"),
|
||||||
|
("", 4),
|
||||||
|
]
|
||||||
|
],
|
||||||
|
),
|
||||||
|
0,
|
||||||
|
"group",
|
||||||
|
)
|
||||||
|
],
|
||||||
[
|
[
|
||||||
(
|
(
|
||||||
dict(
|
dict(
|
||||||
|
@ -780,7 +780,6 @@
|
|||||||
"内容": "",
|
"内容": "",
|
||||||
"显示内容": "",
|
"显示内容": "",
|
||||||
"界面设置": "",
|
"界面设置": "",
|
||||||
"主题效果": "",
|
|
||||||
"主界面": "",
|
"主界面": "",
|
||||||
"其他界面": "",
|
"其他界面": "",
|
||||||
"翻译及OCR": "",
|
"翻译及OCR": "",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user