something

This commit is contained in:
恍兮惚兮 2024-08-30 03:09:49 +08:00
parent eb5ed97719
commit 739fa24944
41 changed files with 248 additions and 147 deletions

View File

@ -4,9 +4,7 @@ from qtsymbols import *
from traceback import print_exc
from myutils.config import (
globalconfig,
_TR,
savehook_new_list,
uid2gamepath,
findgameuidofpath,
savehook_new_data,
static_data,

View File

@ -13,8 +13,8 @@ from gui.specialwidget import lazyscrollflow
from myutils.config import (
savehook_new_data,
savegametaged,
uid2gamepath,
_TR,
get_launchpath,
globalconfig,
)
from gui.usefulwidget import (
@ -182,7 +182,7 @@ class dialog_savedgame_new(QWidget):
notshow = False
for tag, _type, _ in tags:
if _type == tagitem.TYPE_EXISTS:
if os.path.exists(uid2gamepath[k]) == False:
if os.path.exists(get_launchpath(k)) == False:
notshow = True
break
elif _type == tagitem.TYPE_DEVELOPER:
@ -229,7 +229,7 @@ class dialog_savedgame_new(QWidget):
othersetting = LAction(("其他设置"))
if self.currentfocusuid:
exists = os.path.exists(uid2gamepath[self.currentfocusuid])
exists = os.path.exists(get_launchpath(self.currentfocusuid))
if exists:
menu.addAction(startgame)
if exists:
@ -491,7 +491,7 @@ class dialog_savedgame_new(QWidget):
_able1 = b and (
(not exists)
or (self.currentfocusuid)
and (os.path.exists(uid2gamepath[self.currentfocusuid]))
and (os.path.exists(get_launchpath(self.currentfocusuid)))
)
_btn.setEnabled(_able1)

View File

@ -12,12 +12,12 @@ from myutils.config import (
savehook_new_data,
savegametaged,
uid2gamepath,
get_launchpath,
_TR,
savehook_new_list,
globalconfig,
)
from gui.usefulwidget import (
yuitsu_switch,
getIconButton,
FocusCombo,
getsimplecombobox,
@ -114,17 +114,14 @@ class ItemWidget(QWidget):
layout.addWidget(self._lb)
self.setLayout(layout)
self.gameuid = gameuid
exists = os.path.exists(get_launchpath(gameuid))
c = globalconfig["dialog_savegame_layout"][
("onfilenoexistscolor1", "backcolor1")[
os.path.exists(uid2gamepath[gameuid])
]
("onfilenoexistscolor1", "backcolor1")[exists]
]
c = str2rgba(
c,
globalconfig["dialog_savegame_layout"][
("transparentnotexits", "transparent")[
os.path.exists(uid2gamepath[gameuid])
]
("transparentnotexits", "transparent")[exists]
],
)
self.maskshowfileexists.setStyleSheet(f"background-color:{c};")
@ -345,7 +342,7 @@ class TagWidget(QWidget):
def opendirforgameuid(gameuid):
f = uid2gamepath[gameuid]
f = get_launchpath(gameuid)
f = os.path.dirname(f)
if os.path.exists(f) and os.path.isdir(f):
os.startfile(f)
@ -354,7 +351,7 @@ def opendirforgameuid(gameuid):
@threader
def startgame(gameuid):
try:
game = uid2gamepath[gameuid]
game = get_launchpath(gameuid)
if os.path.exists(game):
mode = savehook_new_data[gameuid]["onloadautochangemode2"]
if mode > 0:
@ -438,7 +435,7 @@ def getpixfunction(kk, small=False):
def startgamecheck(self, reflist, gameuid):
if not gameuid:
return
if not os.path.exists(uid2gamepath[gameuid]):
if not os.path.exists(get_launchpath(gameuid)):
return
if globalconfig["startgamenototop"] == False:
idx = reflist.index(gameuid)

View File

@ -1,7 +1,7 @@
from PyQt5.QtWidgets import QWidget
from qtsymbols import *
import functools, threading
from myutils.config import savehook_new_list, savehook_new_data, uid2gamepath
from myutils.config import savehook_new_list, savehook_new_data, get_launchpath
from myutils.hwnd import getExeIcon
from gui.usefulwidget import (
TableViewW,
@ -131,7 +131,7 @@ class dialog_savedgame_legacy(QWidget):
"",
"",
functools.partial(opendirforgameuid, k),
qicon=getExeIcon(uid2gamepath[k], cache=True),
qicon=getExeIcon(get_launchpath(k), cache=True),
)
def callback_leuse(self, k, use):

View File

@ -8,6 +8,7 @@ import gobject
from myutils.config import (
savehook_new_data,
uid2gamepath,
get_launchpath,
_TR,
postprocessconfig,
globalconfig,
@ -51,8 +52,15 @@ from gui.usefulwidget import (
getspinbox,
listediterline,
)
from gui.dynalang import LFormLayout, LPushButton, LStandardItemModel, LAction, LLabel, LDialog
from gui.dialog_savedgame_common import tagitem, TagWidget
from gui.dynalang import (
LFormLayout,
LPushButton,
LStandardItemModel,
LAction,
LLabel,
LDialog,
)
from gui.dialog_savedgame_common import tagitem, TagWidget
@Singleton
@ -155,7 +163,7 @@ class browserdialog(saveposwindow):
def __init__(self, parent, gameuid=None) -> None:
super().__init__(parent, poslist=globalconfig["browserwidget"])
if gameuid:
self.setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
self.setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
self.browser = auto_select_webview(self)
self.tagswidget = TagWidget(self)
@ -274,20 +282,12 @@ def maybehavebutton(self, gameuid, post):
class dialog_setting_game_internal(QWidget):
def selectexe(self):
originpath = uid2gamepath[self.gameuid]
f = QFileDialog.getOpenFileName(directory=originpath)
res = f[0]
if res == "":
return
# 修改路径允许路径重复
# 添加路径实际上也允许重复,只不过会去重。
def selectexe(self, res):
res = os.path.normpath(res)
uid2gamepath[self.gameuid] = res
_icon = getExeIcon(res, cache=True)
_icon = getExeIcon(get_launchpath(self.gameuid), cache=True)
self.setWindowIcon(_icon)
self.editpath.setText(res)
def __init__(self, parent, gameuid) -> None:
super().__init__(parent)
@ -295,14 +295,16 @@ class dialog_setting_game_internal(QWidget):
formLayout = LFormLayout()
self.setLayout(vbox)
self.gameuid = gameuid
self.editpath = QLineEdit(uid2gamepath[gameuid])
self.editpath.setReadOnly(True)
formLayout.addRow(
"路径",
getboxlayout(
[
self.editpath,
getIconButton(functools.partial(self.selectexe), icon="fa.gear"),
getsimplepatheditor(
uid2gamepath[gameuid],
callback=self.selectexe,
clearable=False,
icons=("fa.gear",),
),
getIconButton(
lambda: browserdialog(
gobject.baseobject.commonstylebase, gameuid
@ -476,6 +478,15 @@ class dialog_setting_game_internal(QWidget):
layout.addWidget(w)
do()
def selectexe_lauch(self, p):
if p:
p = os.path.normpath(p)
savehook_new_data[self.gameuid]["launchpath"] = p
_icon = getExeIcon(get_launchpath(self.gameuid), cache=True)
self.setWindowIcon(_icon)
def starttab(self, formLayout: LFormLayout, gameuid):
box = QGroupBox()
settinglayout = LFormLayout()
@ -490,14 +501,23 @@ class dialog_setting_game_internal(QWidget):
box.show()
__launch_method = getsimplecombobox(
[_.name for _ in getgamecamptools(uid2gamepath[gameuid])],
[_.name for _ in getgamecamptools(get_launchpath(gameuid))],
savehook_new_data[gameuid],
"launch_method",
internal=[_.id for _ in getgamecamptools(uid2gamepath[gameuid])],
internal=[_.id for _ in getgamecamptools(get_launchpath(gameuid))],
callback=functools.partial(
__, box, settinglayout, savehook_new_data[gameuid]
),
)
formLayout.addRow(
"启动程序",
getsimplepatheditor(
get_launchpath(gameuid),
callback=self.selectexe_lauch,
icons=("fa.gear", "fa.window-close-o"),
clearset=uid2gamepath[gameuid],
),
)
formLayout.addRow("启动方式", __launch_method)
formLayout.addRow(box)
@ -779,7 +799,7 @@ class dialog_setting_game_internal(QWidget):
False,
filt,
functools.partial(selectimg, gameuid, key),
True,
icons=("fa.folder-open", "fa.window-close-o"),
),
)
@ -1114,7 +1134,6 @@ class dialog_setting_game_internal(QWidget):
)
def calculate_centered_rect(original_rect: QRect, size: QSize) -> QRect:
original_center = original_rect.center()
new_left = original_center.x() - size.width() // 2
@ -1122,6 +1141,7 @@ def calculate_centered_rect(original_rect: QRect, size: QSize) -> QRect:
new_rect = QRect(new_left, new_top, size.width(), size.height())
return new_rect
@Singleton_close
class dialog_setting_game(LDialog):
@ -1131,7 +1151,7 @@ class dialog_setting_game(LDialog):
self.setWindowTitle(savehook_new_data[gameuid]["title"])
self.setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
self.setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
_ = dialog_setting_game_internal(self, gameuid)
_.methodtab.setCurrentIndex(setindexhook)
_.setMinimumSize(QSize(600, 500))

View File

@ -8,7 +8,7 @@ from myutils.config import (
savehook_new_list,
savehook_new_data,
savegametaged,
uid2gamepath,
get_launchpath,
extradatas,
globalconfig,
)
@ -96,16 +96,14 @@ class clickitem(QWidget):
self.lay.setContentsMargins(0, 0, 0, 0)
self.maskshowfileexists = QLabel(self)
exits = os.path.exists(get_launchpath(uid))
c = globalconfig["dialog_savegame_layout"][
("onfilenoexistscolor1", "backcolor1")[os.path.exists(uid2gamepath[uid])]
("onfilenoexistscolor1", "backcolor1")[exits]
]
c = str2rgba(
c,
globalconfig["dialog_savegame_layout"][
("transparentnotexits", "transparent")[
os.path.exists(uid2gamepath[uid])
]
("transparentnotexits", "transparent")[exits]
],
)
self.maskshowfileexists.setStyleSheet(f"background-color:{c};")
@ -121,9 +119,7 @@ class clickitem(QWidget):
_.setFixedSize(QSize(size, size))
_.setScaledContents(True)
_.setStyleSheet("background-color: rgba(255,255,255, 0);")
icon = getpixfunction(
uid, small=True
) # getExeIcon(uid2gamepath[uid], icon=False, cache=True)
icon = getpixfunction(uid, small=True)
icon.setDevicePixelRatio(self.devicePixelRatioF())
_.setPixmap(icon)
self.lay.addWidget(_)
@ -229,19 +225,17 @@ class MyQListWidget(QListWidget):
end = self.indexAt(self.viewport().rect().bottomRight()).row()
if start < 0:
return
if end < 0:
end = start
with self.lock:
model = self.model()
if end < 0:
end = model.rowCount()
for row in range(start, end + 1):
index = model.index(row, 0)
if not index.data(ImageRequestedRole):
self.model().setData(index, True, ImageRequestedRole)
image = getcachedimage(index.data(PathRole), True)
if image is None:
self.blockSignals(True)
self.takeItem(index.row())
self.blockSignals(False)
else:
self.item(index.row()).setIcon(QIcon(image))
except:
@ -670,7 +664,7 @@ class dialog_savedgame_v3(QWidget):
_able1 = b and (
(not exists)
or (self.currentfocusuid)
and (os.path.exists(uid2gamepath[self.currentfocusuid]))
and (os.path.exists(get_launchpath(self.currentfocusuid)))
)
_btn.setEnabled(_able1)
if self.currentfocusuid:
@ -712,7 +706,7 @@ class dialog_savedgame_v3(QWidget):
menu.addAction(addlist)
else:
exists = os.path.exists(uid2gamepath[self.currentfocusuid])
exists = os.path.exists(get_launchpath(self.currentfocusuid))
if exists:
menu.addAction(startgame)
menu.addAction(delgame)
@ -862,10 +856,9 @@ class dialog_savedgame_v3(QWidget):
self.stack.insertw(i, group0)
rowreal = 0
for row, k in enumerate(lst):
if globalconfig["hide_not_exists"] and not os.path.exists(
uid2gamepath[k]
):
continue
if globalconfig["hide_not_exists"]:
if not os.path.exists(get_launchpath(k)):
continue
self.reallist[tagid].append(k)
if opened and isfirst and (rowreal == 0):
vis = True

View File

@ -3,7 +3,7 @@ import sqlite3, os, json, functools
from traceback import print_exc
from myutils.config import globalconfig, _TR
from myutils.utils import autosql
from gui.usefulwidget import getQMessageBox, LFocusCombo, getsimplepatheditor
from gui.usefulwidget import getQMessageBox, LFocusCombo
from gui.dynalang import LFormLayout, LPushButton, LDialog
from textsource.texthook import splitembedlines
from collections import Counter

View File

@ -6,7 +6,7 @@ from myutils.config import (
globalconfig,
_TR,
savehook_new_data,
uid2gamepath,
get_launchpath,
savehook_new_list,
static_data,
)
@ -224,7 +224,7 @@ def exportchspatch(self):
gameuid = selectgameuid(self)
if gameuid is None:
return
exe = uid2gamepath[gameuid]
exe = get_launchpath(gameuid)
if exe.lower().endswith(".exe") == False:
f = QFileDialog.getOpenFileName(
self, caption=_TR("选择EXE文件"), filter="*.exe"

View File

@ -2035,11 +2035,13 @@ def getsimplepatheditor(
isdir=False,
filter1="*.*",
callback=None,
useiconbutton=False,
icons=None,
reflist=None,
name=None,
header=None,
dirorfile=False,
clearable=True,
clearset=""
):
lay = QHBoxLayout()
lay.setContentsMargins(0, 0, 0, 0)
@ -2055,12 +2057,14 @@ def getsimplepatheditor(
else:
e = QLineEdit(text)
e.setReadOnly(True)
if useiconbutton:
bu = getIconButton(icon="fa.folder-open")
clear = getIconButton(icon="fa.window-close-o")
if icons:
bu = getIconButton(icon=icons[0])
if clearable:
clear = getIconButton(icon=icons[1])
else:
bu = LPushButton("选择" + ("文件夹" if isdir else "文件"))
clear = LPushButton("清除")
if clearable:
clear = LPushButton("清除")
bu.clicked.connect(
functools.partial(
openfiledirectory,
@ -2072,15 +2076,16 @@ def getsimplepatheditor(
callback,
)
)
def __(_cb, _e):
_cb("")
_e.setText("")
clear.clicked.connect(functools.partial(__, callback, e))
lay.addWidget(e)
lay.addWidget(bu)
lay.addWidget(clear)
if clearable:
def __(_cb, _e, t):
_cb("")
_e.setText(t)
clear.clicked.connect(functools.partial(__, callback, e, clearset))
lay.addWidget(clear)
return lay

View File

@ -4,7 +4,6 @@ from myutils.utils import initanewitem, gamdidchangedtask
import functools, time, json, gobject
from qtsymbols import *
from metadata.abstract import common
from gui.usefulwidget import getlineedit
from gui.dialog_savedgame import getreflist, getalistname
from myutils.wrapper import Singleton_close, threader
from gui.dynalang import LPushButton
@ -121,9 +120,11 @@ class bgmsettings(QDialog):
getalistname(self, callback)
infosig = pyqtSignal(str)
showhide = pyqtSignal(bool)
@threader
def checkvalid(self, k):
self.showhide.emit(False)
self.lbinfo.setText("")
t = time.time()
self.tm = t
@ -146,6 +147,17 @@ class bgmsettings(QDialog):
expires = response.get("expires", 0)
if expires:
info = ""
try:
response1 = requests.get(
f"https://api.bgm.tv/v0/me",
params={"access_token": k},
headers=self.headers,
proxies=self._ref.proxy,
)
print(response1.json())
info += "用户名: " + response1.json()["nickname"] + "\n"
except:
pass
try:
create = (
json.loads(response["info"])
@ -160,10 +172,12 @@ class bgmsettings(QDialog):
info += "有效期至: " + time.strftime(
"%Y-%m-%d %H:%M:%S", time.localtime(expires)
)
self.showhide.emit(True)
else:
info = " ".join(
(response.get("error", ""), response.get("error_description", ""))
)
self.showhide.emit(False)
self.lbinfo.setText(info)
def __oauth(self):
@ -223,7 +237,13 @@ class bgmsettings(QDialog):
s = QLineEdit()
self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid)
s.setText(_ref.config["access-token"])
fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget()
ww.setLayout(fl2)
ww.hide()
self.fl2 = ww
self.showhide.connect(self.fl2.setVisible)
self._token = s
vbox.addLayout(hbox)
hbox.addWidget(s)
@ -232,22 +252,23 @@ class bgmsettings(QDialog):
oauth.clicked.connect(self.__oauth)
vbox.addWidget(self.lbinfo)
fl.addRow("access-token", vbox)
btn = LPushButton("上传游戏")
btn.clicked.connect(
functools.partial(self.singleupload_existsoverride, gameuid)
)
fl.addRow(btn)
fl2.addRow(btn)
btn = LPushButton("上传游戏列表")
btn.clicked.connect(
functools.partial(self.__getalistname, self.getalistname_upload)
)
fl.addRow(btn)
fl2.addRow(btn)
btn = LPushButton("获取游戏列表")
btn.clicked.connect(
functools.partial(self.__getalistname, self.getalistname_download)
)
fl.addRow(btn)
fl2.addRow(btn)
fl.addRow(ww)
s.setText(_ref.config["access-token"])
self.show()

View File

@ -6,13 +6,12 @@ import time
from qtsymbols import *
from gui.inputdialog import autoinitdialog
from metadata.abstract import common
from gui.usefulwidget import getlineedit
from gui.dialog_savedgame import getreflist, getalistname
from myutils.wrapper import Singleton_close
from myutils.wrapper import Singleton_close, threader
from gui.dynalang import LPushButton
def saferequestvndb(proxy, method, url, json=None, headers=None):
def saferequestvndb(proxy, method, url, json=None, headers=None, failnone=True):
print(method, url, json)
resp = requests.request(
method,
@ -35,11 +34,14 @@ def saferequestvndb(proxy, method, url, json=None, headers=None):
except:
print(resp.status_code)
print(resp.text)
return None
if failnone:
return None
else:
return resp.text
def safegetvndbjson(proxy, url, json):
return saferequestvndb(proxy, "POST", url, json)
def safegetvndbjson(proxy, url, json=None, headers=None):
return saferequestvndb(proxy, "POST", url, json, headers)
def gettitlefromjs(js):
@ -279,28 +281,69 @@ class vndbsettings(QDialog):
def __getalistname(self, callback, _):
getalistname(self, callback)
showhide = pyqtSignal(bool)
@threader
def checkvalid(self, k):
self.showhide.emit(False)
self.lbinfo.setText("")
t = time.time()
self.tm = t
if k != self._ref.config["Token"]:
self._ref.config["Token"] = k
response = saferequestvndb(
self._ref.proxy, "GET", "authinfo", headers=self.headers, failnone=False
)
if t != self.tm:
return
print(response)
if isinstance(response, dict) and response.get("username"):
info = "username: " + response.get("username")
self.showhide.emit(True)
else:
info = response
self.showhide.emit(False)
self.lbinfo.setText(info)
def __init__(self, parent, _ref: common, gameuid: str) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
self.tm = None
self._ref = _ref
self.resize(QSize(800, 10))
self.setWindowTitle(self._ref.config_all["name"])
fl = QFormLayout(self)
fl.addRow("Token", getlineedit(_ref.config, "Token"))
vbox = QVBoxLayout()
s = QLineEdit()
self.lbinfo = QLabel()
s.textChanged.connect(self.checkvalid)
fl2 = QFormLayout()
fl2.setContentsMargins(0, 0, 0, 0)
ww = QWidget()
ww.setLayout(fl2)
ww.hide()
self.fl2 = ww
self.showhide.connect(self.fl2.setVisible)
self._token = s
vbox.addWidget(s)
vbox.addWidget(self.lbinfo)
fl.addRow("Token", vbox)
btn = LPushButton("上传游戏")
btn.clicked.connect(
functools.partial(self.singleupload_existsoverride, gameuid)
)
fl.addRow(btn)
fl2.addRow(btn)
btn = LPushButton("上传游戏列表")
btn.clicked.connect(
functools.partial(self.__getalistname, self.getalistname_upload)
)
fl.addRow(btn)
fl2.addRow(btn)
btn = LPushButton("获取游戏列表")
btn.clicked.connect(
functools.partial(self.__getalistname, self.getalistname_download)
)
fl.addRow(btn)
fl2.addRow(btn)
fl.addRow(ww)
s.setText(_ref.config["Token"])
self.show()

View File

@ -118,6 +118,7 @@ ocrsetting = tryreadconfig("ocrsetting.json")
def getdefaultsavehook(title=None):
default = {
"gamepath": "", # 不要直接访问要通过uid2gamepath来间接访问
#"launchpath": "",
"hooksetting_follow_default": True,
"hooksetting_private": {}, # 显示时再加载缺省用global中的键
"textproc_follow_default": True,
@ -336,6 +337,11 @@ class __uid2gamepath:
uid2gamepath = __uid2gamepath()
def get_launchpath(uid):
launch = savehook_new_data[uid].get("launchpath", "")
if not launch:
launch = uid2gamepath[uid]
return launch
def findgameuidofpath(gamepath, findall=False):
collect = []

View File

@ -1,6 +1,6 @@
import windows, os, winreg, winsharedutils, re, functools
import windows, os, winsharedutils, re, functools
from qtsymbols import *
from myutils.config import savehook_new_data, uid2gamepath, globalconfig
from myutils.config import savehook_new_data, get_launchpath, globalconfig
from gui.usefulwidget import (
getlineedit,
getsimplecombobox,
@ -12,7 +12,6 @@ from gui.usefulwidget import (
getsimplepatheditor,
clearlayout,
)
from traceback import print_exc
from gui.dynalang import LFormLayout
@ -529,9 +528,9 @@ def fundlauncher(_id):
def localeswitchedrun(gameuid):
config = savehook_new_data[gameuid]
launch_method = config.get("launch_method", None)
gameexe = uid2gamepath[gameuid]
gameexe = get_launchpath(gameuid)
tools = getgamecamptools(gameexe)
ids = [_.id for _ in getgamecamptools(uid2gamepath[gameuid])]
ids = [_.id for _ in tools]
if launch_method not in ids:
index = 0
else:

View File

@ -3,12 +3,7 @@ import time
import os, threading
from qtsymbols import *
from traceback import print_exc
from myutils.config import (
uid2gamepath,
findgameuidofpath,
savehook_new_list,
savehook_new_data,
)
from myutils.config import findgameuidofpath, savehook_new_data
from myutils.hwnd import getpidexe
import windows
import gobject

View File

@ -20,7 +20,6 @@ from myutils.config import (
import threading, winreg
import re, heapq, winsharedutils
from myutils.wrapper import tryprint, threader
from myutils.subproc import subproc_w
def checkisusingwine():
@ -195,17 +194,19 @@ def dispatchsearchfordata(gameuid, target, vid):
targetmod[target].dispatchsearchfordata(gameuid, vid)
def trysearchforid_1(gameuid, searchargs: list):
def trysearchforid_1(gameuid, searchargs: list, target=None):
infoid = None
primitivtemetaorigin = globalconfig["primitivtemetaorigin"]
__ = [primitivtemetaorigin]
for k in targetmod:
if k == primitivtemetaorigin:
continue
if not globalconfig["metadata"][k]["auto"]:
continue
__.append(k)
if target is None:
primitivtemetaorigin = globalconfig["primitivtemetaorigin"]
__ = [primitivtemetaorigin]
for k in targetmod:
if k == primitivtemetaorigin:
continue
if not globalconfig["metadata"][k]["auto"]:
continue
__.append(k)
else:
__ = [target]
for key in __:
vid = None
for arg in searchargs:
@ -232,13 +233,16 @@ def trysearchforid_1(gameuid, searchargs: list):
dispatchsearchfordata(gameuid, key, vid)
def trysearchforid(gameuid, searchargs: list):
threading.Thread(target=trysearchforid_1, args=(gameuid, searchargs)).start()
def trysearchforid(*argc):
threading.Thread(target=trysearchforid_1, args=argc).start()
def gamdidchangedtask(key, idname, gameuid):
vid = savehook_new_data[gameuid].get(idname, "")
dispatchsearchfordata(gameuid, key, vid)
if not vid:
trysearchforid(gameuid, [savehook_new_data[gameuid]["title"]], key)
else:
dispatchsearchfordata(gameuid, key, vid)
def titlechangedtask(gameuid, title):

View File

@ -1,4 +1,4 @@
from myutils.config import globalconfig, savehook_new_data, uid2gamepath
from myutils.config import globalconfig, savehook_new_data, get_launchpath
from myutils.utils import postusewhich
from gui.inputdialog import postconfigdialog_
import gobject
@ -24,7 +24,7 @@ class Process:
"专有名词翻译_sakura_gpt_词典_-_" + savehook_new_data[gameuid]["title"],
["原文", "翻译", "注释"],
dictkeys=["src", "dst", "info"],
).setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
).setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
def process_before(self, japanese):

View File

@ -5,7 +5,7 @@ from gui.usefulwidget import threebuttons, TableViewW
from myutils.wrapper import Singleton_close
from myutils.utils import postusewhich
from gui.dynalang import LDialog, LPushButton, LStandardItemModel
from myutils.config import uid2gamepath
from myutils.config import get_launchpath
from myutils.hwnd import getExeIcon
@ -114,7 +114,7 @@ class Process:
parent_window,
savehook_new_data[gameuid]["noundictconfig"],
"专有名词翻译_占位符_-_" + savehook_new_data[gameuid]["title"],
).setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
).setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
@staticmethod
def get_setting_window(parent_window):

View File

@ -2,7 +2,7 @@ from myutils.config import transerrorfixdictconfig, savehook_new_data
from myutils.utils import parsemayberegexreplace, postusewhich
from gui.inputdialog import noundictconfigdialog1
import gobject
from myutils.config import uid2gamepath
from myutils.config import get_launchpath
from myutils.hwnd import getExeIcon
@ -24,7 +24,7 @@ class Process:
savehook_new_data[gameuid]["transerrorfix"],
"翻译结果修正_-_" + savehook_new_data[gameuid]["title"],
["正则",'转义', "翻译", "替换"],
).setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
).setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
def process_after(self, res, mp1):
res = parsemayberegexreplace(self.usewhich(), res)

View File

@ -1,7 +1,7 @@
from myutils.config import globalconfig, savehook_new_data, uid2gamepath
from myutils.config import globalconfig, savehook_new_data, get_launchpath
from myutils.utils import postusewhich, parsemayberegexreplace
from gui.inputdialog import noundictconfigdialog1
import gobject, json, functools
import gobject
from myutils.hwnd import getExeIcon
@ -26,7 +26,7 @@ class Process:
savehook_new_data[gameuid]["namemap2"],
"专有名词翻译_直接替换_-_" + savehook_new_data[gameuid]["title"],
["正则", "转义", "原文", "翻译"],
).setWindowIcon(getExeIcon(uid2gamepath[gameuid], cache=True))
).setWindowIcon(getExeIcon(get_launchpath(gameuid), cache=True))
@property
def using_X(self):

View File

@ -1943,7 +1943,7 @@
"type": "api",
"use": false,
"color": "blue",
"name": "Azure Openai",
"name": "Azure",
"is_gpt_like": true
},
"cohere": {

View File

@ -846,5 +846,6 @@
"单词": "كلمة .",
"成功添加后关闭窗口": "إغلاق النافذة بعد إضافة ناجحة",
"绑定窗口": "ملزمة نافذة",
"(点击自己取消)": "( انقر على نفسك لإلغاء )"
"(点击自己取消)": "( انقر على نفسك لإلغاء )",
"启动程序": "بدء البرنامج"
}

View File

@ -846,5 +846,6 @@
"单词": "單詞",
"成功添加后关闭窗口": "成功添加後關閉窗口",
"绑定窗口": "綁定視窗",
"(点击自己取消)": "(點擊自己取消)"
"(点击自己取消)": "(點擊自己取消)",
"启动程序": "啟動程式"
}

View File

@ -846,5 +846,6 @@
"单词": "slovo",
"成功添加后关闭窗口": "Zavřít okno po úspěšném přidání",
"绑定窗口": "Vázat okno",
"(点击自己取消)": "(Kliknutím zrušíte sami)"
"(点击自己取消)": "(Kliknutím zrušíte sami)",
"启动程序": "Spustit program"
}

View File

@ -846,5 +846,6 @@
"单词": "Wort",
"成功添加后关闭窗口": "Fenster nach erfolgreichem Hinzufügen schließen",
"绑定窗口": "Fenster binden",
"(点击自己取消)": "(Klicken Sie, um selbst abzubrechen)"
"(点击自己取消)": "(Klicken Sie, um selbst abzubrechen)",
"启动程序": "Programm starten"
}

View File

@ -846,5 +846,6 @@
"单词": "word",
"成功添加后关闭窗口": "Close the window after successful addition",
"绑定窗口": "Bind Window",
"(点击自己取消)": "(Click to cancel by yourself)"
"(点击自己取消)": "(Click to cancel by yourself)",
"启动程序": "Start the program"
}

