mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-12 23:23:54 +08:00
.
This commit is contained in:
parent
082fac5614
commit
f9a6d5110a
@ -362,7 +362,7 @@ namespace
|
||||
} // unnamed namespace
|
||||
namespace
|
||||
{
|
||||
// flutter of birds~鳥達の羽ばたき~
|
||||
// flutter of birds~鳥達の羽ばたき~ WIN10版本
|
||||
// https://vndb.org/v2379
|
||||
// 需要注意的是,不能把文本跳到最快,不然2~4行无法显示。
|
||||
// 这个有一大堆候选
|
||||
|
@ -8,7 +8,7 @@ public:
|
||||
check_by = CHECK_BY::CUSTOM;
|
||||
check_by_target = []()
|
||||
{
|
||||
// flutter of birds~鳥達の羽ばたき~
|
||||
// flutter of birds~鳥達の羽ばたき~ WIN10版本
|
||||
// https://vndb.org/v2379
|
||||
// 很奇怪,FindFirstFileW在win7上true,在win11上false,但PathFileExists在两者都是true
|
||||
auto paks = {L"data.arc", L"effect.arc", L"mes.arc"};
|
||||
|
@ -721,10 +721,49 @@ bool Silkysveryveryold_attach_function()
|
||||
hp.type = USING_STRING;
|
||||
return NewHook(hp, "SilkysX");
|
||||
}
|
||||
namespace
|
||||
{
|
||||
|
||||
// flutter of birds~鳥達の羽ばたき~ 旧版本
|
||||
// https://vndb.org/v2379
|
||||
bool bird()
|
||||
{
|
||||
const BYTE bytes[] = {
|
||||
0x8b, 0x45, 0xf4,
|
||||
0x33, 0xc9,
|
||||
0x8a, 0x88, XX4,
|
||||
0x81, 0xf9, 0x81, 0x00, 0x00, 0x00,
|
||||
0x0f, 0x85, XX4,
|
||||
0x8b, 0x55, 0xf4,
|
||||
0x33, 0xc0,
|
||||
0x8a, 0x82, XX4,
|
||||
0x83, 0xf8, 0x75,
|
||||
0x74, 0x14,
|
||||
0x8b, 0x4d, 0xf4,
|
||||
0x33, 0xd2,
|
||||
0x8a, 0x91, XX4,
|
||||
0x83, 0xfa, 0x77,
|
||||
0x0f, 0x85, XX4,
|
||||
0x8b, 0x45, 0xf4,
|
||||
0x50};
|
||||
ULONG addr = MemDbg::findBytes(bytes, sizeof(bytes), processStartAddress, processStopAddress);
|
||||
if (!addr)
|
||||
return false;
|
||||
addr = findfuncstart(addr);
|
||||
if (!addr)
|
||||
return false;
|
||||
HookParam hp;
|
||||
hp.address = addr;
|
||||
hp.type = USING_STRING | EMBED_ABLE | EMBED_AFTER_NEW | EMBED_DYNA_SJIS;
|
||||
hp.embed_hook_font = F_TextOutA;
|
||||
hp.offset = stackoffset(1);
|
||||
hp.lineSeparator = L"\\n";
|
||||
return NewHook(hp, "SilkysX");
|
||||
}
|
||||
}
|
||||
bool Silkysveryveryold::attach_function()
|
||||
{
|
||||
return Silkysveryveryold_attach_function() || fob2();
|
||||
return Silkysveryveryold_attach_function() || fob2() || bird();
|
||||
}
|
||||
|
||||
bool Aisystem6::attach_function()
|
||||
|
@ -59,7 +59,7 @@ public:
|
||||
// https://vndb.org/v2380
|
||||
check_by = CHECK_BY::CUSTOM;
|
||||
check_by_target = []()
|
||||
{ return Util::CheckFile(L"*SYS.ifl") || Util::CheckFile_exits(L"ANSYS.ifl", true); }; // L"*SYS.ifl";
|
||||
{ return Util::CheckFile_exits(L"*SYS*.ifl", true); }; // L"*SYS.ifl";
|
||||
};
|
||||
bool attach_function();
|
||||
};
|
||||
|
@ -1,7 +1,7 @@
|
||||
|
||||
set(VERSION_MAJOR 6)
|
||||
set(VERSION_MINOR 19)
|
||||
set(VERSION_PATCH 6)
|
||||
set(VERSION_MINOR 20)
|
||||
set(VERSION_PATCH 0)
|
||||
set(VERSION_REVISION 0)
|
||||
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
|
||||
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)
|
||||
|
@ -76,7 +76,6 @@ class MAINUI:
|
||||
self.AttachProcessDialog = None
|
||||
self.edittextui = None
|
||||
self.edittextui_cached = None
|
||||
self.edittextui_sync = True
|
||||
self.notifyonce = set()
|
||||
self.audioplayer = series_audioplayer(playovercallback=self.ttsautoforward)
|
||||
self._internal_reader = None
|
||||
|
@ -51,3 +51,9 @@ global_dialog_savedgame_new = None
|
||||
global_dialog_setting_game = None
|
||||
serverindex = 0
|
||||
edittrans = None
|
||||
|
||||
|
||||
class Consts:
|
||||
buttoncolor = "#FF69B4"
|
||||
buttoncolor_disable = "#afafaf"
|
||||
btnscale = 1.2
|
||||
|
@ -22,9 +22,7 @@ from gui.usefulwidget import (
|
||||
saveposwindow,
|
||||
getboxlayout,
|
||||
IconButton,
|
||||
statusbutton,
|
||||
getsimplecombobox,
|
||||
threeswitch,
|
||||
FQLineEdit,
|
||||
FocusCombo,
|
||||
)
|
||||
@ -45,6 +43,36 @@ from gui.dialog_savedgame_common import (
|
||||
)
|
||||
|
||||
|
||||
class threeswitch(QWidget):
|
||||
btnclicked = pyqtSignal(int)
|
||||
|
||||
def selectlayout(self, i):
|
||||
try:
|
||||
self.btns[(i + 0) % 3].setEnabled(False)
|
||||
self.btns[(i + 1) % 3].setEnabled(False)
|
||||
self.btns[(i + 2) % 3].setEnabled(False)
|
||||
self.btns[(i + 0) % 3].setChecked(True)
|
||||
self.btns[(i + 1) % 3].setChecked(False)
|
||||
self.btns[(i + 2) % 3].setChecked(False)
|
||||
self.btnclicked.emit(i)
|
||||
self.btns[(i + 1) % 3].setEnabled(True)
|
||||
self.btns[(i + 2) % 3].setEnabled(True)
|
||||
except:
|
||||
pass
|
||||
|
||||
def __init__(self, p, icons):
|
||||
super().__init__(p)
|
||||
self.btns = []
|
||||
hv = QHBoxLayout(self)
|
||||
hv.setContentsMargins(0, 0, 0, 0)
|
||||
hv.setSpacing(0)
|
||||
for i, icon in enumerate(icons):
|
||||
btn = IconButton(parent=self, icon=icon, checkable=True)
|
||||
btn.clicked.connect(functools.partial(self.selectlayout, i))
|
||||
self.btns.append(btn)
|
||||
hv.addWidget(btn)
|
||||
|
||||
|
||||
@Singleton_close
|
||||
class dialog_savedgame_integrated(saveposwindow):
|
||||
|
||||
@ -67,6 +95,17 @@ class dialog_savedgame_integrated(saveposwindow):
|
||||
except:
|
||||
print_exc()
|
||||
|
||||
def event(self, a0: QEvent) -> bool:
|
||||
if a0.type() == QEvent.Type.FontChange:
|
||||
h = QFontMetricsF(self.font()).height()
|
||||
h = int(h * gobject.Consts.btnscale)
|
||||
sz = QSize(h, h)
|
||||
self.syssettingbtn.setFixedSize(sz)
|
||||
sz = QSize(h * 3, h)
|
||||
self.switch.setFixedSize(sz)
|
||||
self.do_resize()
|
||||
return super().event(a0)
|
||||
|
||||
def __init__(self, parent) -> None:
|
||||
super().__init__(
|
||||
parent,
|
||||
@ -85,6 +124,7 @@ class dialog_savedgame_integrated(saveposwindow):
|
||||
self.setCentralWidget(w)
|
||||
|
||||
self.switch = threeswitch(self, icons=["fa.list", "fa.th-list", "fa.th"])
|
||||
self.switch.setFixedSize(QSize(75, 25))
|
||||
self.switch.btnclicked.connect(self.selectlayout)
|
||||
self.syssettingbtn = IconButton(icon="fa.gear", parent=self)
|
||||
self.syssettingbtn.setFixedSize(QSize(25, 25))
|
||||
@ -99,7 +139,10 @@ class dialog_savedgame_integrated(saveposwindow):
|
||||
)
|
||||
|
||||
def resizeEvent(self, e: QResizeEvent):
|
||||
x = e.size().width() - self.switch.width()
|
||||
self.do_resize()
|
||||
|
||||
def do_resize(self):
|
||||
x = self.width() - self.switch.width()
|
||||
self.switch.move(x, 0)
|
||||
x -= self.syssettingbtn.width()
|
||||
self.syssettingbtn.move(x, 0)
|
||||
@ -649,6 +692,13 @@ class dialog_savedgame_new(QWidget):
|
||||
)
|
||||
self.setStyleSheet(style)
|
||||
|
||||
def event(self, a0: QEvent) -> bool:
|
||||
if a0.type() == QEvent.Type.FontChange:
|
||||
h = QFontMetricsF(self.font()).height()
|
||||
h = int(h * gobject.Consts.btnscale)
|
||||
self.___.setFixedWidth(4 * h)
|
||||
return super().event(a0)
|
||||
|
||||
def __init__(self, parent) -> None:
|
||||
super().__init__(parent)
|
||||
self._parent = parent
|
||||
@ -668,7 +718,8 @@ class dialog_savedgame_new(QWidget):
|
||||
self.currtags = tuple()
|
||||
self.tagswidget.tagschanged.connect(self.tagschanged)
|
||||
_ = QLabel()
|
||||
_.setFixedWidth(80)
|
||||
_.setFixedWidth(100)
|
||||
self.___ = _
|
||||
layout.addWidget(self.tagswidget)
|
||||
layout.addWidget(_)
|
||||
formLayout.addLayout(layout)
|
||||
|
@ -1,5 +1,5 @@
|
||||
from qtsymbols import *
|
||||
import functools, threading
|
||||
import functools, threading, gobject
|
||||
from myutils.config import savehook_new_list, savehook_new_data, get_launchpath
|
||||
from myutils.hwnd import getExeIcon
|
||||
from gui.usefulwidget import (
|
||||
@ -234,6 +234,14 @@ class dialog_savedgame_legacy(QWidget):
|
||||
_ = QLabel()
|
||||
_.setFixedHeight(20)
|
||||
_.setStyleSheet("background:transparent")
|
||||
self.___ = _
|
||||
formLayout.addWidget(_)
|
||||
formLayout.addWidget(table)
|
||||
formLayout.addLayout(bottom)
|
||||
|
||||
def event(self, a0: QEvent) -> bool:
|
||||
if a0.type() == QEvent.Type.FontChange:
|
||||
h = QFontMetricsF(self.font()).height()
|
||||
h = int(h * gobject.Consts.btnscale)
|
||||
self.___.setFixedHeight(h)
|
||||
return super().event(a0)
|
||||
|
@ -22,7 +22,7 @@ from gui.inputdialog import autoinitdialog
|
||||
from gui.specialwidget import stackedlist, shrinkableitem, shownumQPushButton
|
||||
from gui.usefulwidget import (
|
||||
pixmapviewer,
|
||||
statusbutton,
|
||||
IconButton,
|
||||
makesubtab_lazy,
|
||||
tabadd_lazy,
|
||||
listediter,
|
||||
@ -362,12 +362,12 @@ class viewpixmap_x(QWidget):
|
||||
self.centerwidget = QWidget(self)
|
||||
self.centerwidgetlayout = QVBoxLayout(self.centerwidget)
|
||||
audio = QHBoxLayout()
|
||||
self.recordbtn = statusbutton(icons=["fa.microphone", "fa.stop"])
|
||||
self.recordbtn = IconButton(icon=["fa.microphone", "fa.stop"], checkable=True)
|
||||
self.recordbtn.clicked.connect(self.startorendrecord)
|
||||
self.centerwidgetlayout.addWidget(self.commentedit)
|
||||
self.centerwidgetlayout.addLayout(audio)
|
||||
audio.addWidget(self.recordbtn)
|
||||
self.btnplay = statusbutton(icons=["fa.play", "fa.stop"])
|
||||
self.btnplay = IconButton(icon=["fa.play", "fa.stop"], checkable=True)
|
||||
audio.addWidget(self.btnplay)
|
||||
self.btnplay.clicked.connect(self.playorstop)
|
||||
gobject.baseobject.hualang_recordbtn = self.recordbtn
|
||||
|
@ -3,7 +3,12 @@ import threading, windows
|
||||
import gobject, qtawesome, os, json
|
||||
from myutils.config import globalconfig, savehook_new_data, translatorsetting
|
||||
from myutils.wrapper import Singleton_close
|
||||
from gui.usefulwidget import saveposwindow, getsimplecombobox
|
||||
from gui.usefulwidget import (
|
||||
saveposwindow,
|
||||
getsimplecombobox,
|
||||
getIconButton,
|
||||
IconButton,
|
||||
)
|
||||
from gui.dynalang import LPushButton, LMainWindow
|
||||
from gui.setting_textinput import loadvalidtss
|
||||
|
||||
@ -19,7 +24,6 @@ class edittext(saveposwindow):
|
||||
def __init__(self, parent, cached):
|
||||
super().__init__(parent, poslist=globalconfig["edit_geo"])
|
||||
self.setupUi()
|
||||
|
||||
# self.setWindowFlags(self.windowFlags()&~Qt.WindowMinimizeButtonHint)
|
||||
self.getnewsentencesignal.connect(self.getnewsentence)
|
||||
self.setWindowTitle("编辑")
|
||||
@ -38,23 +42,11 @@ class edittext(saveposwindow):
|
||||
qv = QHBoxLayout(w)
|
||||
self.setCentralWidget(w)
|
||||
|
||||
bt1 = QPushButton(
|
||||
icon=qtawesome.icon("fa.rotate-right", color=globalconfig["buttoncolor"])
|
||||
)
|
||||
bt2 = QPushButton(
|
||||
icon=qtawesome.icon(
|
||||
"fa.forward" if gobject.baseobject.edittextui_sync else "fa.play",
|
||||
color=(
|
||||
"#FF69B4"
|
||||
if gobject.baseobject.edittextui_sync
|
||||
else globalconfig["buttoncolor"]
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
bt1 = getIconButton(icon="fa.rotate-right")
|
||||
bt2 = IconButton(icon=["fa.play", "fa.forward"], checkable=True)
|
||||
bt2.setChecked(True)
|
||||
self.bt2 = bt2
|
||||
self.bt1 = bt1
|
||||
bt2.clicked.connect(self.changestate)
|
||||
bt1.clicked.connect(self.run)
|
||||
qvb = QVBoxLayout()
|
||||
qvb.addWidget(bt1)
|
||||
@ -69,21 +61,8 @@ class edittext(saveposwindow):
|
||||
args=(self.textOutput.toPlainText(), False),
|
||||
).start()
|
||||
|
||||
def changestate(self):
|
||||
gobject.baseobject.edittextui_sync = not gobject.baseobject.edittextui_sync
|
||||
self.bt2.setIcon(
|
||||
qtawesome.icon(
|
||||
"fa.forward" if gobject.baseobject.edittextui_sync else "fa.play",
|
||||
color=(
|
||||
"#FF69B4"
|
||||
if gobject.baseobject.edittextui_sync
|
||||
else globalconfig["buttoncolor"]
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
def getnewsentence(self, sentence):
|
||||
if gobject.baseobject.edittextui_sync:
|
||||
if self.bt2.isChecked():
|
||||
self.textOutput.setPlainText(sentence)
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@ from gui.usefulwidget import (
|
||||
SplitLine,
|
||||
getIconButton,
|
||||
VisLFormLayout,
|
||||
getcolorbutton,
|
||||
)
|
||||
from gui.dynalang import (
|
||||
LFormLayout,
|
||||
@ -797,14 +798,13 @@ class multicolorset(LDialog):
|
||||
functools.partial(globalconfig["cixingcolorshow"].__setitem__, k)
|
||||
)
|
||||
|
||||
p = QPushButton(
|
||||
qtawesome.icon("fa.paint-brush", color=globalconfig["cixingcolor"][k]),
|
||||
"",
|
||||
p = getcolorbutton(
|
||||
globalconfig["cixingcolor"],
|
||||
k,
|
||||
name="miaobian_color_button",
|
||||
parent=self,
|
||||
)
|
||||
|
||||
p.setIconSize(QSize(20, 20))
|
||||
|
||||
p.setStyleSheet("background: transparent;")
|
||||
p.clicked.connect(
|
||||
functools.partial(selectcolor, self, globalconfig["cixingcolor"], k, p)
|
||||
)
|
||||
|
@ -15,6 +15,7 @@ from gui.usefulwidget import (
|
||||
getsimpleswitch,
|
||||
FocusSpin,
|
||||
FocusCombo,
|
||||
IconButton,
|
||||
TableViewW,
|
||||
)
|
||||
from gui.dynalang import (
|
||||
@ -612,7 +613,7 @@ class hookselect(closeashidewindow):
|
||||
self.userhookinsert.clicked.connect(self.inserthook)
|
||||
self.searchtextlayout.addWidget(self.userhookinsert)
|
||||
|
||||
self.userhookinsert = QPushButton(icon=qtawesome.icon("fa.question"))
|
||||
self.userhookinsert = IconButton("fa.question")
|
||||
self.userhookinsert.clicked.connect(
|
||||
lambda: gobject.baseobject.openlink(
|
||||
dynamiclink("{docs_server}/#/zh/hooksettings?id=hookcode")
|
||||
|
@ -32,9 +32,7 @@ class dialog_selecticon(LDialog):
|
||||
layout.addWidget(
|
||||
getIconButton(
|
||||
functools.partial(self.selectcallback, "fa." + name),
|
||||
qicon=qtawesome.icon(
|
||||
"fa." + name, color=globalconfig["buttoncolor2"]
|
||||
),
|
||||
icon="fa." + name,
|
||||
),
|
||||
i // 30,
|
||||
i % 30,
|
||||
@ -124,10 +122,7 @@ def createbuttonwidget(self, lay):
|
||||
globalconfig["toolbutton"]["buttons"][k],
|
||||
"icon",
|
||||
),
|
||||
qicon=qtawesome.icon(
|
||||
globalconfig["toolbutton"]["buttons"][k]["icon"],
|
||||
color=globalconfig["buttoncolor2"],
|
||||
),
|
||||
icon=globalconfig["toolbutton"]["buttons"][k]["icon"],
|
||||
),
|
||||
getsmalllabel(),
|
||||
]
|
||||
@ -140,10 +135,7 @@ def createbuttonwidget(self, lay):
|
||||
globalconfig["toolbutton"]["buttons"][k],
|
||||
"icon2",
|
||||
),
|
||||
qicon=qtawesome.icon(
|
||||
globalconfig["toolbutton"]["buttons"][k]["icon2"],
|
||||
color=globalconfig["buttoncolor2"],
|
||||
),
|
||||
icon=globalconfig["toolbutton"]["buttons"][k]["icon2"],
|
||||
),
|
||||
)
|
||||
else:
|
||||
|
@ -298,7 +298,7 @@ def xianshigrid_style(self):
|
||||
"",
|
||||
"字体大小",
|
||||
D_getspinbox(
|
||||
1,
|
||||
5,
|
||||
100,
|
||||
globalconfig,
|
||||
"fontsizeori",
|
||||
|
@ -532,10 +532,11 @@ def otheruisetting(self):
|
||||
[
|
||||
"字体",
|
||||
(createfontcombo, 0),
|
||||
"",
|
||||
],
|
||||
[
|
||||
"字体大小",
|
||||
D_getspinbox(
|
||||
1,
|
||||
5,
|
||||
100,
|
||||
globalconfig,
|
||||
"settingfontsize",
|
||||
@ -543,36 +544,6 @@ def otheruisetting(self):
|
||||
step=0.1,
|
||||
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"),
|
||||
"",
|
||||
"任务栏中显示",
|
||||
D_getsimpleswitch(
|
||||
|
@ -23,6 +23,7 @@ from gui.usefulwidget import (
|
||||
makegrid,
|
||||
makesubtab_lazy,
|
||||
makescrollgrid,
|
||||
IconButton
|
||||
)
|
||||
from gui.dynalang import LPushButton, LLabel, LAction
|
||||
from gui.setting_about import offlinelinks
|
||||
@ -261,15 +262,7 @@ def btnpluscallback(self, countnum, btnplus):
|
||||
)
|
||||
|
||||
|
||||
def createbtn(self, countnum, btnplus):
|
||||
btn = QPushButton(self)
|
||||
btn.setIcon(qtawesome.icon("fa.plus"))
|
||||
btn.clicked.connect(functools.partial(btnpluscallback, self, countnum, btnplus))
|
||||
setattr(self, "btnadd" + btnplus, btn)
|
||||
return btn
|
||||
|
||||
|
||||
class Shit(QWidget):
|
||||
class Shit(QGroupBox):
|
||||
pass
|
||||
|
||||
|
||||
@ -318,20 +311,17 @@ def createmanybtn(self, countnum, btnplus):
|
||||
hbox = QHBoxLayout(w)
|
||||
hbox.setContentsMargins(0, 0, 0, 0)
|
||||
|
||||
btn = QPushButton(self)
|
||||
btn.setIcon(qtawesome.icon("fa.plus"))
|
||||
btn = IconButton("fa.plus")
|
||||
btn.clicked.connect(functools.partial(btnpluscallback, self, countnum, btnplus))
|
||||
|
||||
hbox.addWidget(btn)
|
||||
|
||||
btn = QPushButton(self)
|
||||
btn.setIcon(qtawesome.icon("fa.minus"))
|
||||
btn = IconButton("fa.minus")
|
||||
btn.clicked.connect(functools.partial(btndeccallback, self, countnum, btnplus))
|
||||
|
||||
hbox.addWidget(btn)
|
||||
|
||||
btn = QPushButton(self)
|
||||
btn.setIcon(qtawesome.icon("fa.question"))
|
||||
btn = IconButton("fa.question")
|
||||
if btnplus == "offline":
|
||||
btn.clicked.connect(
|
||||
lambda: gobject.baseobject.openlink(
|
||||
|
@ -17,11 +17,10 @@ from myutils.ocrutil import imageCut, ocr_run
|
||||
from gui.rangeselect import rangeselct_function
|
||||
from gui.usefulwidget import (
|
||||
closeashidewindow,
|
||||
statusbutton,
|
||||
getQMessageBox,
|
||||
auto_select_webview,
|
||||
WebivewWidget,
|
||||
mshtmlWidget,
|
||||
IconButton,
|
||||
getboxlayout,
|
||||
getspinbox,
|
||||
getsimplecombobox,
|
||||
@ -460,19 +459,19 @@ class AnkiWindow(QWidget):
|
||||
self.recorders = {}
|
||||
wid = QWidget()
|
||||
layout = QVBoxLayout(wid)
|
||||
soundbutton = QPushButton(qtawesome.icon("fa.music"), "")
|
||||
soundbutton = IconButton("fa.music")
|
||||
soundbutton.clicked.connect(self.langdu)
|
||||
|
||||
soundbutton2 = QPushButton(qtawesome.icon("fa.music"), "")
|
||||
soundbutton2 = IconButton("fa.music")
|
||||
soundbutton2.clicked.connect(self.langdu2)
|
||||
cropbutton = QPushButton(qtawesome.icon("fa.crop"), "")
|
||||
cropbutton = IconButton("fa.crop")
|
||||
cropbutton.clicked.connect(functools.partial(self.crophide, False))
|
||||
cropbutton.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
cropbutton.customContextMenuRequested.connect(
|
||||
functools.partial(self.crophide, True)
|
||||
)
|
||||
|
||||
grabwindowbtn = QPushButton(qtawesome.icon("fa.camera"), "")
|
||||
grabwindowbtn = IconButton("fa.camera")
|
||||
grabwindowbtn.clicked.connect(
|
||||
lambda: grabwindow(
|
||||
getimageformat(),
|
||||
@ -481,7 +480,7 @@ class AnkiWindow(QWidget):
|
||||
)
|
||||
|
||||
def createtbn(target: QLineEdit):
|
||||
clearbtn = QPushButton(qtawesome.icon("fa.times"), "")
|
||||
clearbtn = IconButton("fa.times")
|
||||
clearbtn.clicked.connect(lambda: target.clear())
|
||||
return clearbtn
|
||||
|
||||
@ -527,11 +526,11 @@ class AnkiWindow(QWidget):
|
||||
|
||||
self.example.textChanged.connect(__)
|
||||
self.remarks = ctrlbedit()
|
||||
recordbtn1 = statusbutton(icons=["fa.microphone", "fa.stop"])
|
||||
recordbtn1 = IconButton(icon=["fa.microphone", "fa.stop"], checkable=True)
|
||||
recordbtn1.clicked.connect(
|
||||
functools.partial(self.startorendrecord, 1, self.audiopath)
|
||||
)
|
||||
recordbtn2 = statusbutton(icons=["fa.microphone", "fa.stop"])
|
||||
recordbtn2 = IconButton(icon=["fa.microphone", "fa.stop"], checkable=True)
|
||||
recordbtn2.clicked.connect(
|
||||
functools.partial(self.startorendrecord, 2, self.audiopath_sentence)
|
||||
)
|
||||
@ -554,13 +553,13 @@ class AnkiWindow(QWidget):
|
||||
|
||||
lb = QLabel("DeckName")
|
||||
lb.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Preferred)
|
||||
folder_open = QPushButton(qtawesome.icon("fa.folder-open"), "")
|
||||
folder_open = IconButton("fa.folder-open")
|
||||
folder_open.clicked.connect(functools.partial(self.selecfile, self.audiopath))
|
||||
folder_open2 = QPushButton(qtawesome.icon("fa.folder-open"), "")
|
||||
folder_open2 = IconButton("fa.folder-open")
|
||||
folder_open2.clicked.connect(
|
||||
functools.partial(self.selecfile, self.audiopath_sentence)
|
||||
)
|
||||
folder_open3 = QPushButton(qtawesome.icon("fa.folder-open"), "")
|
||||
folder_open3 = IconButton("fa.folder-open")
|
||||
folder_open3.clicked.connect(functools.partial(self.selecfile2, self.editpath))
|
||||
|
||||
def createadd():
|
||||
@ -1175,6 +1174,18 @@ class searchwordW(closeashidewindow):
|
||||
if action == auto:
|
||||
globalconfig["is_search_word_auto_tts"] = auto.isChecked()
|
||||
|
||||
def historymenu(self):
|
||||
menu = QMenu(self)
|
||||
__ = []
|
||||
for word in self.historys:
|
||||
act = QAction(word)
|
||||
__.append(act)
|
||||
menu.addAction(act)
|
||||
action = menu.exec(QCursor.pos())
|
||||
if action:
|
||||
self.searchtext.setText(action.text())
|
||||
self.search(action.text())
|
||||
|
||||
def setupUi(self):
|
||||
self.setWindowTitle("查词")
|
||||
self.ankiwindow = AnkiWindow(self)
|
||||
@ -1188,34 +1199,24 @@ class searchwordW(closeashidewindow):
|
||||
self.searchtext = FQLineEdit()
|
||||
self.searchtext.textChanged.connect(self.ankiwindow.reset)
|
||||
|
||||
self.dictbutton = statusbutton(
|
||||
icons="fa.book", colors=["", globalconfig["buttoncolor2"]]
|
||||
)
|
||||
self.history_last_btn = statusbutton(icons=["fa.arrow-left", "fa.arrow-left"])
|
||||
self.history_last_btn.clicked.connect(
|
||||
functools.partial(self.__move_history_search, -1)
|
||||
)
|
||||
self.history_next_btn = statusbutton(icons=["fa.arrow-right", "fa.arrow-right"])
|
||||
self.history_next_btn.clicked.connect(
|
||||
functools.partial(self.__move_history_search, 1)
|
||||
)
|
||||
self.dictbutton = IconButton(icon="fa.book", checkable=True)
|
||||
self.historys = []
|
||||
self.history_btn = IconButton(icon="fa.history")
|
||||
self.history_btn.setEnabled(False)
|
||||
self.history_btn.clicked.connect(self.historymenu)
|
||||
|
||||
self.trace_history = []
|
||||
self.trace_history_idx = -1
|
||||
self.__set_history_btn_able()
|
||||
self.searchlayout.addWidget(self.dictbutton)
|
||||
self.searchlayout.addWidget(self.history_last_btn)
|
||||
self.searchlayout.addWidget(self.history_next_btn)
|
||||
self.searchlayout.addWidget(self.history_btn)
|
||||
self.searchlayout.addWidget(self.searchtext)
|
||||
searchbutton = QPushButton(qtawesome.icon("fa.search"), "")
|
||||
searchbutton = IconButton("fa.search")
|
||||
searchbutton.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
searchbutton.customContextMenuRequested.connect(self._createnewwindowsearch)
|
||||
self.searchtext.returnPressed.connect(searchbutton.clicked.emit)
|
||||
|
||||
searchbutton.clicked.connect(self.__search_by_click_search_btn)
|
||||
searchbutton.clicked.connect(lambda: self.search(self.searchtext.text()))
|
||||
self.searchlayout.addWidget(searchbutton)
|
||||
|
||||
soundbutton = QPushButton(qtawesome.icon("fa.music"), "")
|
||||
soundbutton = IconButton("fa.music")
|
||||
soundbutton.clicked.connect(
|
||||
lambda: gobject.baseobject.read_text(self.searchtext.text())
|
||||
)
|
||||
@ -1224,9 +1225,7 @@ class searchwordW(closeashidewindow):
|
||||
self.soundbutton = soundbutton
|
||||
self.searchlayout.addWidget(soundbutton)
|
||||
|
||||
ankiconnect = statusbutton(
|
||||
icons="fa.adn", colors=["", globalconfig["buttoncolor2"]]
|
||||
)
|
||||
ankiconnect = IconButton(icon="fa.adn", checkable=True)
|
||||
ankiconnect.clicked.connect(self.onceaddankiwindow)
|
||||
ankiconnect.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
ankiconnect.customContextMenuRequested.connect(
|
||||
@ -1344,12 +1343,7 @@ class searchwordW(closeashidewindow):
|
||||
if append:
|
||||
word = self.searchtext.text() + word
|
||||
self.searchtext.setText(word)
|
||||
|
||||
self.search(word)
|
||||
if len(self.trace_history) == 0 or self.trace_history[-1] != word:
|
||||
self.trace_history.append(word)
|
||||
self.trace_history_idx = len(self.trace_history) - 1
|
||||
self.__set_history_btn_able()
|
||||
self.ankiwindow.example.setPlainText(gobject.baseobject.currenttext)
|
||||
if globalconfig["ankiconnect"]["autoruntts"]:
|
||||
self.ankiwindow.langdu()
|
||||
@ -1364,34 +1358,19 @@ class searchwordW(closeashidewindow):
|
||||
),
|
||||
)
|
||||
|
||||
def __set_history_btn_able(self):
|
||||
self.history_next_btn.setEnabled(
|
||||
self.trace_history_idx < len(self.trace_history) - 1
|
||||
)
|
||||
self.history_last_btn.setEnabled(self.trace_history_idx > 0)
|
||||
|
||||
def __move_history_search(self, offset):
|
||||
self.trace_history_idx += offset
|
||||
word = self.trace_history[self.trace_history_idx]
|
||||
self.__set_history_btn_able()
|
||||
self.searchtext.setText(word)
|
||||
self.search(word)
|
||||
|
||||
def __search_by_click_search_btn(self):
|
||||
word = self.searchtext.text()
|
||||
self.search(word)
|
||||
|
||||
if len(self.trace_history) == 0 or self.trace_history[-1] != word:
|
||||
self.trace_history.append(word)
|
||||
self.trace_history_idx = len(self.trace_history) - 1
|
||||
self.__set_history_btn_able()
|
||||
def __parsehistory(self, word):
|
||||
if word in self.historys:
|
||||
self.historys.remove(word)
|
||||
self.historys.insert(0, word)
|
||||
self.history_btn.setEnabled(True)
|
||||
|
||||
def search(self, word):
|
||||
current = time.time()
|
||||
self.current = current
|
||||
word = word.strip()
|
||||
if word == "":
|
||||
if not word:
|
||||
return
|
||||
self.__parsehistory(word)
|
||||
if globalconfig["is_search_word_auto_tts"]:
|
||||
gobject.baseobject.read_text(self.searchtext.text())
|
||||
self.ankiwindow.reset(word)
|
||||
|
@ -29,28 +29,27 @@ from gui.setting_about import doupdate
|
||||
from gui.dialog_memory import dialog_memory
|
||||
from gui.textbrowser import Textbrowser, TextType
|
||||
from gui.rangeselect import rangeselct_function
|
||||
from gui.usefulwidget import (
|
||||
resizableframeless,
|
||||
getQMessageBox,
|
||||
LIconLabel,
|
||||
findnearestscreen,
|
||||
)
|
||||
from gui.usefulwidget import resizableframeless, getQMessageBox, findnearestscreen
|
||||
from gui.edittext import edittrans
|
||||
from gui.dialog_savedgame import dialog_savedgame_integrated
|
||||
from gui.dialog_savedgame_setting import favorites, calculate_centered_rect
|
||||
from gui.dialog_savedgame_common import startgame
|
||||
from gui.dynalang import LDialog
|
||||
from gui.dynalang import LDialog, LLabel
|
||||
|
||||
|
||||
class ButtonX(QWidget):
|
||||
class IconLabelX(LLabel):
|
||||
clicked = pyqtSignal()
|
||||
rightclick = pyqtSignal()
|
||||
|
||||
def __init__(self, *argc):
|
||||
super().__init__(*argc)
|
||||
self.reflayout = None
|
||||
self._icon = QIcon()
|
||||
self._size = QSize()
|
||||
self.setMouseTracking(True)
|
||||
self.setSizePolicy(QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
|
||||
|
||||
def showinlayout(self, layout):
|
||||
def showinlayout(self, layout: QHBoxLayout):
|
||||
|
||||
layout.addWidget(self)
|
||||
self.show()
|
||||
@ -64,15 +63,37 @@ class ButtonX(QWidget):
|
||||
_.removeWidget(self)
|
||||
self.hide()
|
||||
|
||||
def resizeEvent(self, e):
|
||||
def resizeEvent(self, e: QResizeEvent):
|
||||
h = int(e.size().height() / 1.5)
|
||||
self.setFixedWidth(int(self.height() * 2 / 1.5))
|
||||
self.setIconSize(QSize(h, h))
|
||||
|
||||
def setIcon(self, icon: QIcon):
|
||||
self._icon = icon
|
||||
self.update()
|
||||
|
||||
class IconLabelX(LIconLabel, ButtonX):
|
||||
clicked = pyqtSignal()
|
||||
rightclick = pyqtSignal()
|
||||
def setIconSize(self, size: QSize):
|
||||
self._size = size
|
||||
self.update()
|
||||
|
||||
def paintEvent(self, a0: QPaintEvent) -> None:
|
||||
|
||||
painter = QPainter(self)
|
||||
if self._size.isEmpty():
|
||||
return
|
||||
rect = QRect(
|
||||
(self.width() - self._size.width()) // 2,
|
||||
(self.height() - self._size.height()) // 2,
|
||||
self._size.width(),
|
||||
self._size.height(),
|
||||
)
|
||||
self._icon.paint(
|
||||
painter,
|
||||
rect,
|
||||
Qt.AlignmentFlag.AlignCenter,
|
||||
QIcon.Mode.Normal,
|
||||
QIcon.State.On,
|
||||
)
|
||||
|
||||
def mousePressEvent(self, ev: QMouseEvent) -> None:
|
||||
if QObject.receivers(self, self.clicked) == 0:
|
||||
|
@ -376,11 +376,6 @@ def getQMessageBox(
|
||||
cancelcallback()
|
||||
|
||||
|
||||
def makerect(_):
|
||||
x, y, w, h = _
|
||||
return [x, x + w, y, y + h]
|
||||
|
||||
|
||||
def findnearestscreen(rect: QRect):
|
||||
# QScreen ,distance
|
||||
# -1时,是有交集
|
||||
@ -480,17 +475,6 @@ class closeashidewindow(saveposwindow):
|
||||
super().closeEvent(event)
|
||||
|
||||
|
||||
class commonsolveevent(QWidget):
|
||||
|
||||
def event(self, a0: QEvent) -> bool:
|
||||
if a0.type() == QEvent.Type.MouseButtonDblClick:
|
||||
return True
|
||||
elif a0.type() == QEvent.Type.EnabledChange:
|
||||
self.setEnabled(not self.isEnabled())
|
||||
return True
|
||||
return super().event(a0)
|
||||
|
||||
|
||||
def disablecolor(__: QColor):
|
||||
if __.rgb() == 0xFF000000:
|
||||
return Qt.GlobalColor.gray
|
||||
@ -505,29 +489,38 @@ def disablecolor(__: QColor):
|
||||
return __
|
||||
|
||||
|
||||
class MySwitch(commonsolveevent):
|
||||
class MySwitch(QWidget):
|
||||
clicked = pyqtSignal(bool)
|
||||
clicksignal = pyqtSignal()
|
||||
|
||||
def event(self, a0: QEvent) -> bool:
|
||||
if a0.type() == QEvent.Type.MouseButtonDblClick:
|
||||
return True
|
||||
elif a0.type() == QEvent.Type.EnabledChange:
|
||||
self.setEnabled(not self.isEnabled())
|
||||
return True
|
||||
elif a0.type() == QEvent.Type.FontChange:
|
||||
h = QFontMetricsF(self.font()).height()
|
||||
sz = QSize(
|
||||
int(1.62 * h * gobject.Consts.btnscale),
|
||||
int(h * gobject.Consts.btnscale),
|
||||
)
|
||||
self.setFixedSize(sz)
|
||||
|
||||
return super().event(a0)
|
||||
|
||||
def click(self):
|
||||
self.setChecked(not self.checked)
|
||||
self.clicked.emit(self.checked)
|
||||
|
||||
def sizeHint(self):
|
||||
return QSize(
|
||||
int(1.62 * globalconfig["buttonsize2"]), globalconfig["buttonsize2"]
|
||||
)
|
||||
|
||||
def __init__(self, parent=None, sign=True, enable=True, icon=None):
|
||||
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.clicksignal.connect(self.click)
|
||||
self.__currv = 0
|
||||
if sign:
|
||||
self.__currv = 20
|
||||
self.icon = icon
|
||||
|
||||
self.animation = QVariantAnimation()
|
||||
self.animation.setDuration(80)
|
||||
@ -551,18 +544,12 @@ class MySwitch(commonsolveevent):
|
||||
if check == self.checked:
|
||||
return
|
||||
self.checked = check
|
||||
self.runanimeorshowicon()
|
||||
self.runanime()
|
||||
|
||||
def update11(self):
|
||||
self.__currv = self.animation.currentValue()
|
||||
self.update()
|
||||
|
||||
def runanimeorshowicon(self):
|
||||
if self.icon:
|
||||
self.update()
|
||||
else:
|
||||
self.runanime()
|
||||
|
||||
def runanime(self):
|
||||
self.animation.setDirection(
|
||||
QVariantAnimation.Direction.Forward
|
||||
@ -574,7 +561,9 @@ class MySwitch(commonsolveevent):
|
||||
def getcurrentcolor(self):
|
||||
|
||||
__ = QColor(
|
||||
[globalconfig["buttoncolor3"], globalconfig["buttoncolor2"]][self.checked]
|
||||
[gobject.Consts.buttoncolor_disable, gobject.Consts.buttoncolor][
|
||||
self.checked
|
||||
]
|
||||
)
|
||||
if not self.enable:
|
||||
__ = disablecolor(__)
|
||||
@ -583,45 +572,35 @@ class MySwitch(commonsolveevent):
|
||||
def paintanime(self, painter: QPainter):
|
||||
|
||||
painter.setBrush(self.getcurrentcolor())
|
||||
bigw = self.size().width() - self.sizeHint().width()
|
||||
bigh = self.size().height() - self.sizeHint().height()
|
||||
x = bigw // 2
|
||||
y = bigh // 2
|
||||
wb = self.width() * 0.1
|
||||
hb = self.height() * 0.125
|
||||
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
|
||||
QRectF(
|
||||
wb,
|
||||
hb,
|
||||
self.width() - 2 * wb,
|
||||
self.height() - 2 * hb,
|
||||
),
|
||||
self.height() / 2 - hb,
|
||||
self.height() / 2 - hb,
|
||||
)
|
||||
r = self.height() * 0.275
|
||||
rb = self.height() / 2 - hb - r
|
||||
offset = self.__currv * (self.width() - 2 * wb - 2 * r - 2 * rb) / 20
|
||||
painter.setBrush(QColor(255, 255, 255))
|
||||
painter.drawEllipse(
|
||||
QPoint(
|
||||
x + self.sizeHint().height() // 2 + offset,
|
||||
y + self.sizeHint().height() // 2,
|
||||
QPointF(
|
||||
(wb + r + rb) + offset,
|
||||
(self.height() / 2),
|
||||
),
|
||||
int(self.sizeHint().height() * 0.35),
|
||||
int(self.sizeHint().height() * 0.35),
|
||||
r,
|
||||
r,
|
||||
)
|
||||
|
||||
def painticon(self, painter: QPainter):
|
||||
|
||||
icon: QIcon = qtawesome.icon(self.icon, color=self.getcurrentcolor())
|
||||
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 paintEvent(self, event):
|
||||
def paintEvent(self, _):
|
||||
painter = QPainter(self)
|
||||
painter.setRenderHint(QPainter.RenderHint.Antialiasing)
|
||||
painter.setPen(Qt.PenStyle.NoPen)
|
||||
if self.icon:
|
||||
self.painticon(painter)
|
||||
else:
|
||||
self.paintanime(painter)
|
||||
|
||||
def mouseReleaseEvent(self, event) -> None:
|
||||
@ -632,7 +611,7 @@ class MySwitch(commonsolveevent):
|
||||
try:
|
||||
self.checked = not self.checked
|
||||
self.clicked.emit(self.checked)
|
||||
self.runanimeorshowicon()
|
||||
self.runanime()
|
||||
# 父窗口deletelater
|
||||
except:
|
||||
pass
|
||||
@ -913,21 +892,17 @@ def D_getIconButton(callback=None, icon="fa.paint-brush", enable=True, qicon=Non
|
||||
def getcolorbutton(
|
||||
d,
|
||||
key,
|
||||
callback,
|
||||
callback=None,
|
||||
name=None,
|
||||
parent=None,
|
||||
icon="fa.paint-brush",
|
||||
constcolor=None,
|
||||
enable=True,
|
||||
qicon=None,
|
||||
sizefixed=False,
|
||||
):
|
||||
if qicon is None:
|
||||
qicon = qtawesome.icon(icon, color=constcolor if constcolor else d[key])
|
||||
b = IconButton(None, enable=enable, parent=parent, qicon=qicon)
|
||||
sz = int(1.42 * globalconfig["buttonsize2"])
|
||||
if sizefixed:
|
||||
b.setFixedSize(QSize(sz, sz))
|
||||
if callback:
|
||||
b.clicked.connect(callback)
|
||||
if name:
|
||||
@ -945,7 +920,6 @@ def D_getcolorbutton(
|
||||
constcolor=None,
|
||||
enable=True,
|
||||
qicon=None,
|
||||
sizefixed=False,
|
||||
):
|
||||
return lambda: getcolorbutton(
|
||||
d,
|
||||
@ -957,7 +931,6 @@ def D_getcolorbutton(
|
||||
constcolor,
|
||||
enable,
|
||||
qicon,
|
||||
sizefixed,
|
||||
)
|
||||
|
||||
|
||||
@ -1621,43 +1594,6 @@ class auto_select_webview(QWidget):
|
||||
return browser
|
||||
|
||||
|
||||
class threeswitch(QWidget):
|
||||
btnclicked = pyqtSignal(int)
|
||||
|
||||
def selectlayout(self, i):
|
||||
self.btns[(i + 0) % 3].setEnabled(False)
|
||||
self.btns[(i + 1) % 3].setEnabled(False)
|
||||
self.btns[(i + 2) % 3].setEnabled(False)
|
||||
self.btns[(i + 0) % 3].setChecked(True)
|
||||
self.btns[(i + 1) % 3].setChecked(False)
|
||||
self.btns[(i + 2) % 3].setChecked(False)
|
||||
self.btnclicked.emit(i)
|
||||
self.btns[(i + 1) % 3].setEnabled(True)
|
||||
self.btns[(i + 2) % 3].setEnabled(True)
|
||||
|
||||
def __init__(self, p, icons):
|
||||
super().__init__(p)
|
||||
self.btns = []
|
||||
for i, icon in enumerate(icons):
|
||||
btn = statusbutton(
|
||||
p=self,
|
||||
icons=icon,
|
||||
border=False,
|
||||
colors=["", globalconfig["buttoncolor2"]],
|
||||
)
|
||||
btn.clicked.connect(functools.partial(self.selectlayout, i))
|
||||
btn.setFixedSize(QSize(20, 25))
|
||||
self.btns.append(btn)
|
||||
self.setFixedSize(QSize(60, 75))
|
||||
|
||||
def resizeEvent(self, a0):
|
||||
x, y = 0, 0
|
||||
for btn in self.btns:
|
||||
btn.move(x, y)
|
||||
x += btn.width()
|
||||
return super().resizeEvent(a0)
|
||||
|
||||
|
||||
class threebuttons(QWidget):
|
||||
btn1clicked = pyqtSignal()
|
||||
btn2clicked = pyqtSignal()
|
||||
@ -2402,58 +2338,30 @@ class pixmapviewer(QWidget):
|
||||
return super().paintEvent(e)
|
||||
|
||||
|
||||
class statusbutton(QPushButton):
|
||||
|
||||
def __init__(self, icons, colors=None, border=True, p=None):
|
||||
super().__init__(p)
|
||||
if colors:
|
||||
self.colors = colors
|
||||
else:
|
||||
self.colors = ["", ""]
|
||||
if isinstance(icons, str):
|
||||
self.icons = [icons, icons]
|
||||
else:
|
||||
self.icons = icons
|
||||
self.setCheckable(True)
|
||||
self.seticon()
|
||||
self.clicked.connect(self.seticon)
|
||||
if not border:
|
||||
self.setStyleSheet("border:transparent")
|
||||
|
||||
def seticon(self):
|
||||
color = QColor(self.colors[self.isChecked()])
|
||||
if not self.isEnabled():
|
||||
color = disablecolor(color)
|
||||
icon = qtawesome.icon(self.icons[self.isChecked()], color=color)
|
||||
self.setIcon(icon)
|
||||
|
||||
def setChecked(self, a0):
|
||||
super().setChecked(a0)
|
||||
self.seticon()
|
||||
|
||||
def setEnabled(self, _):
|
||||
super().setEnabled(_)
|
||||
self.seticon()
|
||||
|
||||
|
||||
class IconButton(QPushButton):
|
||||
clicked_1 = pyqtSignal()
|
||||
|
||||
def sizeHint(self):
|
||||
return QSize(
|
||||
int(1.42 * globalconfig["buttonsize2"]),
|
||||
int(1.42 * globalconfig["buttonsize2"]),
|
||||
)
|
||||
def event(self, e):
|
||||
if e.type() == QEvent.Type.FontChange:
|
||||
h = QFontMetricsF(self.font()).height()
|
||||
h = int(h * gobject.Consts.btnscale)
|
||||
sz = QSize(h, h)
|
||||
self.setFixedSize(sz)
|
||||
self.setIconSize(sz)
|
||||
elif e.type() == QEvent.Type.EnabledChange:
|
||||
self.seticon()
|
||||
return super().event(e)
|
||||
|
||||
def __init__(self, icon, enable=True, qicon=None, parent=None):
|
||||
def __init__(self, icon, enable=True, qicon=None, parent=None, checkable=False):
|
||||
super().__init__(parent)
|
||||
self._icon = icon
|
||||
self.clicked.connect(self.clicked_1)
|
||||
self.clicked.connect(self.seticon)
|
||||
self._qicon = qicon
|
||||
self.setSizePolicy(QSizePolicy.Policy.Fixed, QSizePolicy.Policy.Fixed)
|
||||
self.setCursor(Qt.CursorShape.PointingHandCursor)
|
||||
self.setIconSize(self.sizeHint())
|
||||
self.setStyleSheet("border:transparent")
|
||||
self.setStyleSheet("border:transparent;padding: 0px;")
|
||||
self.setCheckable(checkable)
|
||||
self.setEnabled(enable)
|
||||
self.setFocusPolicy(Qt.FocusPolicy.NoFocus)
|
||||
|
||||
@ -2461,10 +2369,20 @@ class IconButton(QPushButton):
|
||||
if self._qicon:
|
||||
icon = self._qicon
|
||||
else:
|
||||
__ = QColor(globalconfig["buttoncolor2"])
|
||||
if self.isCheckable():
|
||||
if isinstance(self._icon, str):
|
||||
icons = [self._icon, self._icon]
|
||||
else:
|
||||
icons = self._icon
|
||||
icon = icons[self.isChecked()]
|
||||
colors = ["", gobject.Consts.buttoncolor]
|
||||
color = QColor(colors[self.isChecked()])
|
||||
else:
|
||||
color = QColor(gobject.Consts.buttoncolor)
|
||||
icon = self._icon
|
||||
if not self.isEnabled():
|
||||
__ = disablecolor(__)
|
||||
icon: QIcon = qtawesome.icon(self._icon, color=__)
|
||||
color = disablecolor(color)
|
||||
icon = qtawesome.icon(icon, color=color)
|
||||
self.setIcon(icon)
|
||||
|
||||
def setChecked(self, a0):
|
||||
@ -2476,42 +2394,6 @@ class IconButton(QPushButton):
|
||||
self.seticon()
|
||||
|
||||
|
||||
class LIconLabel(LLabel):
|
||||
def __init__(self, *argc):
|
||||
super().__init__(*argc)
|
||||
self._icon = QIcon()
|
||||
self._size = QSize()
|
||||
|
||||
def setIcon(self, icon: QIcon):
|
||||
self._icon = icon
|
||||
self.update()
|
||||
|
||||
def setIconSize(self, size: QSize):
|
||||
self._size = size
|
||||
self.update()
|
||||
|
||||
def paintEvent(self, a0: QPaintEvent) -> None:
|
||||
|
||||
painter = QPainter(self)
|
||||
if self._size.isEmpty():
|
||||
size = self.size()
|
||||
else:
|
||||
size = self._size
|
||||
rect = QRect(
|
||||
(self.width() - size.width()) // 2,
|
||||
(self.height() - size.height()) // 2,
|
||||
size.width(),
|
||||
size.height(),
|
||||
)
|
||||
self._icon.paint(
|
||||
painter,
|
||||
rect,
|
||||
Qt.AlignmentFlag.AlignCenter,
|
||||
QIcon.Mode.Normal,
|
||||
QIcon.State.On,
|
||||
)
|
||||
|
||||
|
||||
class SplitLine(QFrame):
|
||||
def __init__(self, *argc):
|
||||
super().__init__(*argc)
|
||||
@ -2703,12 +2585,7 @@ class editswitchTextBrowser(QWidget):
|
||||
l = QHBoxLayout(self)
|
||||
l.setContentsMargins(0, 0, 0, 0)
|
||||
l.addWidget(stack)
|
||||
self.switch = statusbutton(
|
||||
p=self,
|
||||
icons="fa.edit",
|
||||
colors=["", globalconfig["buttoncolor2"]],
|
||||
border=False,
|
||||
)
|
||||
self.switch = IconButton(parent=self, icon="fa.edit", checkable=True)
|
||||
self.switch.setFixedSize(QSize(25, 25))
|
||||
self.switch.raise_()
|
||||
self.switch.clicked.connect(stack.setCurrentIndex)
|
||||
|
@ -7,7 +7,7 @@ from ocrengines.baseocrclass import baseocr
|
||||
from qtsymbols import *
|
||||
from gui.dynalang import LPushButton, LLabel
|
||||
from gui.dynalang import LPushButton, LFormLayout, LLabel
|
||||
from gui.usefulwidget import SuperCombo, getboxlayout
|
||||
from gui.usefulwidget import SuperCombo, getboxlayout, IconButton
|
||||
import threading, qtawesome
|
||||
from language import Languages
|
||||
from myutils.subproc import subproc_w
|
||||
@ -97,7 +97,7 @@ def question():
|
||||
lst.append(combo)
|
||||
lst.append(btninstall)
|
||||
threading.Thread(target=loadlist, args=(combo,)).start()
|
||||
btndownload = QPushButton(icon=qtawesome.icon("fa.question"))
|
||||
btndownload = IconButton("fa.question")
|
||||
btndownload.clicked.connect(
|
||||
lambda: gobject.baseobject.openlink(
|
||||
dynamiclink("{docs_server}/#/zh/useapis/ocrapi?id=windowsocr")
|
||||
|
@ -474,6 +474,7 @@ class texthook(basetext):
|
||||
savehook_new_data[self.gameuid]["title"], "<msg_info_refresh>"
|
||||
)
|
||||
self.flashembedsettings(pid)
|
||||
self.setsettings()
|
||||
|
||||
def InsertPCHooks(self, which):
|
||||
for pid in self.pids:
|
||||
|
@ -509,8 +509,6 @@
|
||||
"accept_use_unicode_start": 0,
|
||||
"accept_use_unicode_end": 65535,
|
||||
"buttoncolor": "#2e2eff",
|
||||
"buttoncolor2": "#FF69B4",
|
||||
"buttoncolor3": "#afafaf",
|
||||
"buttoncolor_1": "#ff03f2",
|
||||
"premtsimi2": 90,
|
||||
"ocrrangecolor": "#000000",
|
||||
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "التعرف على الحروف المطبوعة ( متعدد اللغات )",
|
||||
"通用文字识别 intsig": "التعرف على الحروف العالمية",
|
||||
"音高": "الملعب",
|
||||
"强制直角": "اضطر زاوية الحق"
|
||||
"强制直角": "اضطر زاوية الحق",
|
||||
"链接": "لينك ."
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "印刷文字識別(多語種)",
|
||||
"通用文字识别 intsig": "通用文字識別intsig",
|
||||
"音高": "音高",
|
||||
"强制直角": "強制直角"
|
||||
"强制直角": "強制直角",
|
||||
"链接": "鏈接"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Rozpoznávání tisku textu (vícejazyčné)",
|
||||
"通用文字识别 intsig": "Univerzální rozpoznávání textu Intsig",
|
||||
"音高": "výška",
|
||||
"强制直角": "Vynucený pravý úhel"
|
||||
"强制直角": "Vynucený pravý úhel",
|
||||
"链接": "odkaz"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Drucktexterkennung (mehrsprachig)",
|
||||
"通用文字识别 intsig": "Universelle Texterkennung Intsig",
|
||||
"音高": "Tonhöhe",
|
||||
"强制直角": "Rechter Winkel erzwungen"
|
||||
"强制直角": "Rechter Winkel erzwungen",
|
||||
"链接": "Link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Printing text recognition (multilingual)",
|
||||
"通用文字识别 intsig": "Universal Text Recognition Intsig",
|
||||
"音高": "pitch",
|
||||
"强制直角": "Forced right angle"
|
||||
"强制直角": "Forced right angle",
|
||||
"链接": "link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Reconocimiento de texto impreso (multilingüe)",
|
||||
"通用文字识别 intsig": "Reconocimiento de texto universal intsig",
|
||||
"音高": "Tono",
|
||||
"强制直角": "ángulo recto forzado"
|
||||
"强制直角": "ángulo recto forzado",
|
||||
"链接": "Enlaces"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Reconnaissance de texte imprimée (multilingue)",
|
||||
"通用文字识别 intsig": "Reconnaissance de texte générique intsig",
|
||||
"音高": "Hauteur de ton",
|
||||
"强制直角": "Angle droit forcé"
|
||||
"强制直角": "Angle droit forcé",
|
||||
"链接": "Liens"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Riconoscimento del testo stampato (multilingue)",
|
||||
"通用文字识别 intsig": "Riconoscimento universale del testo Intsig",
|
||||
"音高": "pitch",
|
||||
"强制直角": "Angolo retto forzato"
|
||||
"强制直角": "Angolo retto forzato",
|
||||
"链接": "link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "印刷文字認識(多言語)",
|
||||
"通用文字识别 intsig": "共通文字認識intsig",
|
||||
"音高": "おんきょうのたかさ",
|
||||
"强制直角": "きょうせいちょつかく"
|
||||
"强制直角": "きょうせいちょつかく",
|
||||
"链接": "リンク#リンク#"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "인쇄 문자 인식 (다국어)",
|
||||
"通用文字识别 intsig": "일반 문자 인식 intsig",
|
||||
"音高": "음고",
|
||||
"强制直角": "강제 직각"
|
||||
"强制直角": "강제 직각",
|
||||
"链接": "링크"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Tekstherkenning afdrukken (meertalig)",
|
||||
"通用文字识别 intsig": "Universele tekstherkenning Intsig",
|
||||
"音高": "toonhoogte",
|
||||
"强制直角": "Regte hoek dwingen"
|
||||
"强制直角": "Regte hoek dwingen",
|
||||
"链接": "link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Rozpoznawanie tekstu drukowania (wielojęzyczne)",
|
||||
"通用文字识别 intsig": "Uniwersalne rozpoznawanie tekstu Intsig",
|
||||
"音高": "stopień",
|
||||
"强制直角": "Wymuszony kąt prosty"
|
||||
"强制直角": "Wymuszony kąt prosty",
|
||||
"链接": "link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Impressão de reconhecimento de texto (multilingue)",
|
||||
"通用文字识别 intsig": "Intsig de Reconhecimento Universal de Texto",
|
||||
"音高": "pitch",
|
||||
"强制直角": "Ângulo reto forçado"
|
||||
"强制直角": "Ângulo reto forçado",
|
||||
"链接": "link"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Распознавание печатного текста (многоязычие)",
|
||||
"通用文字识别 intsig": "Универсальное распознавание текста intsig",
|
||||
"音高": "Высота звука",
|
||||
"强制直角": "Обязательный прямой угол"
|
||||
"强制直角": "Обязательный прямой угол",
|
||||
"链接": "Ссылки"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Skriva ut textigenkänning (flerspråkig)",
|
||||
"通用文字识别 intsig": "Universal textigenkänning Intsig",
|
||||
"音高": "pitch",
|
||||
"强制直角": "Tvingad rätvinkel"
|
||||
"强制直角": "Tvingad rätvinkel",
|
||||
"链接": "länk"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "การจดจำคำพิมพ์ (หลายภาษา)",
|
||||
"通用文字识别 intsig": "การจดจำคำทั่วไป intsig",
|
||||
"音高": "ระดับเสียง",
|
||||
"强制直角": "บังคับมุมขวา"
|
||||
"强制直角": "บังคับมุมขวา",
|
||||
"链接": "ลิงค์"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Metin tanımlaması (çoklu dil)",
|
||||
"通用文字识别 intsig": "Universal Text Recognition Intsig",
|
||||
"音高": "Piç",
|
||||
"强制直角": "Güçlü sağ açı"
|
||||
"强制直角": "Güçlü sağ açı",
|
||||
"链接": "bağ"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Друк розпізнавання тексту (багатомове)",
|
||||
"通用文字识别 intsig": "Універсальне розпізнавання тексту Intsig",
|
||||
"音高": "виставка",
|
||||
"强制直角": "Примусовий правий кут"
|
||||
"强制直角": "Примусовий правий кут",
|
||||
"链接": "посилання"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "Nhận dạng văn bản in (đa ngôn ngữ)",
|
||||
"通用文字识别 intsig": "Nhận dạng văn bản chung intsig",
|
||||
"音高": "Cao độ",
|
||||
"强制直角": "Buộc góc phải"
|
||||
"强制直角": "Buộc góc phải",
|
||||
"链接": "Liên kết"
|
||||
}
|
@ -767,5 +767,6 @@
|
||||
"印刷文字识别(多语种)": "",
|
||||
"通用文字识别 intsig": "",
|
||||
"音高": "",
|
||||
"强制直角": ""
|
||||
"强制直角": "",
|
||||
"链接": ""
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user