This commit is contained in:
恍兮惚兮 2024-07-16 00:36:58 +08:00
parent 9ebcd8ec37
commit 71362ac91a
5 changed files with 383 additions and 346 deletions

View File

@ -3,7 +3,7 @@ import functools
from myutils.config import _TRL
from gui.setting_display_buttons import createbuttonwidget
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.usefulwidget import (
makesubtab_lazy,
@ -14,12 +14,11 @@ from gui.usefulwidget import (
def setTabThree_lazy(self, basel):
tab, do = makesubtab_lazy(
_TRL(["字体样式", "显示内容", "界面设置", "主题效果", "工具按钮", "窗口缩放"]),
_TRL(["字体样式", "显示内容", "界面设置", "工具按钮", "窗口缩放"]),
[
lambda l: makescrollgrid(xianshigrid_style(self), l),
lambda l: makescrollgrid(xianshigrid_text(self), l),
lambda l: makescrollgrid(uisetting(self), l),
lambda l: makescrollgrid(themesetting(self), l),
functools.partial(uisetting, self),
functools.partial(createbuttonwidget, self),
functools.partial(makescalew, self),
],

View File

@ -452,35 +452,54 @@ def xianshigrid_text(self):
)
],
[
("语法加亮"),
D_getsimpleswitch(globalconfig, "show_fenci"),
"",
("词性颜色_需要Mecab"),
D_getIconButton(
callback=lambda: multicolorset(self),
icon="fa.gear",
),
"",
],
[
("点击单词查词"),
(
D_getsimpleswitch(globalconfig, "usesearchword"),
1,
),
"",
("点击单词复制"),
(
D_getsimpleswitch(globalconfig, "usecopyword"),
1,
),
],
[
("使用原型查询"),
(
D_getsimpleswitch(globalconfig, "usewordorigin"),
1,
),
dict(
type="grid",
grid=(
[
("语法加亮"),
D_getsimpleswitch(
globalconfig, "show_fenci"
),
"",
("词性颜色_需要Mecab"),
D_getIconButton(
callback=lambda: multicolorset(self),
icon="fa.gear",
),
"",
],
[
("点击单词查词"),
(
D_getsimpleswitch(
globalconfig, "usesearchword"
),
1,
),
"",
("点击单词复制"),
(
D_getsimpleswitch(
globalconfig, "usecopyword"
),
1,
),
],
[
("使用原型查询"),
(
D_getsimpleswitch(
globalconfig, "usewordorigin"
),
1,
),
],
),
),
0,
"group",
)
],
),
),

View File