View File

@ -846,5 +846,6 @@
"单词": "Palabras",
"成功添加后关闭窗口": "Cerrar la ventana después de agregar con éxito",
"绑定窗口": "Ventana vinculada",
"(点击自己取消)": "(haga clic para cancelar por sí mismo)"
"(点击自己取消)": "(haga clic para cancelar por sí mismo)",
"启动程序": "Iniciar el programa"
}

View File

@ -846,5 +846,6 @@
"单词": "Mots",
"成功添加后关闭窗口": "Fermer la fenêtre après un ajout réussi",
"绑定窗口": "Fenêtre de liaison",
"(点击自己取消)": "(cliquez vous - même pour annuler)"
"(点击自己取消)": "(cliquez vous - même pour annuler)",
"启动程序": "Lancer le programme"
}

View File

@ -846,5 +846,6 @@
"单词": "parola",
"成功添加后关闭窗口": "Chiudere la finestra dopo l'aggiunta riuscita",
"绑定窗口": "Associa finestra",
"(点击自己取消)": "(Clicca per annullare da solo)"
"(点击自己取消)": "(Clicca per annullare da solo)",
"启动程序": "Avvia il programma"
}

View File

@ -846,5 +846,6 @@
"单词": "単語",
"成功添加后关闭窗口": "追加に成功したらウィンドウを閉じる",
"绑定窗口": "「バインド」ウィンドウ",
"(点击自己取消)": "(自分でキャンセルするをクリック)"
"(点击自己取消)": "(自分でキャンセルするをクリック)",
"启动程序": "スタートアッププログラム"
}

