This commit is contained in:
恍兮惚兮 2024-12-25 16:05:42 +08:00
parent 2b1e8f322f
commit b1385a9e74
24 changed files with 309 additions and 382 deletions

View File

@ -522,6 +522,16 @@ namespace
last = s; last = s;
buffer->from(s); buffer->from(s);
} }
void PCSG01036(TextBuffer *buffer, HookParam *hp)
{
auto s = buffer->strA();
static std::string last;
if (last == s)
return buffer->clear();
last = s;
strReplace(s, "#n", "");
buffer->from(s);
}
void FPCSG00815(TextBuffer *buffer, HookParam *hp) void FPCSG00815(TextBuffer *buffer, HookParam *hp)
{ {
auto s = buffer->strA(); auto s = buffer->strA();
@ -795,6 +805,10 @@ namespace
{0x8005426C, {CODEC_UTF8, 0, 0, 0, PCSG01068, "PCSG01068"}}, {0x8005426C, {CODEC_UTF8, 0, 0, 0, PCSG01068, "PCSG01068"}},
// スカーレッドライダーゼクス Rev. // スカーレッドライダーゼクス Rev.
{0x800BEE38, {CODEC_UTF8, 0, 0, 0, PCSG00787, "PCSG00745"}}, {0x800BEE38, {CODEC_UTF8, 0, 0, 0, PCSG00787, "PCSG00745"}},
// 緋色の欠片 ~おもいいろの記憶~
{0x8007838c, {CODEC_UTF8, 5, 0, 0, PCSG01036, "PCSG01036"}},
{0x8001154c, {CODEC_UTF8, 8, 0, 0, PCSG01036, "PCSG01036"}},
{0x800879ee, {CODEC_UTF8, 2, 0, 0, PCSG01036, "PCSG01036"}},
}; };
return 1; return 1;
}(); }();

View File

@ -1,7 +1,7 @@
set(VERSION_MAJOR 6) set(VERSION_MAJOR 6)
set(VERSION_MINOR 15) set(VERSION_MINOR 15)
set(VERSION_PATCH 2) set(VERSION_PATCH 3)
set(VERSION_REVISION 0) set(VERSION_REVISION 0)
set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}") set(LUNA_VERSION "{${VERSION_MAJOR},${VERSION_MINOR},${VERSION_PATCH},${VERSION_REVISION}}")
add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp) add_library(VERSION_DEF ${CMAKE_CURRENT_LIST_DIR}/version_def.cpp)

View File

@ -96,8 +96,8 @@
N无视上下文 N无视上下文
寄存器的data_offset 寄存器的data_offset
* 32位 -4 for EAX, -8 for ECX, -C for EDX, -10 for EBX, -14 for ESP, -18 for EBP, -1C for ESI, -20 for EDI * 32位 EAX -4, ECX -8, EDX -C, EBX -10, ESP -14, EBP -18, ESI -1C, EDI -20
* 64位 -C for RAX, -14 for RBX, -1C for RCX, -24 for RDX, and so on for RSP, RBP, RSI, RDI, R8-R15 * 64位 RAX -C, RBX -14, RCX -1C, RDX -24, RSP -2C, RBP -34, RSI -3C, RDI -44, R8 -4C, R9 -54, R10 -5C, R11 -64, R12 -6C, R13 -74, R14 -7C, R15 -84
1. #### JIT HOOK 1. #### JIT HOOK

View File

@ -1089,6 +1089,7 @@ class MAINUI:
fontsize=globalconfig["settingfontsize"] + 4, fontsize=globalconfig["settingfontsize"] + 4,
fonttype=globalconfig["settingfonttype"], fonttype=globalconfig["settingfonttype"],
) )
style+="QGroupBox#notitle{ margin-top:0px;} QGroupBox#notitle:title {margin-top: 0px;}"
self.commonstylebase.setStyleSheet(style) self.commonstylebase.setStyleSheet(style)
font = QFont() font = QFont()
font.setFamily(globalconfig["settingfonttype"]) font.setFamily(globalconfig["settingfonttype"])

View File