@ -14,6 +14,8 @@ from gui.usefulwidget import (
D_getsimpleswitch,
getsimpleswitch,
getboxlayout,
makesubtab_lazy,
makescrollgrid,
)
@ -236,234 +238,63 @@ def __changeuibuttonstate(self, x):
gobject.baseobject.translation_ui.enterfunction()
def uisetting(self):
def uisetting(self, l):
tab, do = makesubtab_lazy(
_TRL(["主界面", "其他界面"]),
[
lambda l: makescrollgrid(mainuisetting(self), l),
lambda l: makescrollgrid(otheruisetting(self), l),
],
delay=True,
)
l.addWidget(tab)
do()
uigrid = [
def mainuisetting(self):
return (
[
(
dict(
title="主界面",
title="文本区",
type="grid",
grid=(
[
"不透明度",
(
dict(
title="文本区",
type="grid",
grid=(
[
"不透明度",
(
functools.partial(
createhorizontal_slider, self
),
0,
),
functools.partial(
createhorizontal_slider_label, self
),
],
[
"背景颜色",
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,
),
"",
"圆角_半径",
D_getspinbox(
0,
100,
globalconfig,
"yuanjiao_r",
callback=lambda _: gobject.baseobject.translation_ui.set_color_transparency(),
),
"",
"",
"",
],
),
),
functools.partial(createhorizontal_slider, self),
0,
"group",
)
),
functools.partial(createhorizontal_slider_label, self),
],
[
(
dict(
title="工具栏",
type="grid",
grid=(
[
"不透明度",
(
functools.partial(
createhorizontal_slider_tool, self
),
0,
),
functools.partial(
createhorizontal_slider_tool_label,
self,
),
],
[
"背景颜色",
D_getcolorbutton(
globalconfig,
"backcolor_tool",
callback=lambda: selectcolor(
self,
globalconfig,
"backcolor_tool",
self.back_color_button_tool,
callback=toolcolorchange,
),
name="back_color_button_tool",
parent=self,
),
"",
"工具按钮颜色",
getboxlayout(
[
D_getcolorbutton(
globalconfig,
"buttoncolor",
callback=lambda: selectcolor(
self,
globalconfig,
"buttoncolor",
self.buttoncolorbutton,
callback=toolcolorchange,
),
name="buttoncolorbutton",
parent=self,
),
D_getcolorbutton(
globalconfig,
"buttoncolor_1",
callback=lambda: selectcolor(
self,
globalconfig,
"buttoncolor_1",
self.buttoncolorbutton_1,
callback=toolcolorchange,
),
name="buttoncolorbutton_1",
parent=self,
),
],
makewidget=True,
),
"",
"进入时才显示",
D_getsimpleswitch(
globalconfig, "toolviswhenenter"
),
],
[
"锁定工具栏",
D_getsimpleswitch(
globalconfig,
"locktools",
callback=lambda x: __changeuibuttonstate(
self, x
),
name="locktoolsbutton",
parent=self,
),
"",
"工具按钮大小",
D_getspinbox(
5,
100,
globalconfig,
"buttonsize",
callback=lambda _: toolcolorchange(),
),
"",
"延申",
D_getsimpleswitch(
globalconfig,
"extendtools",
callback=gobject.baseobject.translation_ui.changeextendstated_1,
),
],
),
),
0,
"group",
)
],
[
"窗口置顶",
D_getsimpleswitch(
"背景颜色",
D_getcolorbutton(
globalconfig,
"keepontop",
callback=lambda x: __changeuibuttonstate3(self, x),
"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,
name="keepontopbutton",
),
"",
("自动调整高度"),
D_getsimpleswitch(globalconfig, "adaptive_height"),
],
[
("鼠标穿透窗口"),
D_getsimpleswitch(
"圆角_半径",
D_getspinbox(
0,
100,
globalconfig,
"mousetransparent",
callback=lambda x: __changeuibuttonstate2(self, x),
parent=self,
name="mousetransbutton",
"yuanjiao_r",
callback=lambda _: gobject.baseobject.translation_ui.set_color_transparency(),
),
"",
"自动隐藏窗口",
getboxlayout(
[
D_getsimpleswitch(globalconfig, "autodisappear"),
"隐藏延迟(s)",
D_getspinbox(
1, 100, globalconfig, "disappear_delay"
),
],
makewidget=True,
),
],
[
(
dict(
title="跟随游戏窗口",
type="grid",
grid=(
[
"游戏失去焦点时取消置顶",
D_getsimpleswitch(
globalconfig,
"focusnotop",
),
"",
"游戏窗口移动时同步移动",
D_getsimpleswitch(
globalconfig,
"movefollow",
),
"",
],
),
),
0,
"group",
)
"",
"",
],
),
),
@ -474,11 +305,214 @@ def uisetting(self):
[
(
dict(
title="其他界面",
title="工具栏",
type="grid",
grid=(
["字体", (createfontcombo, 0)],
[
"不透明度",
(
functools.partial(createhorizontal_slider_tool, self),
0,
),
functools.partial(
createhorizontal_slider_tool_label,
self,
),
],
[
"背景颜色",
D_getcolorbutton(
globalconfig,
"backcolor_tool",
callback=lambda: selectcolor(
self,
globalconfig,
"backcolor_tool",
self.back_color_button_tool,
callback=toolcolorchange,
),
name="back_color_button_tool",
parent=self,
),
"",
"工具按钮颜色",
getboxlayout(
[
D_getcolorbutton(
globalconfig,
"buttoncolor",
callback=lambda: selectcolor(
self,
globalconfig,
"buttoncolor",
self.buttoncolorbutton,
callback=toolcolorchange,
),
name="buttoncolorbutton",
parent=self,
),
D_getcolorbutton(
globalconfig,
"buttoncolor_1",
callback=lambda: selectcolor(
self,
globalconfig,
"buttoncolor_1",
self.buttoncolorbutton_1,
callback=toolcolorchange,
),
name="buttoncolorbutton_1",
parent=self,
),
],
makewidget=True,
),
"",
"进入时才显示",
D_getsimpleswitch(globalconfig, "toolviswhenenter"),
],
[
"锁定工具栏",
D_getsimpleswitch(
globalconfig,
"locktools",
callback=lambda x: __changeuibuttonstate(self, x),
name="locktoolsbutton",
parent=self,
),
"",
"工具按钮大小",
D_getspinbox(
5,
100,
globalconfig,
"buttonsize",
callback=lambda _: toolcolorchange(),
),
"",
"延申",
D_getsimpleswitch(
globalconfig,
"extendtools",
callback=gobject.baseobject.translation_ui.changeextendstated_1,
),
],
),
),
0,
"group",
)
],
[
(
dict(
grid=(
[
"窗口特效",
functools.partial(createxxx, self),
],
),
),
0,
"group",
)
],
[
(
dict(
type="grid",
grid=(
[
"窗口置顶",
D_getsimpleswitch(
globalconfig,
"keepontop",
callback=lambda x: __changeuibuttonstate3(self, x),
parent=self,
name="keepontopbutton",
),
"",
"自动调整高度",
D_getsimpleswitch(globalconfig, "adaptive_height"),
"",
"任务栏中显示",
D_getsimpleswitch(
globalconfig,
"showintab",
callback=lambda _: gobject.baseobject.setshowintab(),
),
],
[
"鼠标穿透窗口",
D_getsimpleswitch(
globalconfig,
"mousetransparent",
callback=lambda x: __changeuibuttonstate2(self, x),
parent=self,
name="mousetransbutton",
),
"",
"自动隐藏窗口",
D_getsimpleswitch(globalconfig, "autodisappear"),
"",
"隐藏延迟(s)",
D_getspinbox(
1,
100,
globalconfig,
"disappear_delay",
),
],
),
),
0,
"group",
)
],
[
(
dict(
title="跟随游戏窗口",
type="grid",
grid=(
[
"游戏失去焦点时取消置顶",
D_getsimpleswitch(
globalconfig,
"focusnotop",
),
"",
"游戏窗口移动时同步移动",
D_getsimpleswitch(
globalconfig,
"movefollow",
),
"",
],
),
),
0,
"group",
)
],
)
def otheruisetting(self):
def themelist(t):
return [_["name"] for _ in static_data["themes"][t]]
return (
[
(
dict(
type="grid",
grid=(
[
"字体",
(createfontcombo, 0),
"",
"字体大小",
D_getspinbox(
1,
@ -489,7 +523,8 @@ def uisetting(self):
step=0.1,
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
),
"",
],
[
"按钮颜色",
D_getcolorbutton(
globalconfig,
@ -518,6 +553,13 @@ def uisetting(self):
"",
"按钮大小",
D_getspinbox(5, 100, globalconfig, "buttonsize2"),
"",
"任务栏中显示",
D_getsimpleswitch(
globalconfig,
"showintab_sub",
callback=lambda _: gobject.baseobject.setshowintab(),
),
],
),
),
@ -528,24 +570,48 @@ def uisetting(self):
[
(
dict(
title="任务栏中显示",
type="grid",
title="主题",
grid=(
[
"主界面",
D_getsimpleswitch(
"明暗",
D_getsimplecombobox(
_TRL(["跟随系统", "明亮", "黑暗"]),
globalconfig,
"showintab",
callback=lambda _: gobject.baseobject.setshowintab(),
"darklight2",
lambda _: gobject.baseobject.setcommonstylesheet(),
),
"",
"其他界面",
D_getsimpleswitch(
globalconfig,
"showintab_sub",
callback=lambda _: gobject.baseobject.setshowintab(),
],
[
"明亮主题",
(
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),
),
"",
],
),
),
@ -553,8 +619,31 @@ def uisetting(self):
"group",
)
],
]
return uigrid
[
(
dict(
grid=(
[
"窗口特效",
D_getsimplecombobox(
[
"Solid",
"Acrylic",
"Mica",
"MicaAlt",
],
globalconfig,
"WindowBackdrop",
callback=lambda _: gobject.baseobject.setcommonstylesheet(),
),
],
),
),
0,
"group",
)
],
)
def createxxx(self):
@ -590,85 +679,3 @@ def createxxx(self):
makewidget=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

View File

@ -122,9 +122,22 @@ def getocrgrid(self):
"group",
)
],
[],
["竖向识别", D_getsimpleswitch(globalconfig, "verticalocr"), ("", 4)],
[],
[
(
dict(
type="grid",
grid=[
[
"竖向识别",
D_getsimpleswitch(globalconfig, "verticalocr"),
("", 4),
]
],
),
0,
"group",
)
],
[
(
dict(

View File

@ -780,7 +780,6 @@
"内容": "",
"显示内容": "",
"界面设置": "",
"主题效果": "",
"主界面": "",
"其他界面": "",
"翻译及OCR": "",