View File

@ -846,5 +846,6 @@
"单词": "단어",
"成功添加后关闭窗口": "성공적으로 추가한 후 창 닫기",
"绑定窗口": "바인딩 창",
"(点击自己取消)": "(자체 취소 클릭)"
"(点击自己取消)": "(자체 취소 클릭)",
"启动程序": "프로그램 시작"
}

View File

@ -846,5 +846,6 @@
"单词": "woord",
"成功添加后关闭窗口": "Sluit het venster na succesvolle toevoeging",
"绑定窗口": "Venster binden",
"(点击自己取消)": "(Klik om zelf te annuleren)"
"(点击自己取消)": "(Klik om zelf te annuleren)",
"启动程序": "Start het programma"
}

View File

@ -846,5 +846,6 @@
"单词": "słowo",
"成功添加后关闭窗口": "Zamknij okno po pomyślnym dodaniu",
"绑定窗口": "Wiąż okno",
"(点击自己取消)": "(Kliknij, aby anulować samodzielnie)"
"(点击自己取消)": "(Kliknij, aby anulować samodzielnie)",
"启动程序": "Uruchom program"
}

View File

@ -846,5 +846,6 @@
"单词": "palavra",
"成功添加后关闭窗口": "Fechar a janela após a adição bem sucedida",
"绑定窗口": "Janela Vincular",
"(点击自己取消)": "(Clique para cancelar por si mesmo)"
"(点击自己取消)": "(Clique para cancelar por si mesmo)",
"启动程序": "Iniciar o programa"
}

