This commit is contained in:
恍兮惚兮 2024-06-02 13:11:28 +08:00
parent 345310c455
commit ebd0c3ec8a
51 changed files with 785 additions and 378 deletions

View File

@ -34,7 +34,7 @@ from gui.transhist import transhist
from gui.edittext import edittext
import importlib, qtawesome
from functools import partial
from gui.settin import Settin
from gui.setting import Setting
from gui.showocrimage import showocrimage
from gui.attachprocessdialog import AttachProcessDialog
import windows
@ -960,7 +960,7 @@ class MAINUI:
self.startoutputer()
self.__commonstylebase = commonstylebase(self.translation_ui)
self.setcommonstylesheet()
self.settin_ui = Settin(self.__commonstylebase)
self.settin_ui = Setting(self.__commonstylebase)
self.transhis = transhist(self.settin_ui)
self.startreader()
self.searchwordW = searchwordW(self.settin_ui)

View File

@ -2326,11 +2326,7 @@ class mdict(cishubase):
with open("userconfig/mdict_config.json", "r", encoding="utf8") as ff:
self.extraconf = json.loads(ff.read())
except:
try:
with open("cache/mdict/config.json", "r", encoding="utf8") as ff:
self.extraconf = json.loads(ff.read())
except:
self.extraconf = {}
self.extraconf = {}
self.sql = None
paths = self.config["path"]

View File