@ -2378,12 +2378,11 @@ class mdict(cishubase):
csscollect: dict, csscollect: dict,
): ):
base = os.path.dirname(fn) base = os.path.dirname(fn)
src_pattern = r'src="([^"]+)"' matches = re.findall('src="([^"]+)"', html_content)
href_pattern = r'href="([^"]+)"' matches += re.findall('href="([^"]+)"', html_content)
matches += re.findall("""href='([^']+)'""", html_content)
src_matches = re.findall(src_pattern, html_content) matches += re.findall("""src='([^']+)'""", html_content)
href_matches = re.findall(href_pattern, html_content) for url in matches:
for url in src_matches + href_matches:
if url.startswith("#"): # a href # 页内跳转 if url.startswith("#"): # a href # 页内跳转
continue continue
try: try:
@ -2468,11 +2467,11 @@ class mdict(cishubase):
contents = [] contents = []
idx = 0 idx = 0
for _, foldflow, title, res in allres: for _, foldflow, title, res in allres:
klass2='tab-pane_mdict_internal' klass2 = "tab-pane_mdict_internal"
klass1='tab-button_mdict_internal' klass1 = "tab-button_mdict_internal"
if idx==0: if idx == 0:
klass2+=' active' klass2 += " active"
klass1+=' active' klass1 += " active"
btns.append( btns.append(
"""<button type="button" onclick="onclickbtn_mdict_internal('buttonid_mdict_internal{idx}')" id="buttonid_mdict_internal{idx}" class="{klass}" data-tab="tab_mdict_internal{idx}">{title}</button>""".format( """<button type="button" onclick="onclickbtn_mdict_internal('buttonid_mdict_internal{idx}')" id="buttonid_mdict_internal{idx}" class="{klass}" data-tab="tab_mdict_internal{idx}">{title}</button>""".format(
idx=idx, title=title, klass=klass1 idx=idx, title=title, klass=klass1

View File

@ -4,6 +4,7 @@ from qtsymbols import *
import os, functools, uuid import os, functools, uuid
from traceback import print_exc from traceback import print_exc
import gobject, qtawesome import gobject, qtawesome
from gui.inputdialog import autoinitdialog
from gui.dynalang import LAction from gui.dynalang import LAction
from gui.dialog_savedgame_v3 import dialog_savedgame_v3 from gui.dialog_savedgame_v3 import dialog_savedgame_v3
from gui.dialog_savedgame_legacy import dialog_savedgame_legacy from gui.dialog_savedgame_legacy import dialog_savedgame_legacy
@ -22,7 +23,6 @@ from gui.usefulwidget import (
saveposwindow, saveposwindow,
getboxlayout, getboxlayout,
MySwitch, MySwitch,
Prompt_dialog,
IconButton, IconButton,
getsimplecombobox, getsimplecombobox,
FQLineEdit, FQLineEdit,
@ -414,25 +414,16 @@ class dialog_savedgame_new(QWidget):
self.clicked3_batch() self.clicked3_batch()
elif action == editname or action == addlist: elif action == editname or action == addlist:
_dia = Prompt_dialog( __d = {
self, "k": (
"修改列表名称" if action == editname else "创建列表", savegametaged[calculatetagidx(self.reftagid)]["title"]
"", if action == editname
[ else ""
[ )
"名称", }
(
savegametaged[calculatetagidx(self.reftagid)]["title"]
if action == editname
else ""
),
],
],
)
if _dia.exec(): def cb(__d):
title = __d["k"]
title = _dia.text[0].text()
if title != "": if title != "":
i = calculatetagidx(self.reftagid) i = calculatetagidx(self.reftagid)
if action == addlist: if action == addlist:
@ -448,6 +439,25 @@ class dialog_savedgame_new(QWidget):
savegametaged[i]["title"] = title savegametaged[i]["title"] = title
self.loadcombo(False) self.loadcombo(False)
autoinitdialog(
self,
__d,
"修改列表名称" if action == editname else "创建列表",
600,
[
{
"type": "lineedit",
"name": "名称",
"k": "k",
},
{
"type": "okcancel",
"callback": functools.partial(cb, __d),
},
],
exec_=True,
)
elif action == dellist: elif action == dellist:
i = calculatetagidx(self.reftagid) i = calculatetagidx(self.reftagid)
savegametaged.pop(i) savegametaged.pop(i)

View File

@ -487,6 +487,7 @@ def getalistname(parent, callback, skipid=False, skipidid=None, title="添加到
"callback": functools.partial(__wrap, callback, __d, __uid), "callback": functools.partial(__wrap, callback, __d, __uid),
}, },
], ],
exec_=True
) )
elif len(__uid): elif len(__uid):

View File

@ -49,10 +49,12 @@ from gui.usefulwidget import (
getsimpleswitch, getsimpleswitch,
threebuttons, threebuttons,
getspinbox, getspinbox,
CollapsibleBox,
getsmalllabel, getsmalllabel,
listediterline, listediterline,
editswitchTextBrowser, editswitchTextBrowser,
FocusCombo, FocusCombo,
VisLFormLayout,
) )
from gui.dynalang import ( from gui.dynalang import (
LFormLayout, LFormLayout,
@ -345,14 +347,15 @@ class dialog_setting_game_internal(QWidget):
print_exc() print_exc()
def metadataorigin(self, formLayout: LFormLayout, gameuid): def metadataorigin(self, formLayout: LFormLayout, gameuid):
vislf = VisLFormLayout()
formLayout.addRow(vislf)
combo = getsimplecombobox( combo = getsimplecombobox(
[""] + list(targetmod.keys()), [""] + list(targetmod.keys()),
globalconfig, globalconfig,
"primitivtemetaorigin", "primitivtemetaorigin",
internal=[None] + list(targetmod.keys()), internal=[None] + list(targetmod.keys()),
) )
formLayout.addRow("首选的", combo) vislf.addRow("首选的", combo)
formLayout.addRow(None, QLabel())
def valid(idx, x): def valid(idx, x):
if x: if x:
@ -363,6 +366,8 @@ class dialog_setting_game_internal(QWidget):
combo.setCurrentIndex(0) combo.setCurrentIndex(0)
combo.setRowVisible(idx + 1, x) combo.setRowVisible(idx + 1, x)
linei = 1
notvislineis = []
for i, key in enumerate(targetmod): for i, key in enumerate(targetmod):
try: try:
idname = targetmod[key].idname idname = targetmod[key].idname
@ -402,18 +407,37 @@ class dialog_setting_game_internal(QWidget):
continue continue
try: try:
__settting = targetmod[key].querysettingwindow __settting = targetmod[key].querysettingwindow
coll = CollapsibleBox(
functools.partial(__settting, gameuid), self, margin0=False
)
def _revert(c, li):
vis = c.isVisible()
vislf.setRowVisible(li, not vis)
c.toggle(not vis)
_vbox_internal.insert( _vbox_internal.insert(
2, 2,
getIconButton( getIconButton(
functools.partial(__settting, self, gameuid), icon="fa.gear" functools.partial(_revert, coll, linei + 1),
icon="fa.gear",
), ),
) )
vislf.addRow(
key,
getboxlayout(_vbox_internal),
)
vislf.addRow(coll)
notvislineis.append(linei + 1)
linei += 2
except: except:
pass vislf.addRow(
formLayout.addRow( key,
key, getboxlayout(_vbox_internal),
getboxlayout(_vbox_internal), )
) linei += 1
for _ in notvislineis:
vislf.setRowVisible(_, False)
def doaddtab(self, wfunct, exe, layout): def doaddtab(self, wfunct, exe, layout):
w, do = wfunct(exe) w, do = wfunct(exe)
@ -1032,6 +1056,7 @@ class dialog_setting_game_internal(QWidget):
"callback": functools.partial(__callback, _internal, __d), "callback": functools.partial(__callback, _internal, __d),
}, },
], ],
exec_=True,
) )
def getlangtab(self, formLayout: LFormLayout, gameuid): def getlangtab(self, formLayout: LFormLayout, gameuid):