View File

@ -846,5 +846,6 @@
"单词": "Слова",
"成功添加后关闭窗口": "Закрыть окно после успешного добавления",
"绑定窗口": "Связанное окно",
"(点击自己取消)": "(Нажмите сами, чтобы отменить)"
"(点击自己取消)": "(Нажмите сами, чтобы отменить)",
"启动程序": "Запуск программы"
}

View File

@ -846,5 +846,6 @@
"单词": "ord",
"成功添加后关闭窗口": "Stäng fönstret efter lyckat tillägg",
"绑定窗口": "Bind fönster",
"(点击自己取消)": "(Klicka för att avbryta själv)"
"(点击自己取消)": "(Klicka för att avbryta själv)",
"启动程序": "Starta programmet"
}

View File

@ -846,5 +846,6 @@
"单词": "คำศัพท์",
"成功添加后关闭窗口": "ปิดหน้าต่างหลังจากเพิ่มเรียบร้อยแล้ว",
"绑定窗口": "หน้าต่างที่ถูกผูกไว้",
"(点击自己取消)": "(คลิกเพื่อยกเลิกด้วยตัวเอง)"
"(点击自己取消)": "(คลิกเพื่อยกเลิกด้วยตัวเอง)",
"启动程序": "เริ่มโปรแกรม"
}