@ -1,9 +1,8 @@
from qtsymbols import *
import os, functools
import windows, qtawesome, gobject
from winsharedutils import getpidhwndfirst
import functools
from myutils.config import globalconfig, _TR
import windows
import os, gobject
from myutils.wrapper import Singleton_close
from myutils.hwnd import (
getpidexe,
@ -11,8 +10,6 @@ from myutils.hwnd import (
mouseselectwindow,
getExeIcon,
)
import qtawesome
from gui.usefulwidget import saveposwindow, getQMessageBox

View File

@ -1,10 +1,9 @@
import functools
from qtsymbols import *
from gui.usefulwidget import getspinbox, threebuttons, getlineedit
import functools
from myutils.utils import checkencoding
from myutils.config import globalconfig, _TR, _TRL
from myutils.wrapper import Singleton
from gui.usefulwidget import getspinbox, threebuttons, getlineedit
nowsuppertcodes = _TRL(
[

View File

@ -1,8 +1,8 @@
from qtsymbols import *
from myutils.config import _TR, globalconfig
from gui.usefulwidget import saveposwindow
from myutils.wrapper import Singleton_close
import os
from myutils.config import _TR, globalconfig
from myutils.wrapper import Singleton_close
from gui.usefulwidget import saveposwindow
@Singleton_close

View File

@ -1,26 +1,19 @@
import time
from datetime import datetime, timedelta
from gui.specialwidget import ScrollFlow, chartwidget, lazyscrollflow
from qtsymbols import *
import functools, threading
import os, functools
from datetime import datetime, timedelta
from traceback import print_exc
import windows
import os
from gui.usefulwidget import (
getsimplecombobox,
getspinbox,
getcolorbutton,
getsimpleswitch,
getspinbox,
selectcolor,
import windows, gobject, winsharedutils
from myutils.vndb import parsehtmlmethod
from myutils.config import (
savehook_new_list,
savehook_new_data,
vndbtagdata,
_TR,
_TRL,
globalconfig,
static_data,
)
import os
from myutils.config import savehook_new_list, savehook_new_data, vndbtagdata
from myutils.hwnd import getExeIcon
import gobject
from myutils.config import _TR, _TRL, globalconfig, static_data
import winsharedutils
from myutils.wrapper import Singleton_close, Singleton, threader, tryprint
from myutils.utils import (
checkifnewgame,
@ -29,6 +22,14 @@ from myutils.utils import (
titlechangedtask,
imgchangedtask,
)
from gui.inputdialog import noundictconfigdialog1
from gui.specialwidget import (
ScrollFlow,
chartwidget,
lazyscrollflow,
stackedlist,
shrinkableitem,
)
from gui.usefulwidget import (
yuitsu_switch,
saveposwindow,
@ -36,9 +37,15 @@ from gui.usefulwidget import (
getlineedit,
auto_select_webview,
Prompt_dialog,
getsimplecombobox,
getspinbox,
getcolorbutton,
makesubtab_lazy,
tabadd_lazy,
getsimpleswitch,
getspinbox,
selectcolor,
)
from myutils.vndb import parsehtmlmethod
from gui.inputdialog import noundictconfigdialog1
class ItemWidget(QWidget):
@ -565,8 +572,7 @@ def calculate_centered_rect(original_rect: QRect, size: QSize) -> QRect:
return new_rect
@Singleton_close
class dialog_setting_game(QDialog):
class dialog_setting_game_internal(QWidget):
def selectexe(self):
f = QFileDialog.getOpenFileName(directory=self.exepath)
res = f[0]
@ -584,26 +590,15 @@ class dialog_setting_game(QDialog):
self.editpath.setText(res)
self.exepath = res
def closeEvent(self, a0: QCloseEvent) -> None:
self.isopened = False
return super().closeEvent(a0)
def __init__(self, parent, exepath) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
global _global_dialog_setting_game
_global_dialog_setting_game = self
self.isopened = True
vbox = QVBoxLayout(self) # 配置layout
super().__init__(parent)
vbox = QVBoxLayout(self)
vbox.setContentsMargins(0, 0, 0, 0)
self.setLayout(vbox)
formwidget = QWidget()
formLayout = QFormLayout()
formwidget.setLayout(formLayout)
self.exepath = exepath
self.editpath = QLineEdit(exepath)
self.editpath.setReadOnly(True)
self.setWindowTitle(savehook_new_data[exepath]["title"])
self.setWindowIcon(getExeIcon(exepath, cache=True))
formLayout.addRow(
_TR("路径"),
getboxlayout(
@ -696,30 +691,27 @@ class dialog_setting_game(QDialog):
),
)
methodtab = QTabWidget()
methodtab.addTab(self.starttab(exepath), _TR("启动"))
methodtab.addTab(self.gethooktab(exepath), "HOOK")
methodtab.addTab(self.getpretranstab(exepath), _TR("预翻译"))
methodtab.addTab(self.getttssetting(exepath), _TR("语音"))
methodtab.addTab(self.getlabelsetting(exepath), _TR("标签"))
methodtab.addTab(self.getstatistic(exepath), _TR("统计信息"))
methodtab.addTab(self.getbackup(exepath), _TR("存档备份"))
methodtab, do = makesubtab_lazy(
_TRL(["启动", "HOOK", "预翻译", "语音", "标签", "统计信息", "存档备份"]),
[
functools.partial(self.doaddtab, self.starttab, exepath),
functools.partial(self.doaddtab, self.gethooktab, exepath),
functools.partial(self.doaddtab, self.getpretranstab, exepath),
functools.partial(self.doaddtab, self.getttssetting, exepath),
functools.partial(self.doaddtab, self.getlabelsetting, exepath),
functools.partial(self.doaddtab, self.getstatistic, exepath),
functools.partial(self.doaddtab, self.getbackup, exepath),
],
delay=True,
)
vbox.addWidget(formwidget)
vbox.addLayout(formLayout)
vbox.addWidget(methodtab)
do()
self.show()
self.resize(QSize(600, 1))
self.adjustSize()
self.resize(QSize(600, self.height()))
try:
self.setGeometry(
calculate_centered_rect(
_global_dialog_savedgame_new.geometry(), self.size()
)
)
except:
pass
def doaddtab(self, wfunct, exe, layout):
w = wfunct(exe)
layout.addWidget(w)
def selectbackupdir(self, edit):
res = QFileDialog.getExistingDirectory(
@ -864,8 +856,10 @@ class dialog_setting_game(QDialog):
formLayout.addLayout(getboxlayout([QLabel(_TR("游戏时间")), self._timelabel]))
formLayout.addWidget(chart)
threading.Thread(target=self.refresh).start()
t = QTimer(self)
t.setInterval(1000)
t.timeout.connect(self.refresh)
t.start(0)
return _w
def split_range_into_days(self, times):
@ -904,19 +898,17 @@ class dialog_setting_game(QDialog):
return lists
def refresh(self):
while self.isopened:
self._timelabel.setText(
self.formattime(savehook_new_data[self.exepath]["statistic_playtime"])
self._timelabel.setText(
self.formattime(savehook_new_data[self.exepath]["statistic_playtime"])
)
self._wordlabel.setText(
str(savehook_new_data[self.exepath]["statistic_wordcount"])
)
self.chart.setdata(
self.split_range_into_days(
savehook_new_data[self.exepath]["traceplaytime_v2"]
)
self._wordlabel.setText(
str(savehook_new_data[self.exepath]["statistic_wordcount"])
)
self.chart.setdata(
self.split_range_into_days(
savehook_new_data[self.exepath]["traceplaytime_v2"]
)
)
time.sleep(1)
)
def formattime(self, t, usingnotstart=True):
t = int(t)
@ -1182,10 +1174,39 @@ class dialog_setting_game(QDialog):
)
@Singleton_close
class dialog_setting_game(QDialog):
def __init__(self, parent, exepath) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
global _global_dialog_setting_game
_global_dialog_setting_game = self
self.setWindowTitle(savehook_new_data[exepath]["title"])
self.setWindowIcon(getExeIcon(exepath, cache=True))
_ = dialog_setting_game_internal(self, exepath)
_.setMinimumSize(QSize(600, 500))
l = QHBoxLayout(self)
self.setLayout(l)
l.addWidget(_)
self.show()
try:
self.setGeometry(
calculate_centered_rect(
_global_dialog_savedgame_new.geometry(), self.size()
)
)
except:
pass
@Singleton
class dialog_syssetting(QDialog):
def __init__(self, parent) -> None:
def __init__(self, parent, type_=1) -> None:
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
self.setWindowTitle(_TR("其他设置"))
formLayout = QFormLayout(self)
@ -1193,18 +1214,19 @@ class dialog_syssetting(QDialog):
QLabel(_TR("隐藏不存在的游戏")),
getsimpleswitch(globalconfig, "hide_not_exists"),
)
for key, name in [
("itemw", "宽度"),
("itemh", "高度"),
# ("imgw", "图片宽度"),
# ("imgh", "图片高度"),
("margin", "边距"),
("textH", "文字区高度"),
]:
formLayout.addRow(
(_TR(name)),
getspinbox(0, 1000, globalconfig["dialog_savegame_layout"], key),
)
if type_ == 1:
for key, name in [
("itemw", "宽度"),
("itemh", "高度"),
# ("imgw", "图片宽度"),
# ("imgh", "图片高度"),
("margin", "边距"),
("textH", "文字区高度"),
]:
formLayout.addRow(
(_TR(name)),
getspinbox(0, 1000, globalconfig["dialog_savegame_layout"], key),
)
for key, name in [
("backcolor", "颜色"),
("onselectcolor", "选中时颜色"),
@ -1232,22 +1254,25 @@ class dialog_syssetting(QDialog):
(_TR("不透明度")),
getspinbox(0, 100, globalconfig["dialog_savegame_layout"], "transparent"),
)
formLayout.addRow(
_TR("缩放"),
getsimplecombobox(
_TRL(["填充", "适应", "拉伸", "居中"]),
globalconfig,
"imagewrapmode",
),
)
if type_ == 1:
formLayout.addRow(
_TR("缩放"),
getsimplecombobox(
_TRL(["填充", "适应", "拉伸", "居中"]),
globalconfig,
"imagewrapmode",
),
)
formLayout.addRow(
QLabel(_TR("启动游戏不修改顺序")),
getsimpleswitch(globalconfig, "startgamenototop"),
)
formLayout.addRow(
QLabel(_TR("显示标题")),
getsimpleswitch(globalconfig, "showgametitle"),
)
if type_ == 1:
formLayout.addRow(
QLabel(_TR("显示标题")),
getsimpleswitch(globalconfig, "showgametitle"),
)
self.show()
@ -1409,27 +1434,72 @@ class listediter(QDialog):
)
def _getpixfunction(kk):
_pix = QPixmap(savehook_new_data[kk]["imagepath"])
if _pix.isNull():
_pix = getExeIcon(kk, False, cache=True)
return _pix
def startgamecheck(self, game):
if not game:
return
if not os.path.exists(game):
return
if globalconfig["startgamenototop"] == False:
idx = savehook_new_list.index(game)
savehook_new_list.insert(0, savehook_new_list.pop(idx))
self.close()
startgame(game)
def removegame(game):
try:
idx = savehook_new_list.index(game)
savehook_new_list.pop(idx)
if game in savehook_new_data:
savehook_new_data.pop(game)
except:
print_exc()
def addgamesingle(callback):
f = QFileDialog.getOpenFileName(options=QFileDialog.Option.DontResolveSymlinks)
res = f[0]
if res == "":
return
res = os.path.normpath(res)
if res not in savehook_new_list:
checkifnewgame(res)
callback(res)
def addgamebatch(callback):
res = QFileDialog.getExistingDirectory(
options=QFileDialog.Option.DontResolveSymlinks
)
if res == "":
return
for _dir, _, _fs in os.walk(res):
for _f in _fs:
path = os.path.normpath(os.path.abspath(os.path.join(_dir, _f)))
if path.lower().endswith(".exe") == False:
continue
if path not in savehook_new_list:
checkifnewgame(path)
callback(path)
@Singleton_close
class dialog_savedgame_new(saveposwindow):
def startgame(self, game):
if os.path.exists(game):
if globalconfig["startgamenototop"] == False:
idx = savehook_new_list.index(game)
savehook_new_list.insert(0, savehook_new_list.pop(idx))
self.close()
startgame(game)
def clicked2(self):
try:
game = self.currentfocuspath
idx = savehook_new_list.index(game)
savehook_new_list.pop(idx)
if game in savehook_new_data:
savehook_new_data.pop(game)
idx2 = savehook_new_list.index(game)
removegame(game)
idx2 = self.idxsave.index(game)
self.flow.removeidx(idx2)
self.idxsave.pop(idx2)
self.flow.setfocus(idx2)
except:
pass
@ -1438,29 +1508,10 @@ class dialog_savedgame_new(saveposwindow):
opendir(self.currentfocuspath)
def clicked3_batch(self):
res = QFileDialog.getExistingDirectory(
options=QFileDialog.Option.DontResolveSymlinks
)
if res != "":
for _dir, _, _fs in os.walk(res):
for _f in _fs:
path = os.path.abspath(os.path.join(_dir, _f))
if path.lower().endswith(".exe") == False:
continue
if path not in savehook_new_list:
checkifnewgame(path)
self.newline(path, True)
addgamebatch(lambda res: self.newline(res, True))
def clicked3(self):
f = QFileDialog.getOpenFileName(options=QFileDialog.Option.DontResolveSymlinks)
res = f[0]
if res != "":
res = os.path.normpath(res)
if res not in savehook_new_list:
checkifnewgame(res)
self.newline(res, True)
addgamesingle(lambda res: self.newline(res, True))
def tagschanged(self, tags):
self.currtags = tags
@ -1469,7 +1520,6 @@ class dialog_savedgame_new(saveposwindow):
ItemWidget.clearfocus()
self.formLayout.removeWidget(self.flow)
self.flow.deleteLater()
self.idxsave.clear()
self.flow = lazyscrollflow()
self.flow.bgclicked.connect(ItemWidget.clearfocus)
self.formLayout.insertWidget(self.formLayout.count() - 1, self.flow)
@ -1522,17 +1572,20 @@ class dialog_savedgame_new(saveposwindow):
othersetting = QAction(_TR("其他设置"))
if self.currentfocuspath:
menu.addAction(startgame)
exists = os.path.exists(self.currentfocuspath)
if exists:
menu.addAction(startgame)
menu.addAction(gamesetting)
menu.addAction(delgame)
menu.addAction(opendir)
if exists:
menu.addAction(opendir)
else:
menu.addAction(addgame)
menu.addAction(batchadd)
menu.addAction(othersetting)
action = menu.exec(self.mapToGlobal(p))
if action == startgame:
self.startgame(self.currentfocuspath)
startgamecheck(self, self.currentfocuspath)
elif action == gamesetting:
self.showsettingdialog()
elif action == delgame:
@ -1617,7 +1670,7 @@ class dialog_savedgame_new(saveposwindow):
self.buttonlayout = buttonlayout
self.savebutton = []
self.simplebutton(
"开始游戏", True, lambda: self.startgame(self.currentfocuspath), True
"开始游戏", True, lambda: startgamecheck(self, self.currentfocuspath), True
)
self.simplebutton("游戏设置", True, self.showsettingdialog, False)
self.simplebutton("删除游戏", True, self.clicked2, False)
@ -1636,7 +1689,6 @@ class dialog_savedgame_new(saveposwindow):
self.activategamenum = 1
self.itemfocuschanged(False, None)
self.show()
self.idxsave = []
if globalconfig["hide_not_exists"]:
self.tagswidget.addTag(_TR("存在"), tagitem.TYPE_EXISTS)
else:
@ -1658,17 +1710,13 @@ class dialog_savedgame_new(saveposwindow):
def moverank(self, dx):
game = self.currentfocuspath
idx1 = self.idxsave.index(game)
idx2 = (idx1 + dx) % len(self.idxsave)
game2 = self.idxsave[idx2]
self.idxsave[idx1], self.idxsave[idx2] = self.idxsave[idx2], self.idxsave[idx1]
self.flow.switchidx(idx1, idx2)
idx1 = savehook_new_list.index(game)
idx2 = savehook_new_list.index(game2)
idx2 = (idx1 + dx) % len(savehook_new_list)
savehook_new_list[idx1], savehook_new_list[idx2] = (
savehook_new_list[idx2],
savehook_new_list[idx1],
)
self.flow.switchidx(idx1, idx2)
def showsettingdialog(self):
try:
@ -1701,17 +1749,11 @@ class dialog_savedgame_new(saveposwindow):
)
_btn.setEnabled(_able1)
def _getpixfunction(self, kk):
_pix = QPixmap(savehook_new_data[kk]["imagepath"])
if _pix.isNull():
_pix = getExeIcon(kk, False, cache=True)
return _pix
def getagameitem(self, k):
gameitem = ItemWidget(
k, functools.partial(self._getpixfunction, k), savehook_new_data[k]["title"]
k, functools.partial(_getpixfunction, k), savehook_new_data[k]["title"]
)
gameitem.doubleclicked.connect(self.startgame)
gameitem.doubleclicked.connect(functools.partial(startgamecheck, self))
gameitem.focuschanged.connect(self.itemfocuschanged)
return gameitem
@ -1725,13 +1767,10 @@ class dialog_savedgame_new(saveposwindow):
self.flow.insertwidget(
0, (functools.partial(self.getagameitem, k), QSize(itemw, itemh))
)
self.idxsave.insert(0, k)
else:
self.flow.addwidget(
(functools.partial(self.getagameitem, k), QSize(itemw, itemh))
)
# self.flow.addwidget( self.getagameitem(k))
self.idxsave.append(k)
@Singleton_close
@ -1754,33 +1793,22 @@ class dialog_savedgame_lagacy(QDialog):
def clicked2(self):
try:
key = savehook_new_list.pop(self.table.currentIndex().row())
if key in savehook_new_data:
savehook_new_data.pop(key)
removegame(savehook_new_list[self.table.currentIndex().row()])
self.model.removeRow(self.table.currentIndex().row())
except:
pass
def clicked3(self):
f = QFileDialog.getOpenFileName(directory="")
res = f[0]
if res != "":
row = 0 # model.rowCount()
res = res.replace("/", "\\")
if res in savehook_new_list:
return
def call(res):
self.newline(0, res)
self.table.setCurrentIndex(self.model.index(0, 0))
addgamesingle(call)
def clicked(self):
if os.path.exists(self.model.item(self.table.currentIndex().row(), 2).savetext):
savehook_new_list.insert(
0, savehook_new_list.pop(self.table.currentIndex().row())
)
self.close()
startgame(self.model.item(self.table.currentIndex().row(), 2).savetext)
startgamecheck(
self, self.model.item(self.table.currentIndex().row(), 2).savetext
)
def newline(self, row, k):
keyitem = QStandardItem()
@ -1800,7 +1828,9 @@ class dialog_savedgame_lagacy(QDialog):
)
self.table.setIndexWidget(
self.model.index(row, 1),
getcolorbutton("", "", functools.partial(opendir, k), qicon=getExeIcon(k)),
getcolorbutton(
"", "", functools.partial(opendir, k), qicon=getExeIcon(k, cache=True)
),
)
self.table.setIndexWidget(
@ -1818,9 +1848,9 @@ class dialog_savedgame_lagacy(QDialog):
# if dialog_savedgame._sigleton :
# return
# dialog_savedgame._sigleton=True
super().__init__(parent, Qt.WindowCloseButtonHint)
super().__init__(parent, Qt.WindowType.WindowCloseButtonHint)
globalconfig["gamemanageruseversion"] = 1
self.setWindowTitle(_TR("已保存游戏"))
self.setWindowTitle(_TR("游戏管理"))
formLayout = QVBoxLayout(self) #
model = QStandardItemModel()
model.setHorizontalHeaderLabels(_TRL(["转区", "", "设置", "游戏"])) # ,'HOOK'])
@ -1828,11 +1858,13 @@ class dialog_savedgame_lagacy(QDialog):
self.model = model
table = QTableView()
table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents)
table.horizontalHeader().setSectionResizeMode(
QHeaderView.ResizeMode.ResizeToContents
)
table.horizontalHeader().setStretchLastSection(True)
# table.setEditTriggers(QAbstractItemView.NoEditTriggers);
table.setSelectionBehavior(QAbstractItemView.SelectRows)
table.setSelectionMode((QAbstractItemView.SingleSelection))
table.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
table.setSelectionMode((QAbstractItemView.SelectionMode.SingleSelection))
table.setWordWrap(False)
table.setModel(model)
self.table = table
@ -1857,3 +1889,277 @@ class dialog_savedgame_lagacy(QDialog):
formLayout.addWidget(button2)
self.resize(QSize(800, 400))
self.show()
class clickitem(QWidget):
focuschanged = pyqtSignal(bool, str)
doubleclicked = pyqtSignal(str)
globallashfocus = None
@classmethod
def clearfocus(cls):
try: # 可能已被删除
if clickitem.globallashfocus:
clickitem.globallashfocus.focusOut()
except:
pass
clickitem.globallashfocus = None
def mouseDoubleClickEvent(self, e):
self.doubleclicked.emit(self.exe)
def click(self):
try:
self.bottommask.setStyleSheet(
f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor"],globalconfig["dialog_savegame_layout"]["transparent"])};'
)
if self != clickitem.globallashfocus:
clickitem.clearfocus()
clickitem.globallashfocus = self
self.focuschanged.emit(True, self.exe)
except:
print_exc()
def mousePressEvent(self, ev) -> None:
self.click()
def focusOut(self):
self.bottommask.setStyleSheet("background-color: rgba(255,255,255, 0);")
self.focuschanged.emit(False, self.exe)
def resizeEvent(self, a0: QResizeEvent) -> None:
self.bottommask.resize(a0.size())
self.maskshowfileexists.resize(a0.size())
def __init__(self, exe):
super().__init__()
self.exe = exe
self.lay = QHBoxLayout()
self.lay.setSpacing(0)
self.lay.setContentsMargins(0, 0, 0, 0)
self.maskshowfileexists = QLabel(self)
c = globalconfig["dialog_savegame_layout"][
("onfilenoexistscolor", "backcolor")[os.path.exists(exe)]
]
c = str2rgba(c, globalconfig["dialog_savegame_layout"]["transparent"])
self.maskshowfileexists.setStyleSheet(f"background-color:{c};")
self.bottommask = QLabel(self)
self.bottommask.setStyleSheet("background-color: rgba(255,255,255, 0);")
_ = QLabel()
_.setFixedSize(QSize(40, 40))
_.setScaledContents(True)
_.setStyleSheet("background-color: rgba(255,255,255, 0);")
icon = getExeIcon(exe, icon=False, cache=True)
icon.setDevicePixelRatio(self.devicePixelRatioF())
_.setPixmap(icon)
self.lay.addWidget(_)
_ = QLabel(savehook_new_data[exe]["title"])
_.setWordWrap(True)
_.setFixedHeight(40)
self.lay.addWidget(_)
self.setLayout(self.lay)
_.setStyleSheet(
"""background-color: rgba(255,255,255, 0);border-bottom: 1px solid black;"""
)
class pixwrapper(QWidget):
def __init__(self) -> None:
super().__init__()
self.pixview = QLabel(self)
self.pixmap = None
def resizeEvent(self, e: QResizeEvent):
self.pixview.resize(e.size())
if self.pixmap:
self.pixview.setPixmap(self.scalepix(self.pixmap))
def setpix(self, pix: QPixmap):
pix.setDevicePixelRatio(self.devicePixelRatioF())
self.pixmap = pix
self.pixview.setPixmap(self.scalepix(pix))
def scalepix(self, pix: QPixmap):
pix = pix.scaled(
self.pixview.size() * self.devicePixelRatioF(),
Qt.AspectRatioMode.KeepAspectRatio,
Qt.TransformationMode.SmoothTransformation,
)
return pix
@Singleton_close
class dialog_savedgame_v3(saveposwindow):
def viewitem(self, k):
try:
_pix = _getpixfunction(k)
self.pixview.setpix(_pix)
self.currentfocuspath = k
if self.righttop.count() > 1:
self.righttop.removeTab(1)
tabadd_lazy(
self.righttop,
savehook_new_data[k]["title"],
lambda v: v.addWidget(dialog_setting_game_internal(self, k)),
)
except:
print_exc()
def itemfocuschanged(self, b, k):
if b:
self.currentfocuspath = k
else:
self.currentfocuspath = None
for _btn, exists in self.savebutton:
_able1 = b and (
(not exists)
or (self.currentfocuspath)
and (os.path.exists(self.currentfocuspath))
)
_btn.setEnabled(_able1)
if self.currentfocuspath:
self.viewitem(k)
def newline(self, row, k, select):
item = clickitem(k)
item.doubleclicked.connect(functools.partial(startgamecheck, self))
item.focuschanged.connect(self.itemfocuschanged)
if select:
item.click()
self.group0.insertw(row, item)
def stack_showmenu(self, p):
if not self.currentfocuspath:
return
menu = QMenu(self)
startgame = QAction(_TR("开始游戏"))
delgame = QAction(_TR("删除游戏"))
opendir = QAction(_TR("打开目录"))
exists = os.path.exists(self.currentfocuspath)
if exists:
menu.addAction(startgame)
menu.addAction(delgame)
if exists:
menu.addAction(opendir)
action = menu.exec(QCursor.pos())
if action == startgame:
startgamecheck(self, self.currentfocuspath)
elif action == delgame:
self.clicked2()
elif action == opendir:
self.clicked4()
def __init__(self, parent) -> None:
super().__init__(
parent,
flags=Qt.WindowType.WindowMinMaxButtonsHint
| Qt.WindowType.WindowCloseButtonHint,
dic=globalconfig,
key="savegamedialoggeo3",
)
globalconfig["gamemanageruseversion"] = 2
self.setWindowTitle(_TR("游戏管理"))
self.currentfocuspath = None
self.stack = stackedlist()
self.stack.setContextMenuPolicy(Qt.ContextMenuPolicy.CustomContextMenu)
self.stack.customContextMenuRequested.connect(self.stack_showmenu)
self.stack.setFixedWidth(300)
w = QWidget()
self.setCentralWidget(w)
lay = QHBoxLayout()
w.setLayout(lay)
lay.addWidget(self.stack)
self.group0 = shrinkableitem(QPushButton("GLOBAL"))
self.stack.addw(self.group0)
self.righttop = makesubtab_lazy()
self.pixview = pixwrapper()
_w = QWidget()
rightlay = QVBoxLayout()
rightlay.setContentsMargins(0, 0, 0, 0)
_w.setLayout(rightlay)
self.righttop.addTab(_w, " ")
lay.addWidget(self.righttop)
rightlay.addWidget(self.pixview)
self.buttonlayout = QHBoxLayout()
self.savebutton = []
rightlay.addLayout(self.buttonlayout)
self.simplebutton(
"开始游戏", True, lambda: startgamecheck(self, self.currentfocuspath), True
)
self.simplebutton("删除游戏", True, self.clicked2, False)
self.simplebutton("打开目录", True, self.clicked4, True)
if globalconfig["startgamenototop"]:
self.simplebutton("Up", True, functools.partial(self.moverank, -1), False)
self.simplebutton("Down", True, functools.partial(self.moverank, 1), False)
self.simplebutton("添加游戏", False, self.clicked3, 1)
self.simplebutton("批量添加", False, self.clicked3_batch, 1)
self.simplebutton(
"其他设置", False, lambda: dialog_syssetting(self, type_=2), False
)
self.show()
for row, k in enumerate(savehook_new_list): # 2
if globalconfig["hide_not_exists"]:
if not os.path.exists(k):
continue
self.newline(row, k, row == 0)
def moverank(self, dx):
game = self.currentfocuspath
idx1 = savehook_new_list.index(game)
idx2 = (idx1 + dx) % len(savehook_new_list)
savehook_new_list[idx1], savehook_new_list[idx2] = (
savehook_new_list[idx2],
savehook_new_list[idx1],
)
self.group0.insertw(idx2, self.group0.popw(idx1))
def clicked2(self):
if not self.currentfocuspath:
return
try:
game = self.currentfocuspath
idx2 = savehook_new_list.index(game)
self.group0.popw(idx2).deleteLater()
removegame(game)
self.currentfocuspath = savehook_new_list[idx2]
except:
pass
def clicked4(self):
opendir(self.currentfocuspath)
def clicked3_batch(self):
addgamebatch(lambda res: self.newline(res, True, False))
def clicked3(self):
addgamesingle(lambda res: self.newline(0, res, True))
def clicked(self):
startgamecheck(self, self.currentfocuspath)
def simplebutton(self, text, save, callback, exists):
button5 = QPushButton()
button5.setText(_TR(text))
if save:
self.savebutton.append((button5, exists))
button5.clicked.connect(callback)
button5.setFocusPolicy(Qt.FocusPolicy.NoFocus)
self.buttonlayout.addWidget(button5)
return button5

View File

@ -1,11 +1,10 @@
from qtsymbols import *
import qtawesome
import threading, windows
import gobject, time
import threading, windows, time
import gobject, qtawesome
from myutils.config import globalconfig, _TR, _TRL
from gui.usefulwidget import saveposwindow, getsimplecombobox
from myutils.utils import str2rgba
from myutils.wrapper import Singleton_close, threader
from gui.usefulwidget import saveposwindow, getsimplecombobox
@Singleton_close

View File

@ -1,10 +1,10 @@
import functools
from qtsymbols import *
import qtawesome, importlib
import functools, importlib
import qtawesome
from myutils.config import globalconfig, _TR, _TRL
from gui.usefulwidget import MySwitch, selectcolor, getsimpleswitch, threebuttons
from myutils.utils import makehtml
from myutils.wrapper import Singleton
from gui.usefulwidget import MySwitch, selectcolor, getsimpleswitch, threebuttons
@Singleton

View File

@ -1,8 +1,6 @@
from qtsymbols import *
import sqlite3, os
import json
import sqlite3, os, json, functools
from traceback import print_exc
import functools
from myutils.config import globalconfig, _TR
from myutils.utils import autosql
from gui.usefulwidget import getQMessageBox

View File

@ -1,8 +1,7 @@
from qtsymbols import *
from myutils.config import _TR
from myutils.config import globalconfig
from gui.resizeablemainwindow import Mainw
import windows, winsharedutils
from myutils.config import _TR, globalconfig
from gui.resizeablemainwindow import Mainw
class rangeadjust(Mainw):

View File

@ -1,15 +1,11 @@
import functools, json, windows
from traceback import print_exc
from qtsymbols import *
from myutils.config import savehook_new_data, static_data
import qtawesome
import subprocess
import winsharedutils
import os, time
import gobject
import binascii
from myutils.config import globalconfig, _TR, _TRL
import functools, json, subprocess, os, time, binascii
from collections import OrderedDict
from traceback import print_exc
import qtawesome, windows, winsharedutils, gobject
from myutils.config import savehook_new_data, static_data, globalconfig, _TR, _TRL
from myutils.utils import checkchaos, get_time_stamp
from gui.dialog_savedgame import dialog_setting_game
from gui.usefulwidget import (
closeashidewindow,
getQMessageBox,
@ -18,8 +14,6 @@ from gui.usefulwidget import (
getsimpleswitch,
textbrowappendandmovetoend,
)
from myutils.utils import checkchaos, get_time_stamp
from gui.dialog_savedgame import dialog_setting_game
def getformlayoutw(w=None, cls=QFormLayout, hide=False):

View File

@ -1,25 +1,25 @@
from qtsymbols import *
import qtawesome
import functools
from myutils.config import globalconfig, _TR
import qtawesome
from myutils.config import globalconfig, _TR, _TRL
from myutils.utils import wavmp3player
from gui.settingpage1 import setTabOne_lazy
from gui.settingpage2 import setTabTwo_lazy, checkconnected
from gui.settingpage_xianshishezhi import setTabThree_lazy
from gui.gui_xianshi_text import maybehavefontsizespin
from gui.settingpage_tts import setTab5, showvoicelist
from gui.settingpage_cishu import setTabcishu
from gui.settingpage_quick import setTab_quick, registrhotkeys
from gui.usefulwidget import closeashidewindow, makesubtab_lazy
from gui.setting_textinput import setTabOne_lazy
from gui.setting_translate import setTabTwo_lazy, checkconnected
from gui.setting_display import setTabThree_lazy
from gui.setting_display_text import maybehavefontsizespin
from gui.setting_tts import setTab5, showvoicelist
from gui.setting_cishu import setTabcishu
from gui.setting_hotkey import setTab_quick, registrhotkeys
from gui.setting_lang import setTablang
from gui.setting_proxy import setTab_proxy
from gui.settingpage7 import setTab7_lazy, delaysetcomparetext
from gui.settingpage_about import (
from gui.setting_transopti import setTab7_lazy, delaysetcomparetext
from gui.setting_about import (
setTab_aboutlazy,
versionlabelmaybesettext,
updateprogress,
getversion,
)
from gui.usefulwidget import closeashidewindow, makesubtab_lazy
class TabWidget(QWidget):
@ -62,7 +62,7 @@ class TabWidget(QWidget):
return self.tab_widget.currentWidget()
class Settin(closeashidewindow):
class Setting(closeashidewindow):
voicelistsignal = pyqtSignal(list, int)
mp3playsignal = pyqtSignal(bytes, int, bool)
versiontextsignal = pyqtSignal(str)
@ -72,7 +72,7 @@ class Settin(closeashidewindow):
showandsolvesig = pyqtSignal(str)
def __init__(self, parent):
super(Settin, self).__init__(parent, globalconfig, "setting_geo_2")
super(Setting, self).__init__(parent, globalconfig, "setting_geo_2")
self.setWindowIcon(qtawesome.icon("fa.gear"))
self.mp3player = wavmp3player()
self.mp3playsignal.connect(self.mp3player.mp3playfunction)
@ -101,18 +101,20 @@ class Settin(closeashidewindow):
self.setWindowTitle(_TR("设置"))
self.tab_widget, do = makesubtab_lazy(
[
"文本输入",
"翻译设置",
"显示设置",
"文本处理",
"辞书设置",
"语音合成",
"快捷按键",
"语言设置",
"代理设置",
"其他设置",
],
_TRL(
[
"文本输入",
"翻译设置",
"显示设置",
"文本处理",
"辞书设置",
"语音合成",
"快捷按键",
"语言设置",
"代理设置",
"其他设置",
]
),
[
functools.partial(setTabOne_lazy, self),
functools.partial(setTabTwo_lazy, self),

View File

@ -1,17 +1,16 @@
from qtsymbols import *
import platform, functools, sys, os
import winsharedutils
from myutils.config import globalconfig, _TR, static_data, _TRL
from myutils.wrapper import threader
from myutils.utils import makehtml, getimageformatlist
from myutils.githubupdate import updatemethod, getvesionmethod
from gui.usefulwidget import (
D_getsimpleswitch,
D_getsimplecombobox,
makescrollgrid,
makesubtab_lazy,
)
from myutils.config import globalconfig, _TR, static_data
from myutils.wrapper import threader
import platform, winsharedutils, sys, os
from myutils.utils import makehtml, getimageformatlist
import functools
from myutils.githubupdate import updatemethod, getvesionmethod
@threader
def getversion(self):
@ -121,7 +120,7 @@ def resourcegrid(self, l):
__ = True
grid.append([(_TR(name), 1, ""), (makehtml(link, __), 2, "link")])
makewidgetsfunctions.append(functools.partial(makescrollgrid, grid))
tab, dotab = makesubtab_lazy(titles, makewidgetsfunctions, delay=True)
tab, dotab = makesubtab_lazy(_TRL(titles), makewidgetsfunctions, delay=True)
l.addWidget(tab)
dotab()
@ -224,7 +223,7 @@ def setTab_aboutlazy(self, basel):
]
tab, dotab = makesubtab_lazy(
["相关说明", "其他设置", "资源下载"],
_TRL(["相关说明", "其他设置", "资源下载"]),
[
functools.partial(makescrollgrid, shuominggrid),
functools.partial(makescrollgrid, grid2),

View File

@ -1,4 +1,5 @@
import functools, os
import gobject
from myutils.config import globalconfig, _TRL
from gui.inputdialog import autoinitdialog, autoinitdialog_items
from gui.usefulwidget import (
@ -8,7 +9,6 @@ from gui.usefulwidget import (
D_getsimpleswitch,
D_getsimplecombobox,
)
import gobject
def setTabcishu(self, basel):

View File

@ -1,11 +1,11 @@
import functools
from qtsymbols import *
from myutils.config import globalconfig
import functools
import gobject
from gui.gui_xianshi_buttons import createbuttonwidget
from gui.gui_xianshi_text import xianshigrid
from gui.gui_xianshi_ui import uisetting
from gui.gui_xianshi_scale import makescalew
from myutils.config import globalconfig, _TRL
from gui.setting_display_buttons import createbuttonwidget
from gui.setting_display_text import xianshigrid
from gui.setting_display_ui import uisetting
from gui.setting_display_scale import makescalew
from gui.usefulwidget import (
D_getspinbox,
makesubtab_lazy,
@ -85,7 +85,7 @@ def _xingw():
def setTabThree_lazy(self, basel):
tab, do = makesubtab_lazy(
["文本设置", "界面主题", "窗口行为", "工具按钮", "窗口缩放"],
_TRL(["文本设置", "界面主题", "窗口行为", "工具按钮", "窗口缩放"]),
[
lambda l: makescrollgrid(xianshigrid(self), l),
lambda l: makescrollgrid(uisetting(self), l),

View File

@ -1,8 +1,8 @@
import functools
from qtsymbols import *
import functools, json
import qtawesome, gobject
from myutils.config import globalconfig, _TR, _TRL
from myutils.wrapper import Singleton
import qtawesome, gobject, json
from gui.usefulwidget import (
D_getsimplecombobox,
D_getcolorbutton,

View File

@ -1,6 +1,6 @@
import functools
from qtsymbols import *
from myutils.config import globalconfig, magpie_config, static_data
import functools
from myutils.config import globalconfig, magpie_config, static_data, _TRL
from gui.inputdialog import getsomepath1
from gui.usefulwidget import (
D_getsimplecombobox,
@ -315,7 +315,7 @@ def makescalew(self, lay):
gw, gd = makegrid(commonfsgrid, delay=True)
vl.addWidget(gw)
tw, td = makesubtab_lazy(
["Magpie", "外部缩放软件"],
_TRL(["Magpie", "外部缩放软件"]),
[
functools.partial(makescrollgrid, innermagpie),
functools.partial(makescrollgrid, losslessgrid),

View File

@ -1,8 +1,8 @@
import functools
from qtsymbols import *
from gui.inputdialog import multicolorset
from myutils.config import globalconfig, _TRL
import functools
import gobject
from myutils.config import globalconfig, _TRL
from gui.inputdialog import multicolorset
from gui.usefulwidget import (
D_getsimplecombobox,
getsimpleswitch,

View File

@ -1,7 +1,7 @@
import functools
from qtsymbols import *
from myutils.config import globalconfig, _TRL, static_data
import functools
import gobject
from myutils.config import globalconfig, _TRL, static_data
from gui.usefulwidget import (
D_getsimplecombobox,
D_getspinbox,

View File

@ -1,16 +1,15 @@
from qtsymbols import *
import functools
import gobject, windows, winsharedutils
from myutils.config import globalconfig, _TR
from myutils.winsyshotkey import SystemHotkey, registerException
import winsharedutils
import gobject, windows, functools
from qtsymbols import *
from myutils.hwnd import grabwindow
from myutils.utils import getimageformat, parsekeystringtomodvkcode, unsupportkey
from gui.usefulwidget import (
D_getsimpleswitch,
D_getsimplekeyseq,
makescrollgrid,
)
from myutils.hwnd import grabwindow
from myutils.utils import getimageformat, parsekeystringtomodvkcode, unsupportkey
def delaycreatereferlabels(self, name):

View File

@ -1,6 +1,6 @@
from qtsymbols import *
from myutils.config import _TR
from myutils.config import globalconfig
import os, functools
from myutils.config import _TR, _TRL, globalconfig
from myutils.utils import splittranslatortypes
from gui.usefulwidget import (
D_getsimpleswitch,
@ -9,7 +9,6 @@ from gui.usefulwidget import (
getvboxwidget,
makescrollgrid,
)
import os, functools
def getall(l, item="fanyi", name=""):
@ -99,7 +98,7 @@ def setTab_proxy_lazy(self, basel):
gridlayoutwidget, do = makegrid(grid1, delay=True)
vl.addWidget(gridlayoutwidget)
tab, dotab = makesubtab_lazy(
["在线翻译", "注册在线翻译", "在线OCR"],
_TRL(["在线翻译", "注册在线翻译", "在线OCR"]),
[
functools.partial(makescrollgrid, mianfei),
functools.partial(makescrollgrid, shoufei),

View File

@ -1,25 +1,28 @@
import functools, os, windows, json
from qtsymbols import *
from gui.pretransfile import sqlite2json2
from gui.settingpage_ocr import getocrgrid
import functools, os, json
import windows, gobject
from myutils.utils import makehtml, getfilemd5
from myutils.config import globalconfig, _TR, _TRL, savehook_new_data, savehook_new_list
from gui.dialog_savedgame import dialog_savedgame_new, dialog_savedgame_lagacy
import gobject
from gui.pretransfile import sqlite2json2
from gui.codeacceptdialog import codeacceptdialog
from gui.setting_textinput_ocr import getocrgrid
from gui.dialog_savedgame import (
dialog_savedgame_new,
dialog_savedgame_lagacy,
dialog_savedgame_v3,
)
from gui.inputdialog import regexedit
from gui.usefulwidget import (
D_getsimplecombobox,
D_getspinbox,
D_getcolorbutton,
makegrid,
tabadd_lazy,
yuitsu_switch,
getvboxwidget,
D_getsimpleswitch,
makesubtab_lazy,
makescrollgrid,
)
from gui.codeacceptdialog import codeacceptdialog
from myutils.utils import makehtml, getfilemd5
def dynamicusemanager(self):
@ -27,6 +30,8 @@ def dynamicusemanager(self):
dialog_savedgame_new(self)
elif globalconfig["gamemanageruseversion"] == 1:
dialog_savedgame_lagacy(self)
elif globalconfig["gamemanageruseversion"] == 2:
dialog_savedgame_v3(self)
def gethookgrid(self):
@ -433,10 +438,6 @@ def outputgrid(self):
return grids
def setTabOne(self):
tabadd_lazy(self.tab_widget, ("文本输入"), lambda l: setTabOne_lazy(self, l))
def setTabOne_lazy(self, basel):
tab1grids = [
[("选择文本输入源", -1)],
@ -509,7 +510,7 @@ def setTabOne_lazy(self, basel):
gridlayoutwidget, do = makegrid(tab1grids, delay=True)
vl.addWidget(gridlayoutwidget)
tab, dotab = makesubtab_lazy(
["HOOK设置", "OCR设置", "剪贴板", "内嵌翻译", "文本输出"],
_TRL(["HOOK设置", "OCR设置", "剪贴板", "内嵌翻译", "文本输出"]),
[
lambda l: makescrollgrid(gethookgrid(self), l),
lambda l: makescrollgrid(getocrgrid(self), l),

View File

@ -1,5 +1,8 @@
from qtsymbols import *
import functools, os
import gobject
from myutils.config import globalconfig, ocrsetting, _TRL, ocrerrorfix
from gui.inputdialog import autoinitdialog, postconfigdialog, autoinitdialog_items
from gui.usefulwidget import (
D_getsimplecombobox,
D_getspinbox,
@ -8,9 +11,6 @@ from gui.usefulwidget import (
D_getsimpleswitch,
selectcolor,
)
from qtsymbols import *
from gui.inputdialog import autoinitdialog, postconfigdialog, autoinitdialog_items
import gobject
def __label1(self):

View File

@ -1,12 +1,12 @@
from qtsymbols import *
import functools, gobject
import functools, os, time, hashlib
import requests, gobject
from myutils.wrapper import threader
from myutils.config import globalconfig, translatorsetting
from myutils.subproc import subproc_w
from gui.pretransfile import sqlite2json
from myutils.config import globalconfig, _TR
from myutils.config import globalconfig, _TR, _TRL
from myutils.utils import selectdebugfile, splittranslatortypes, checkportavailable
import os, time, requests
from gui.pretransfile import sqlite2json
from gui.inputdialog import autoinitdialog, autoinitdialog_items
from gui.usefulwidget import (
D_getspinbox,
@ -19,8 +19,6 @@ from gui.usefulwidget import (
makescrollgrid,
getvboxwidget,
)
from myutils.wrapper import threader
import time, hashlib
def hashtext(a):
@ -277,7 +275,7 @@ def setTabTwo_lazy(self, basel):
gridlayoutwidget, do = makegrid(grids, delay=True)
vl.addWidget(gridlayoutwidget)
tab, dotab = makesubtab_lazy(
["在线翻译", "develop", "注册在线翻译", "离线翻译", "预翻译"],
_TRL(["在线翻译", "develop", "注册在线翻译", "离线翻译", "预翻译"]),
[
functools.partial(makescrollgrid, onlinegrid),
functools.partial(makescrollgrid, developgrid),

View File

@ -1,13 +1,22 @@
import functools, copy, os, gobject
from qtsymbols import *
import functools, copy, os
from traceback import print_exc
import gobject
from myutils.post import POSTSOLVE
from myutils.utils import (
selectdebugfile,
checkpostlangmatch,
loadpostsettingwindowmethod,
)
from myutils.config import (
globalconfig,
postprocessconfig,
static_data,
_TRL,
savehook_new_data,
_TR,
)
from gui.codeacceptdialog import codeacceptdialog
from gui.usefulwidget import (
getcolorbutton,
D_getcolorbutton,
@ -16,18 +25,11 @@ from gui.usefulwidget import (
getvboxwidget,
makesubtab_lazy,
)
from gui.codeacceptdialog import codeacceptdialog
from gui.inputdialog import (
postconfigdialog,
autoinitdialog,
autoinitdialog_items,
)
from myutils.utils import (
selectdebugfile,
checkpostlangmatch,
loadpostsettingwindowmethod,
)
from myutils.post import POSTSOLVE
def savegameprocesstext():
@ -254,7 +256,7 @@ def setTab7_lazy(self, basel):
vbox.addWidget(getcomparelayout(self))
tab, dotab = makesubtab_lazy(
["文本预处理", "翻译优化"],
_TRL(["文本预处理", "翻译优化"]),
[___, functools.partial(makescrollgrid, grids2)],
delay=True,
)

View File

@ -1,9 +1,8 @@
import functools
from qtsymbols import *
from gui.inputdialog import autoinitdialog_items, noundictconfigdialog1, autoinitdialog
from myutils.config import globalconfig, _TRL
import os, functools
import gobject
from myutils.config import globalconfig, _TRL
from gui.inputdialog import autoinitdialog_items, noundictconfigdialog1, autoinitdialog
from gui.usefulwidget import (
D_getsimplecombobox,
D_getspinbox,

View File

@ -1,9 +1,9 @@
from qtsymbols import *
import qtawesome, gobject
from myutils.ocrutil import imagesolve
from gui.usefulwidget import saveposwindow
from myutils.config import globalconfig, _TR
from myutils.wrapper import Singleton_close
from gui.usefulwidget import saveposwindow
@Singleton_close

View File

@ -1,14 +1,16 @@
from qtsymbols import *
from myutils.hwnd import grabwindow
import json, time, functools, os, base64, uuid
from urllib.parse import quote
from traceback import print_exc
import requests, json, time
import qtawesome, functools, os, base64
import gobject, uuid, windows
import qtawesome, requests, gobject, windows
import myutils.ankiconnect as anki
from myutils.hwnd import grabwindow
from myutils.utils import getimageformat, parsekeystringtomodvkcode, unsupportkey
from myutils.config import globalconfig, _TR, static_data
import myutils.ankiconnect as anki
from myutils.subproc import subproc_w
from myutils.wrapper import threader
from myutils.ocrutil import imageCut, ocr_run
from gui.rangeselect import rangeselct_function
from gui.usefulwidget import (
closeashidewindow,
getQMessageBox,
@ -22,10 +24,6 @@ from gui.usefulwidget import (
makesubtab_lazy,
tabadd_lazy,
)
from myutils.subproc import subproc_w
from myutils.wrapper import threader
from myutils.ocrutil import imageCut, ocr_run
from gui.rangeselect import rangeselct_function
class loopbackrecorder:
@ -145,8 +143,8 @@ class AnkiWindow(QWidget):
self.currentword = ""
self.tabs = makesubtab_lazy(callback=self.ifshowrefresh)
self.tabs.addTab(self.createaddtab(), _TR("添加"))
tabadd_lazy(self.tabs, "设置", self.creatsetdtab)
tabadd_lazy(self.tabs, "模板", self.creattemplatetab)
tabadd_lazy(self.tabs, _TR("设置"), self.creatsetdtab)
tabadd_lazy(self.tabs, _TR("模板"), self.creattemplatetab)
l = QHBoxLayout()
l.setContentsMargins(0, 0, 0, 0)

View File

@ -1,7 +1,7 @@
from qtsymbols import *
import threading
from traceback import print_exc
from myutils.wrapper import trypass
import threading
class chartwidget(QWidget):
@ -13,7 +13,7 @@ class chartwidget(QWidget):
fhall = fmetrics.height()
self.font = font
self.data = None
self.ymargin = int(fhall) + 10 # 20
self.valuewidth = 10
self.xtext = lambda x: str(x)
@ -463,3 +463,96 @@ class lazyscrollflow(QWidget):
new_height = y + line_height - rect.y() + self._margin
self.internalwid.setFixedHeight(new_height)
return new_height
class simplelistw(QWidget):
def __init__(self):
super().__init__()
self.lay = QVBoxLayout()
self.lay.setContentsMargins(0, 0, 0, 0)
self.lay.setSpacing(0)
self.setLayout(self.lay)
def addw(self, w):
self.lay.addWidget(w)
def insertw(self, i, w):
self.lay.insertWidget(i, w)
def popw(self, i):
return self.lay.takeAt(i).widget()
def w(self, i):
return self.lay.itemAt(i).widget()
def len(self):
return self.lay.count()
class shrinkableitem(QWidget):
def __init__(self, shrinker: QPushButton):
super().__init__()
self.lay = QVBoxLayout()
# self.setSizePolicy(QSizePolicy.Policy.Expanding,QSizePolicy.Policy.Fixed)
self.setLayout(self.lay)
self.lay.setContentsMargins(0, 0, 0, 0)
self.lay.setSpacing(0)
self.btn = shrinker
self.items = simplelistw()
self.btn.clicked.connect(self.Revert)
self.lay.addWidget(self.btn)
self.lay.addWidget(self.items)
def Revert(self):
self.items.setVisible(not self.items.isVisible())
def Show(self):
self.items.show()
def Hide(self):
self.items.hide()
def addw(self, w):
self.items.addw(w)
def insertw(self, i, w):
self.items.insertw(i, w)
def popw(self, i):
return self.items.popw(i)
def w(self, i):
return self.items.w(i)
def len(self):
return self.items.len()
class stackedlist(QScrollArea):
def __init__(self):
super().__init__()
self.setStyleSheet("""QScrollArea{background-color:transparent;border:0px}""")
self.setWidgetResizable(True)
internal = QWidget()
self.setWidget(internal)
self.lay = QVBoxLayout()
self.lay.setAlignment(Qt.AlignmentFlag.AlignTop)
self.lay.setSpacing(0)
self.lay.setContentsMargins(0, 0, 0, 0)
internal.setLayout(self.lay)
self.internal = internal
def addw(self, w):
self.lay.addWidget(w)
def insertw(self, i, w):
self.lay.insertWidget(i, w)
def popw(self, i):
return self.lay.takeAt(i).widget()
def w(self, i):
return self.lay.itemAt(i).widget()
def len(self):
return self.lay.count()

View File

@ -1,7 +1,7 @@
from qtsymbols import *
import functools
from myutils.config import globalconfig
from traceback import print_exc
from myutils.config import globalconfig
class Qlabel_c(QLabel):

View File

@ -1,8 +1,9 @@
from qtsymbols import *
import qtawesome, functools, winsharedutils
from gui.usefulwidget import closeashidewindow
import functools
import qtawesome, winsharedutils
from myutils.config import globalconfig, _TR
from myutils.utils import get_time_stamp
from gui.usefulwidget import closeashidewindow
class transhist(closeashidewindow):

View File

@ -1,27 +1,24 @@
import time
import functools
import threading
import os, sys
import windows, importlib
from traceback import print_exc
import qtawesome
from qtsymbols import *
import gobject
import time, functools, threading, os, sys, importlib, shutil
from traceback import print_exc
import windows, qtawesome, gobject, winsharedutils
from myutils.wrapper import threader, trypass
import winsharedutils
from myutils.config import globalconfig, saveallconfig, _TR, static_data
from myutils.subproc import endsubprocs
from myutils.ocrutil import ocr_run, imageCut
from myutils.utils import loadpostsettingwindowmethod, getimageformat, str2rgba
from myutils.hwnd import mouseselectwindow, grabwindow, getExeIcon
from gui.dialog_savedgame import dialog_savedgame_new, dialog_savedgame_lagacy
from gui.dialog_memory import dialog_memory
from gui.textbrowser import Textbrowser
from gui.rangeselect import rangeselct_function
from gui.usefulwidget import resizableframeless, isinrect
from gui.dialog_savedgame import browserdialog
from gui.edittext import edittrans
import shutil
from gui.dialog_savedgame import (
browserdialog,
dialog_savedgame_new,
dialog_savedgame_lagacy,
dialog_savedgame_v3,
)
class QUnFrameWindow(resizableframeless):
@ -405,7 +402,11 @@ class QUnFrameWindow(resizableframeless):
("backtransbutton", lambda: self.changemousetransparentstate(1)),
("locktoolsbutton", self.changetoolslockstate),
("gamepad_new", lambda: dialog_savedgame_new(gobject.baseobject.settin_ui)),
("gamepad_lagacy", lambda: dialog_savedgame_lagacy(gobject.baseobject.settin_ui)),
(
"gamepad_lagacy",
lambda: dialog_savedgame_lagacy(gobject.baseobject.settin_ui),
),
("gamepad_v3", lambda: dialog_savedgame_v3(gobject.baseobject.settin_ui)),
(
"selectgame",
lambda: gobject.baseobject.createattachprocess(),

View File

@ -1,16 +1,15 @@
from qtsymbols import *
import os, platform, functools, threading, time
from traceback import print_exc
import windows, qtawesome
from webviewpy import (
webview_native_handle_kind_t,
Webview,
declare_library_path,
)
from myutils.config import _TR, globalconfig
from traceback import print_exc
import qtawesome, functools, threading, time
from myutils.wrapper import Singleton
from winsharedutils import HTMLBrowser
import windows, os, platform
from myutils.config import _TR, globalconfig
from myutils.wrapper import Singleton
@Singleton
@ -853,7 +852,7 @@ def tabadd_lazy(tab, title, getrealwidgetfunction):
q.setLayout(v)
v.setContentsMargins(0, 0, 0, 0)
q.lazyfunction = functools.partial(getrealwidgetfunction, v)
tab.addTab(q, _TR(title))
tab.addTab(q, title)
def automakegrid(grid: QGridLayout, lis, save=False, savelist=None):

View File

@ -2,7 +2,7 @@ try:
from PyQt5 import QtSvg
from PyQt5.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QAction,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider
from PyQt5.QtGui import QIconEngine,QIntValidator,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent
from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex
from PyQt5.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer
isqt5 = True
except:
#from traceback import print_exc
@ -10,5 +10,5 @@ except:
from PyQt6 import QtSvg
from PyQt6.QtWidgets import QFrame,QListView,QCheckBox,QAbstractItemView,QTextEdit,QTableView,QHeaderView,QColorDialog,QSpinBox,QDoubleSpinBox,QComboBox,QDialogButtonBox,QMainWindow,QMessageBox,QDialog,QGridLayout,QTextBrowser,QGraphicsDropShadowEffect,QWidget,QSizePolicy,QScrollArea,QApplication,QPushButton,QSystemTrayIcon,QPlainTextEdit,QMenu,QFileDialog,QKeySequenceEdit,QLabel,QSpacerItem,QWidgetItem,QLayout,QTextBrowser,QLineEdit,QFormLayout,QSizePolicy,QTabWidget,QTabBar,QSplitter,QListWidget,QListWidgetItem,QHBoxLayout,QVBoxLayout,QSizeGrip,QFontComboBox,QProgressBar,QRadioButton,QButtonGroup,QSlider
from PyQt6.QtGui import QIconEngine,QIntValidator,QAction,QStandardItem,QStandardItemModel,QImageWriter,QIcon,QTextCharFormat,QTextBlockFormat,QResizeEvent,QTextCursor,QFontMetricsF,QMouseEvent,QImage,QPainter,QRegion,QCloseEvent,QFontDatabase,QKeySequence,QPixmap,QCursor,QColor,QFont,QPen,QPainterPath,QBrush,QFontMetrics,QShowEvent
from PyQt6.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex
from PyQt6.QtCore import QObject,pyqtSignal,Qt,QSize,QByteArray,QBuffer,QPointF,QPoint,QRect,QEvent,QModelIndex,QTimer
isqt5 = False

View File

@ -129,6 +129,12 @@
1200,
600
],
"savegamedialoggeo3": [
100,
100,
1200,
600
],
"browserwidget": [
100,
100,
@ -265,6 +271,7 @@
"locktoolsbutton",
"gamepad_new",
"gamepad_lagacy",
"gamepad_v3",
"selectgame",
"selecttext",
"selectocrrange",
@ -470,6 +477,12 @@
"icon": "fa.gamepad",
"align": 0
},
"gamepad_v3": {
"use": false,
"tip": "游戏管理_v3",
"icon": "fa.gamepad",
"align": 0
},
"edit": {
"use": false,
"tip": "编辑",
@ -1130,7 +1143,7 @@
},
"txocr": {
"use": false,
"name": "tencent.ocr"
"name": "腾讯OCR"
},
"txocrtrans": {
"use": false,
@ -1150,7 +1163,7 @@
},
"googlecloudvision": {
"use": false,
"name": "googlecloudvision"
"name": "Google Cloud Vision"
},
"xunfei": {
"use": false,

View File

@ -809,5 +809,6 @@
"显示时间": "عرض الوقت",
"不显示时间": "لا وقت العرض",
"过滤历史重复": "تصفية التاريخ تكرار",
"缓存条数": "عدد شرائط التخزين المؤقت"
"缓存条数": "عدد شرائط التخزين المؤقت",
"腾讯OCR": "تينسنت التعرف الضوئي على الحروف"
}

View File

@ -809,5 +809,6 @@
"显示时间": "顯示時間",
"不显示时间": "不顯示時間",
"过滤历史重复": "過濾歷史重複",
"缓存条数": "緩存條數"
"缓存条数": "緩存條數",
"腾讯OCR": "騰訊OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Display time",
"不显示时间": "Do not display time",
"过滤历史重复": "Filter historical duplicates",
"缓存条数": "Number of cache entries"
"缓存条数": "Number of cache entries",
"腾讯OCR": "Tencent OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Tiempo de visualización",
"不显示时间": "No muestra el tiempo",
"过滤历史重复": "Filtrar repetición histórica",
"缓存条数": "Número de barras de caché"
"缓存条数": "Número de barras de caché",
"腾讯OCR": "Tencent OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Afficher l'heure",
"不显示时间": "Ne pas afficher l'heure",
"过滤历史重复": "Filtrer historique répétition",
"缓存条数": "Nombre de barres de cache"
"缓存条数": "Nombre de barres de cache",
"腾讯OCR": "OCR Tencent"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Tempo di visualizzazione",
"不显示时间": "Non visualizzare l'ora",
"过滤历史重复": "Filtra duplicati storici",
"缓存条数": "Numero di voci della cache"
"缓存条数": "Numero di voci della cache",
"腾讯OCR": "Tencent OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "表示時間",
"不显示时间": "時間を表示しない",
"过滤历史重复": "フィルタ履歴の繰り返し",
"缓存条数": "キャッシュ・エントリ数"
"缓存条数": "キャッシュ・エントリ数",
"腾讯OCR": "テンセントOCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "표시 시간",
"不显示时间": "시간 표시 안 함",
"过滤历史重复": "반복된 기록 필터링",
"缓存条数": "캐시 바 수"
"缓存条数": "캐시 바 수",
"腾讯OCR": "텐센트 OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Czas wyświetlania",
"不显示时间": "Nie wyświetlaj czasu",
"过滤历史重复": "Filtruj duplikaty historyczne",
"缓存条数": "Liczba wpisów pamięci podręcznej"
"缓存条数": "Liczba wpisów pamięci podręcznej",
"腾讯OCR": "Dziesięć OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Показать время",
"不显示时间": "Не показывать время",
"过滤历史重复": "Фильтровать повторение истории",
"缓存条数": "Количество кэшированных записей"
"缓存条数": "Количество кэшированных записей",
"腾讯OCR": "Скачать OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "แสดงเวลา",
"不显示时间": "ไม่แสดงเวลา",
"过滤历史重复": "ประวัติการกรอง ทำซ้ำ",
"缓存条数": "จำนวนแถบแคช"
"缓存条数": "จำนวนแถบแคช",
"腾讯OCR": "Tencent โอซีอาร์"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Display time",
"不显示时间": "Zamanı gösterme",
"过滤历史重复": "Tarihi çizgileri sil",
"缓存条数": "Cache girişlerinin sayısı"
"缓存条数": "Cache girişlerinin sayısı",
"腾讯OCR": "Tencent OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Час показу",
"不显示时间": "Не показувати час",
"过滤历史重复": "Фільтрувати історичні дублікати",
"缓存条数": "Кількість записів кешу"
"缓存条数": "Кількість записів кешу",
"腾讯OCR": "Похильний OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "Thời gian hiển thị",
"不显示时间": "Không hiển thị thời gian",
"过滤历史重复": "Lọc lịch sử lặp lại",
"缓存条数": "Số thanh bộ nhớ cache"
"缓存条数": "Số thanh bộ nhớ cache",
"腾讯OCR": "Thông tin OCR"
}

View File

@ -809,5 +809,6 @@
"显示时间": "",
"不显示时间": "",
"过滤历史重复": "",
"缓存条数": ""
"缓存条数": "",
"腾讯OCR": ""
}

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 3)
set(VERSION_MINOR 1)
set(VERSION_PATCH 0)
set(VERSION_PATCH 1)
add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h)