View File

@ -1,7 +1,7 @@
from qtsymbols import * from qtsymbols import *
import os, functools, uuid, threading, shutil, time import os, functools, uuid, threading, shutil, time
from traceback import print_exc from traceback import print_exc
import gobject, base64 import gobject
from myutils.config import ( from myutils.config import (
savehook_new_list, savehook_new_list,
savehook_new_data, savehook_new_data,
@ -18,7 +18,6 @@ from gui.specialwidget import stackedlist, shrinkableitem, shownumQPushButton
from gui.usefulwidget import ( from gui.usefulwidget import (
pixmapviewer, pixmapviewer,
statusbutton, statusbutton,
Prompt_dialog,
makesubtab_lazy, makesubtab_lazy,
tabadd_lazy, tabadd_lazy,
listediter, listediter,
@ -744,32 +743,8 @@ class dialog_savedgame_v3(QWidget):
if action == startgame: if action == startgame:
startgamecheck(self, getreflist(self.reftagid), self.currentfocusuid) startgamecheck(self, getreflist(self.reftagid), self.currentfocusuid)
elif addlist == action: elif addlist == action:
_dia = Prompt_dialog(
self,
"创建列表",
"",
[
["名称", ""],
],
)
if _dia.exec(): self.createlist(True, None)
title = _dia.text[0].text()
if title != "":
i = calculatetagidx(None)
if action == addlist:
tag = {
"title": title,
"games": [],
"uid": str(uuid.uuid4()),
"opened": True,
}
savegametaged.insert(i, tag)
group0, btn = self.createtaglist(
self.stack, title, tag["uid"], True
)
self.stack.insertw(i, group0)
elif action == delgame: elif action == delgame:
self.shanchuyouxi() self.shanchuyouxi()
@ -1002,42 +977,7 @@ class dialog_savedgame_v3(QWidget):
elif action == Downaction: elif action == Downaction:
self.taglistrerank(tagid, 1) self.taglistrerank(tagid, 1)
elif action == editname or action == addlist: elif action == editname or action == addlist:
_dia = Prompt_dialog( self.createlist(action == addlist, tagid)
self,
"修改列表名称" if action == editname else "创建列表",
"",
[
[
"名称",
(
savegametaged[calculatetagidx(tagid)]["title"]
if action == editname
else ""
),
],
],
)
if _dia.exec():
title = _dia.text[0].text()
if title != "":
i = calculatetagidx(tagid)
if action == addlist:
tag = {
"title": title,
"games": [],
"uid": str(uuid.uuid4()),
"opened": True,
}
savegametaged.insert(i, tag)
group0, btn = self.createtaglist(
self.stack, title, tag["uid"], True
)
self.stack.insertw(i, group0)
elif action == editname:
self.stack.w(i).settitle(title)
savegametaged[i]["title"] = title
elif action == dellist: elif action == dellist:
i = calculatetagidx(tagid) i = calculatetagidx(tagid)
@ -1045,6 +985,47 @@ class dialog_savedgame_v3(QWidget):
self.stack.popw(i) self.stack.popw(i)
self.reallist.pop(tagid) self.reallist.pop(tagid)
def createlist(self, create, tagid):
__d = {"k": ("" if create else savegametaged[calculatetagidx(tagid)]["title"])}
def cb(__d):
title = __d["k"]
if not title:
return
i = calculatetagidx(tagid)
if create:
tag = {
"title": title,
"games": [],
"uid": str(uuid.uuid4()),
"opened": True,
}
savegametaged.insert(i, tag)
group0, btn = self.createtaglist(self.stack, title, tag["uid"], True)
self.stack.insertw(i, group0)
else:
self.stack.w(i).settitle(title)
savegametaged[i]["title"] = title
autoinitdialog(
self,
__d,
"创建列表" if create else "修改列表名称",
600,
[
{
"type": "lineedit",
"name": "名称",
"k": "k",
},
{
"type": "okcancel",
"callback": functools.partial(cb, __d),
},
],
exec_=True,
)
def createtaglist(self, p, title, tagid, opened): def createtaglist(self, p, title, tagid, opened):
self.reallist[tagid] = [] self.reallist[tagid] = []

View File

@ -265,3 +265,18 @@ class LStandardItemModel(QStandardItemModel):
def removeColumn(self, col): def removeColumn(self, col):
self.__ls.pop(col) self.__ls.pop(col)
super().removeColumn(col) super().removeColumn(col)
class LToolButton(QToolButton):
def __init__(self, *argc, **kwarg):
super().__init__(*argc, **kwarg)
self._text = self.text()
super().setText(_TR(self._text))
def setText(self, t):
self._text = t
super().setText(_TR(t))
def updatelangtext(self):
if self._text:
super().setText(_TR(self._text))

View File

@ -445,9 +445,17 @@ def autoinitdialog_items(dic):
@Singleton_close @Singleton_close
class autoinitdialog__(LDialog): class autoinitdialog(LDialog):
def __init__( def __init__(
self, parent, dd, title, width, lines, modelfile=None, maybehasextrainfo=None self,
parent,
dd,
title,
width,
lines,
modelfile=None,
maybehasextrainfo=None,
exec_=False,
) -> None: ) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
self.setWindowTitle(title) self.setWindowTitle(title)
@ -695,18 +703,10 @@ class autoinitdialog__(LDialog):
cachecombo[comboname].currentIndexChanged.emit( cachecombo[comboname].currentIndexChanged.emit(
cachecombo[comboname].currentIndex() cachecombo[comboname].currentIndex()
) )
if exec_:
self.show() self.exec_()
else:
self.show()
def autoinitdialogx(
parent, dd, title, width, lines, modelfile, maybehasextrainfo, _=None
):
autoinitdialog__(parent, dd, title, width, lines, modelfile, maybehasextrainfo)
def autoinitdialog(parent, dd, title, width, lines, _=None):
autoinitdialog__(parent, dd, title, width, lines)
def getsomepath1( def getsomepath1(

View File

@ -13,7 +13,7 @@ import subprocess
from gui.usefulwidget import ( from gui.usefulwidget import (
D_getsimpleswitch, D_getsimpleswitch,
makescrollgrid, makescrollgrid,
CollapsibleBox, CollapsibleBoxWithButton,
makesubtab_lazy, makesubtab_lazy,
D_getsimplecombobox, D_getsimplecombobox,
makegrid, makegrid,
@ -276,7 +276,7 @@ def changelog(self, basel: QHBoxLayout):
basel.addWidget(_) basel.addWidget(_)
def delayloadlinks(key, box): def delayloadlinks(key, lay):
sources = static_data["aboutsource"][key] sources = static_data["aboutsource"][key]
grid = [] grid = []
for source in sources: for source in sources:
@ -303,24 +303,13 @@ def delayloadlinks(key, box):
) )
] ]
) )
grid = [ w, do = makegrid(grid, delay=True)
[ lay.addWidget(w)
(
dict(type="grid", grid=grid),
0,
"group",
)
]
]
w, do = makegrid(grid, delay=True, w=False)
w.setContentsMargins(0, 0, 0, 0)
box.content_area.setLayout(w)
do() do()
def offlinelinks(key): def offlinelinks(key):
box = CollapsibleBox("下载") box = CollapsibleBoxWithButton(functools.partial(delayloadlinks, key), "下载")
box.setdelayload(functools.partial(delayloadlinks, key))
return box return box

View File

@ -4,7 +4,6 @@ from myutils.utils import splitocrtypes
from myutils.config import globalconfig, _TR, get_platform from myutils.config import globalconfig, _TR, get_platform
from gui.inputdialog import ( from gui.inputdialog import (
multicolorset, multicolorset,
autoinitdialogx,
autoinitdialog_items, autoinitdialog_items,
autoinitdialog, autoinitdialog,
) )
@ -147,7 +146,7 @@ def initinternal(self, names):
line += [ line += [
D_getIconButton( D_getIconButton(
callback=functools.partial( callback=functools.partial(
autoinitdialogx, autoinitdialog,
self, self,
globalconfig["cishu"][cishu]["args"], globalconfig["cishu"][cishu]["args"],
globalconfig["cishu"][cishu]["name"], globalconfig["cishu"][cishu]["name"],

View File

@ -172,42 +172,6 @@ def createinternalfontsettings(self, forml: LFormLayout, group, _type):
) )
def doinstallqweb(self, dd, base):
if not dd["k"].endswith(base):
getQMessageBox(self, "错误", "请选择_" + base)
return
with zipfile.ZipFile(dd["k"]) as zipf:
target = gobject.gettempdir("QWebEngine/")
zipf.extractall(target)
bit = ["x86", "x64"][platform.architecture()[0] == "64bit"]
copytree("{}/{}/PyQt5".format(target, bit), "files/runtime/PyQt5")
getQMessageBox(self, "成功", "安装成功")
def installqwebdialog(self, link):
dd = {"k": ""}
base = link.split("/")[-1]
autoinitdialog(
self,
dd,
"安装_QWebEngine",
800,
[
{
"type": "file",
"name": "路径",
"k": "k",
"dir": False,
"filter": base,
},
{
"type": "okcancel",
"callback": functools.partial(doinstallqweb, self, dd, base),
},
],
)
def resetgroudswitchcallback(self, group): def resetgroudswitchcallback(self, group):
if group == "QWebEngine": if group == "QWebEngine":
group = "webview" group = "webview"

View File

@ -2,7 +2,7 @@ from qtsymbols import *
import functools, os import functools, os
from myutils.config import globalconfig, ocrsetting, ocrerrorfix, static_data from myutils.config import globalconfig, ocrsetting, ocrerrorfix, static_data
from myutils.utils import splitocrtypes, dynamiclink, getimagefilefilter from myutils.utils import splitocrtypes, dynamiclink, getimagefilefilter
from gui.inputdialog import autoinitdialogx, postconfigdialog, autoinitdialog_items from gui.inputdialog import postconfigdialog, autoinitdialog_items, autoinitdialog
from gui.usefulwidget import ( from gui.usefulwidget import (
D_getsimplecombobox, D_getsimplecombobox,
D_getspinbox, D_getspinbox,
@ -142,7 +142,7 @@ def initgridsources(self, names):
items = autoinitdialog_items(ocrsetting[name]) items = autoinitdialog_items(ocrsetting[name])
_3 = D_getIconButton( _3 = D_getIconButton(
callback=functools.partial( callback=functools.partial(
autoinitdialogx, autoinitdialog,
self, self,
ocrsetting[name]["args"], ocrsetting[name]["args"],
globalconfig["ocr"][name]["name"], globalconfig["ocr"][name]["name"],

View File

@ -1,7 +1,7 @@
from qtsymbols import * from qtsymbols import *
import functools, os import functools, os
import gobject, qtawesome, uuid, shutil import gobject, qtawesome, uuid, shutil
from myutils.config import globalconfig, translatorsetting, static_data from myutils.config import globalconfig, translatorsetting
from myutils.utils import ( from myutils.utils import (
selectdebugfile, selectdebugfile,
splittranslatortypes, splittranslatortypes,
@ -10,12 +10,11 @@ from myutils.utils import (
dynamicapiname, dynamicapiname,
) )
from gui.pretransfile import sqlite2json from gui.pretransfile import sqlite2json
from gui.inputdialog import autoinitdialog, autoinitdialog_items, autoinitdialogx from gui.inputdialog import autoinitdialog, autoinitdialog_items
from gui.usefulwidget import ( from gui.usefulwidget import (
D_getspinbox, D_getspinbox,
getIconButton, getIconButton,
D_getcolorbutton, D_getcolorbutton,
Prompt_dialog,
getcolorbutton, getcolorbutton,
getsimpleswitch, getsimpleswitch,
D_getIconButton, D_getIconButton,
@ -114,44 +113,57 @@ def getalistname(parent, copy, btnplus, callback):
} }
) )
autoinitdialog( autoinitdialog(
parent, parent, __d, ("删除" if copy else "复制") + "接口", 600, __, exec_=True
__d,
("删除" if copy else "复制") + "接口",
600,
__,
) )
def renameapi(qlabel: QLabel, apiuid, _): def renameapi(qlabel: QLabel, apiuid, self, countnum, btnplus, _):
menu = QMenu(qlabel) menu = QMenu(qlabel)
editname = LAction("重命名") editname = LAction("重命名")
delete = LAction("删除")
menu.addAction(editname) menu.addAction(editname)
which = translate_exits(apiuid, which=True)
if which == 1:
menu.addAction(delete)
action = menu.exec(qlabel.mapToGlobal(_)) action = menu.exec(qlabel.mapToGlobal(_))
if action == delete:
selectllmcallback_2(self, countnum, btnplus, apiuid, None)
if action == editname: if action == editname:
before = dynamicapiname(apiuid) before = dynamicapiname(apiuid)
_dia = Prompt_dialog( __d = {"k": before}
qlabel,
"重命名",
"",
[
[
"名称",
before,
],
],
)
if _dia.exec(): def cb(__d):
title = _dia.text[0].text() title = __d["k"]
if title not in ("", before): if title not in ("", before):
globalconfig["fanyi"][apiuid]["name_self_set"] = title globalconfig["fanyi"][apiuid]["name_self_set"] = title
qlabel.setText(title) qlabel.setText(title)
autoinitdialog(
self,
__d,
"重命名",
600,
[
{
"type": "lineedit",
"name": "名称",
"k": "k",
},
{
"type": "okcancel",
"callback": functools.partial(cb, __d),
},
],
exec_=True,
)
def getrenameablellabel(uid):
def getrenameablellabel(uid, self, countnum, btnplus):
name = LLabel(dynamicapiname(uid)) name = LLabel(dynamicapiname(uid))
name.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu) name.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
name.customContextMenuRequested.connect(functools.partial(renameapi, name, uid)) name.customContextMenuRequested.connect(
functools.partial(renameapi, name, uid, self, countnum, btnplus)
)
return name return name
@ -164,7 +176,7 @@ def loadbutton(self, fanyi):
aclass = "userconfig.copyed." + fanyi aclass = "userconfig.copyed." + fanyi
else: else:
return return
return autoinitdialogx( return autoinitdialog(
self, self,
translatorsetting[fanyi]["args"], translatorsetting[fanyi]["args"],
dynamicapiname(fanyi), dynamicapiname(fanyi),
@ -203,7 +215,7 @@ def selectllmcallback(self, countnum, btnplus, fanyi, name):
icon="fa.gear", icon="fa.gear",
) )
name = getrenameablellabel(uid) name = getrenameablellabel(uid, self, countnum, btnplus)
swc = getsimpleswitch( swc = getsimpleswitch(
globalconfig["fanyi"][uid], globalconfig["fanyi"][uid],
"use", "use",
@ -364,7 +376,7 @@ def initsome11(self, l, label=None, btnplus=False):
else: else:
last = "" last = ""
line += [ line += [
functools.partial(getrenameablellabel, fanyi), functools.partial(getrenameablellabel, fanyi, self, countnum, btnplus),
D_getsimpleswitch( D_getsimpleswitch(
globalconfig["fanyi"][fanyi], globalconfig["fanyi"][fanyi],
"use", "use",

View File

@ -34,7 +34,6 @@ from gui.usefulwidget import (
getIconButton, getIconButton,
saveposwindow, saveposwindow,
tabadd_lazy, tabadd_lazy,
LRButton,
) )
from gui.dynalang import ( from gui.dynalang import (
LPushButton, LPushButton,
@ -516,9 +515,10 @@ class AnkiWindow(QWidget):
folder_open3.clicked.connect(functools.partial(self.selecfile2, self.editpath)) folder_open3.clicked.connect(functools.partial(self.selecfile2, self.editpath))
def createadd(): def createadd():
btn = LRButton("添加") btn = QPushButton("添加")
btn.clicked.connect(functools.partial(self.errorwrap, False)) btn.clicked.connect(functools.partial(self.errorwrap, False))
btn.rightclick.connect(functools.partial(self.errorwrap, True)) btn.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
btn.customContextMenuRequested.connect(functools.partial(self.errorwrap, True))
return btn return btn
layout.addLayout( layout.addLayout(

View File

@ -93,9 +93,9 @@ class transhist(closeashidewindow):
def refresh(self): def refresh(self):
with self.lock: with self.lock:
self.textOutput.clear() self.textOutput.setPlainText(
for line in self.trace: "\n".join(self.visline(line) for line in self.trace)
self.textOutput.appendPlainText(self.visline(line)) )
def visline(self, line): def visline(self, line):
ii, line = line ii, line = line

View File

@ -17,6 +17,7 @@ from gui.dynalang import (
LStandardItemModel, LStandardItemModel,
LDialog, LDialog,
LMainWindow, LMainWindow,
LToolButton,
) )
@ -855,42 +856,6 @@ class resizableframeless(saveposwindow):
return x, y, width, height return x, y, width, height
class Prompt_dialog(LDialog):
def __init__(self, parent, title, info, items) -> None:
super().__init__(parent)
self.setWindowFlags(
self.windowFlags()
& ~Qt.WindowType.WindowContextHelpButtonHint
& ~Qt.WindowType.WindowCloseButtonHint
| Qt.WindowType.WindowStaysOnTopHint
)
self.setWindowTitle(title)
self.setWindowIcon(qtawesome.icon("fa-question"))
_layout = QVBoxLayout()
_layout.addWidget(LLabel(info))
self.text = []
for _ in items:
le = QLineEdit()
le.setText(_[1])
self.text.append((le))
hl = QHBoxLayout()
hl.addWidget(LLabel(_[0]))
hl.addWidget(le)
_layout.addLayout(hl)
button = QDialogButtonBox(
QDialogButtonBox.StandardButton.Ok | QDialogButtonBox.StandardButton.Cancel
)
button.accepted.connect(self.accept)
button.rejected.connect(self.reject)
_layout.addWidget(button)
self.setLayout(_layout)
self.resize(400, 1)
def callbackwrap(d, k, call, _): def callbackwrap(d, k, call, _):
d[k] = _ d[k] = _
@ -1783,15 +1748,7 @@ def makegroupingrid(args):
if title: if title:
group.setTitle(title) group.setTitle(title)
else: else:
_id = "luna" + str(uuid.uuid4()) group.setObjectName('notitle')
group.setObjectName(_id)
group.setStyleSheet(
"QGroupBox#"
+ _id
+ "{ margin-top:0px;} QGroupBox#"
+ _id
+ ":title {margin-top: 0px;}"
)
if _type == "grid": if _type == "grid":
grid = QGridLayout() grid = QGridLayout()
@ -1875,18 +1832,18 @@ def automakegrid(grid: QGridLayout, lis, save=False, savelist=None):
grid.setRowMinimumHeight(nowr, 25) grid.setRowMinimumHeight(nowr, 25)
def makegrid(grid=None, save=False, savelist=None, savelay=None, delay=False, w=True): def makegrid(
grid=None, save=False, savelist=None, savelay=None, delay=False
):
class gridwidget(QWidget): class gridwidget(QWidget):
pass pass
if w: gridlayoutwidget = gridwidget()
gridlayoutwidget = gridwidget()
gridlay = QGridLayout() gridlay = QGridLayout()
gridlay.setAlignment(Qt.AlignmentFlag.AlignTop) gridlay.setAlignment(Qt.AlignmentFlag.AlignTop)
if w: gridlayoutwidget.setLayout(gridlay)
gridlayoutwidget.setLayout(gridlay) gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}")
gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}")
def do(gridlay, grid, save, savelist, savelay): def do(gridlay, grid, save, savelist, savelay):
automakegrid(gridlay, grid, save, savelist) automakegrid(gridlay, grid, save, savelist)
@ -1894,8 +1851,7 @@ def makegrid(grid=None, save=False, savelist=None, savelay=None, delay=False, w=
savelay.append(gridlay) savelay.append(gridlay)
__do = functools.partial(do, gridlay, grid, save, savelist, savelay) __do = functools.partial(do, gridlay, grid, save, savelist, savelay)
if not w:
gridlayoutwidget = gridlay
if not delay: if not delay:
__do() __do()
return gridlayoutwidget return gridlayoutwidget
@ -2536,16 +2492,6 @@ class FQLineEdit(QLineEdit):
return super().mousePressEvent(a0) return super().mousePressEvent(a0)
class LRButton(LPushButton):
rightclick = pyqtSignal()
def mouseReleaseEvent(self, ev: QMouseEvent) -> None:
if self.rect().contains(ev.pos()):
if ev.button() == Qt.MouseButton.RightButton:
self.rightclick.emit()
return super().mouseReleaseEvent(ev)
class VisLFormLayout(LFormLayout): class VisLFormLayout(LFormLayout):
# 简易实现 # 简易实现
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
@ -2593,45 +2539,47 @@ class VisLFormLayout(LFormLayout):
self._row_vis[row_index] = visible self._row_vis[row_index] = visible
class CollapsibleBox(QWidget): class CollapsibleBox(QGroupBox):
def setdelayload(self, func): def __init__(self, delayloadfunction=None, parent=None, margin0=True):
self.func = func
def __init__(self, title="", parent=None):
super(CollapsibleBox, self).__init__(parent) super(CollapsibleBox, self).__init__(parent)
self.setObjectName('notitle')
lay = QVBoxLayout(self)
if margin0:
lay.setContentsMargins(0, 0, 0, 0)
self.setLayout(lay)
self.func = delayloadfunction
self.toggle(False)
self.toggle_button = QToolButton(text=title, checkable=True, checked=False) def toggle(self, checked):
if checked and self.func:
self.func(self.layout())
self.func = None
self.setVisible(checked)
class CollapsibleBoxWithButton(QWidget):
def __init__(self, delayloadfunction=None, title="", parent=None):
super(CollapsibleBoxWithButton, self).__init__(parent)
self.toggle_button = LToolButton(text=title, checkable=True, checked=False)
self.toggle_button.setToolButtonStyle( self.toggle_button.setToolButtonStyle(
Qt.ToolButtonStyle.ToolButtonTextBesideIcon Qt.ToolButtonStyle.ToolButtonTextBesideIcon
) )
self.toggle_button.toggled.connect(self.on_toggled) self.toggle_button.toggled.connect(self.toggled)
self.content_area = QWidget() self.content_area = CollapsibleBox(delayloadfunction, self)
lay = QVBoxLayout(self) lay = QVBoxLayout(self)
lay.setSpacing(0) lay.setSpacing(0)
lay.setContentsMargins(0, 0, 0, 0) lay.setContentsMargins(0, 0, 0, 0)
lay.addWidget(self.toggle_button) lay.addWidget(self.toggle_button)
lay.addWidget(self.content_area) lay.addWidget(self.content_area)
self.func = None self.toggled(False)
self.collapse()
def on_toggled(self, checked): def toggled(self, checked):
if checked: self.toggle_button.setChecked(checked)
if self.func: self.content_area.toggle(checked)
self.func(self) self.toggle_button.setIcon(
self.func = None qtawesome.icon("fa.chevron-down" if checked else "fa.chevron-right")
self.toggle_button.setIcon(qtawesome.icon("fa.chevron-down")) )
self.content_area.setVisible(True)
else:
self.toggle_button.setIcon(qtawesome.icon("fa.chevron-right"))
self.content_area.setVisible(False)
def expand(self):
self.toggle_button.setChecked(True)
self.on_toggled(True)
def collapse(self):
self.toggle_button.setChecked(False)
self.on_toggled(False)
class editswitchTextBrowser(QWidget): class editswitchTextBrowser(QWidget):

View File

@ -5,12 +5,11 @@ import functools, time, json, gobject
from qtsymbols import * from qtsymbols import *
from metadata.abstract import common from metadata.abstract import common
from gui.dialog_savedgame import getreflist, getalistname from gui.dialog_savedgame import getreflist, getalistname
from myutils.wrapper import Singleton_close, threader from myutils.wrapper import threader
from gui.dynalang import LPushButton from gui.usefulwidget import threebuttons
@Singleton_close class bgmsettings(QFormLayout):
class bgmsettings(QDialog):
@property @property
def headers(self): def headers(self):
@ -118,10 +117,6 @@ class bgmsettings(QDialog):
except: except:
pass pass
def __getalistname(self, title, callback, _):
getalistname(self, callback, title=title)
infosig = pyqtSignal(str)
showhide = pyqtSignal(bool) showhide = pyqtSignal(bool)
@threader @threader
@ -229,18 +224,17 @@ class bgmsettings(QDialog):
print(self._ref.config) print(self._ref.config)
break break
def __init__(self, parent, _ref: common, gameuid: str) -> None: def __init__(self, layout: QVBoxLayout, _ref: common, gameuid: str) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) super().__init__(None)
layout.addLayout(self)
self.tm = None self.tm = None
self._ref = _ref self._ref = _ref
self.resize(QSize(800, 10))
self.setWindowTitle(self._ref.config_all["name"])
fl = QFormLayout(self)
vbox = QVBoxLayout() vbox = QVBoxLayout()
hbox = QHBoxLayout() hbox = QHBoxLayout()
s = QLineEdit() s = QLineEdit()
self.lbinfo = QLabel() self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid) s.textChanged.connect(self.checkvalid)
s.setText(_ref.config["access-token"])
fl2 = QFormLayout() fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0) fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget() ww = QWidget()
@ -255,29 +249,24 @@ class bgmsettings(QDialog):
hbox.addWidget(oauth) hbox.addWidget(oauth)
oauth.clicked.connect(self.__oauth) oauth.clicked.connect(self.__oauth)
vbox.addWidget(self.lbinfo) vbox.addWidget(self.lbinfo)
fl.addRow("access-token", vbox) self.addRow("access-token", vbox)
btn = LPushButton("上传游戏")
btn.clicked.connect( btn = threebuttons(["上传游戏", "上传游戏列表", "获取游戏列表"])
btn.btn1clicked.connect(
functools.partial(self.singleupload_existsoverride, gameuid) functools.partial(self.singleupload_existsoverride, gameuid)
) )
fl2.addRow(btn) btn.btn2clicked.connect(
btn = LPushButton("上传游戏列表")
btn.clicked.connect(
functools.partial( functools.partial(
self.__getalistname, "上传游戏列表", self.getalistname_upload getalistname, btn, self.getalistname_upload, "上传游戏列表"
)
)
btn.btn3clicked.connect(
functools.partial(
getalistname, btn, self.getalistname_download, "添加到列表"
) )
) )
fl2.addRow(btn) fl2.addRow(btn)
btn = LPushButton("获取游戏列表") self.addRow(ww)
btn.clicked.connect(
functools.partial(
self.__getalistname, "添加到列表", self.getalistname_download
)
)
fl2.addRow(btn)
fl.addRow(ww)
s.setText(_ref.config["access-token"])
self.show()
class searcher(common): class searcher(common):
@ -305,8 +294,8 @@ class searcher(common):
print(resp) print(resp)
self.config["refresh_token"] = "" self.config["refresh_token"] = ""
def querysettingwindow(self, parent, gameuid): def querysettingwindow(self, gameuid, layout):
bgmsettings(parent, self, gameuid) bgmsettings(layout, self, gameuid)
def getidbytitle(self, title): def getidbytitle(self, title):

View File

@ -1,7 +1,6 @@
import requests, re import requests, re
from myutils.utils import ( from myutils.utils import (
simplehtmlparser, simplehtmlparser,
simplehtmlparser_all,
initanewitem, initanewitem,
gamdidchangedtask, gamdidchangedtask,
) )
@ -11,11 +10,9 @@ import functools
from qtsymbols import * from qtsymbols import *
from gui.usefulwidget import getlineedit from gui.usefulwidget import getlineedit
from gui.dialog_savedgame import getreflist, getalistname from gui.dialog_savedgame import getreflist, getalistname
from myutils.wrapper import Singleton_close
@Singleton_close class steamsettings(QFormLayout):
class steamsettings(QDialog):
def querylist(self): def querylist(self):
@ -76,32 +73,26 @@ class steamsettings(QDialog):
gamdidchangedtask(self._ref.typename, self._ref.idname, gameuid) gamdidchangedtask(self._ref.typename, self._ref.idname, gameuid)
reflist.insert(0, gameuid) reflist.insert(0, gameuid)
def __getalistname(self, callback, _): def __init__(self, layout:QVBoxLayout, _ref: common, gameuid: str) -> None:
getalistname(self, callback) super().__init__(None)
layout.addLayout(self)
def __init__(self, parent, _ref: common, gameuid: str) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
self._ref = _ref self._ref = _ref
self.resize(QSize(800, 10)) self.addRow("userid", getlineedit(_ref.config, "userid"))
self.setWindowTitle(self._ref.config_all["name"]) self.addRow(
fl = QFormLayout(self)
fl.addRow("userid", getlineedit(_ref.config, "userid"))
fl.addRow(
"cookie:steamLoginSecure", getlineedit(_ref.config, "steamLoginSecure") "cookie:steamLoginSecure", getlineedit(_ref.config, "steamLoginSecure")
) )
btn = QPushButton("wishlist") btn = QPushButton("wishlist")
btn.clicked.connect( btn.clicked.connect(
functools.partial(self.__getalistname, self.getalistname_download) functools.partial(getalistname, btn, self.getalistname_download)
) )
fl.addRow(btn) self.addRow(btn)
self.show()
class searcher(common): class searcher(common):
def querysettingwindow(self, parent, gameuid): def querysettingwindow(self, gameuid, layout):
steamsettings(parent, self, gameuid) steamsettings(layout, self, gameuid)
def getidbytitle(self, title): def getidbytitle(self, title):
response = requests.get( response = requests.get(

View File

@ -6,8 +6,8 @@ import time
from qtsymbols import * from qtsymbols import *
from metadata.abstract import common from metadata.abstract import common
from gui.dialog_savedgame import getreflist, getalistname from gui.dialog_savedgame import getreflist, getalistname
from myutils.wrapper import Singleton_close, threader from myutils.wrapper import threader
from gui.dynalang import LPushButton from gui.usefulwidget import threebuttons
def saferequestvndb(proxy, method, url, json=None, headers=None, failnone=True): def saferequestvndb(proxy, method, url, json=None, headers=None, failnone=True):
@ -156,8 +156,7 @@ def getinfosbyvid(proxy, vid):
) )
@Singleton_close class vndbsettings(QFormLayout):
class vndbsettings(QDialog):
@property @property
def headers(self): def headers(self):
@ -259,9 +258,6 @@ class vndbsettings(QDialog):
headers=self.headers, headers=self.headers,
) )
def __getalistname(self, title, callback, _):
getalistname(self, callback, title=title)
showhide = pyqtSignal(bool) showhide = pyqtSignal(bool)
@threader @threader
@ -286,17 +282,16 @@ class vndbsettings(QDialog):
self.showhide.emit(False) self.showhide.emit(False)
self.lbinfo.setText(info) self.lbinfo.setText(info)
def __init__(self, parent, _ref: common, gameuid: str) -> None: def __init__(self, layout: QVBoxLayout, _ref: common, gameuid: str) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint) super().__init__(None)
layout.addLayout(self)
self.tm = None self.tm = None
self._ref = _ref self._ref = _ref
self.resize(QSize(800, 10))
self.setWindowTitle(self._ref.config_all["name"])
fl = QFormLayout(self)
vbox = QVBoxLayout() vbox = QVBoxLayout()
s = QLineEdit() s = QLineEdit()
self.lbinfo = QLabel() self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid) s.textChanged.connect(self.checkvalid)
s.setText(_ref.config["Token"])
fl2 = QFormLayout() fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0) fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget() ww = QWidget()
@ -307,35 +302,29 @@ class vndbsettings(QDialog):
self._token = s self._token = s
vbox.addWidget(s) vbox.addWidget(s)
vbox.addWidget(self.lbinfo) vbox.addWidget(self.lbinfo)
fl.addRow("Token", vbox) self.addRow("Token", vbox)
btn = LPushButton("上传游戏") btn = threebuttons(["上传游戏", "上传游戏列表", "获取游戏列表"])
btn.clicked.connect( btn.btn1clicked.connect(
functools.partial(self.singleupload_existsoverride, gameuid) functools.partial(self.singleupload_existsoverride, gameuid)
) )
fl2.addRow(btn) btn.btn2clicked.connect(
btn = LPushButton("上传游戏列表")
btn.clicked.connect(
functools.partial( functools.partial(
self.__getalistname, "上传游戏列表", self.getalistname_upload getalistname, btn, self.getalistname_upload, "上传游戏列表"
)
)
btn.btn3clicked.connect(
functools.partial(
getalistname, btn, self.getalistname_download, "添加到列表"
) )
) )
fl2.addRow(btn) fl2.addRow(btn)
btn = LPushButton("获取游戏列表") self.addRow(ww)
btn.clicked.connect(
functools.partial(
self.__getalistname, "添加到列表", self.getalistname_download
)
)
fl2.addRow(btn)
fl.addRow(ww)
s.setText(_ref.config["Token"])
self.show()
class searcher(common): class searcher(common):
def querysettingwindow(self, parent, gameuid): def querysettingwindow(self, gameuid, layout):
vndbsettings(parent, self, gameuid) vndbsettings(layout, self, gameuid)
def refmainpage(self, _id): def refmainpage(self, _id):
return "https://vndb.org/v{}".format(_id) return "https://vndb.org/v{}".format(_id)

View File

@ -1438,7 +1438,7 @@
"max_num": { "max_num": {
"type": "intspin", "type": "intspin",
"name": "最大结果条数", "name": "最大结果条数",
"min": 0, "min": 1,
"max": 9999, "max": 9999,
"step": 1 "step": 1
}, },

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<title>...</title> <title>年度总结</title>
<meta charset="UTF-8"> <meta charset="UTF-8">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script> <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<script src="https://cdn.jsdelivr.net/npm/wordcloud@1.1.1/src/wordcloud2.js"></script> <script src="https://cdn.jsdelivr.net/npm/wordcloud@1.1.1/src/wordcloud2.js"></script>