View File

@ -846,5 +846,6 @@
"单词": "kelime",
"成功添加后关闭窗口": "Başarılı eklendikten sonra pencereyi kapat",
"绑定窗口": "Bağlam Penceresi",
"(点击自己取消)": "(Kendin iptal etmek için tıklayın)"
"(点击自己取消)": "(Kendin iptal etmek için tıklayın)",
"启动程序": "Programı başlat"
}

View File

@ -846,5 +846,6 @@
"单词": "слово",
"成功添加后关闭窗口": "Закрити вікно після успішного додавання",
"绑定窗口": "В єднати вікно",
"(点击自己取消)": "(Натисніть, щоб скасувати самостійно)"
"(点击自己取消)": "(Натисніть, щоб скасувати самостійно)",
"启动程序": "Запустити програму"
}

View File

@ -846,5 +846,6 @@
"单词": "Từ",
"成功添加后关闭窗口": "Đóng cửa sổ sau khi thêm thành công",
"绑定窗口": "Cửa sổ bị ràng buộc",
"(点击自己取消)": "(Click vào tự hủy)"
"(点击自己取消)": "(Click vào tự hủy)",
"启动程序": "Khởi chạy chương trình"
}

View File

@ -846,5 +846,6 @@
"单词": "",
"成功添加后关闭窗口": "",
"绑定窗口": "",
"(点击自己取消)": ""
"(点击自己取消)": "",
"启动程序": ""
}

View File

@ -28,8 +28,8 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version)
include(generate_product_version)
set(VERSION_MAJOR 5)
set(VERSION_MINOR 31)
set(VERSION_PATCH 5)
set(VERSION_MINOR 32)
set(VERSION_PATCH 0)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)