From 1091508dabe710ce18b652fcfb1e128222c11c03 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 28 May 2024 18:28:05 +0800 Subject: [PATCH] update --- .../LunaTranslator/LunaTranslator.py | 119 ++++++++-- .../LunaTranslator/gui/dialog_memory.py | 5 +- .../LunaTranslator/gui/dialog_savedgame.py | 28 +-- LunaTranslator/LunaTranslator/gui/edittext.py | 4 +- .../LunaTranslator/gui/rangeselect.py | 10 +- .../LunaTranslator/gui/selecthook.py | 6 +- LunaTranslator/LunaTranslator/gui/settin.py | 214 +----------------- .../LunaTranslator/gui/setting_lang.py | 20 +- .../LunaTranslator/gui/setting_proxy.py | 23 +- .../LunaTranslator/gui/settingpage1.py | 23 +- .../LunaTranslator/gui/settingpage2.py | 30 ++- .../LunaTranslator/gui/settingpage7.py | 21 +- .../LunaTranslator/gui/settingpage_about.py | 66 +++--- .../LunaTranslator/gui/settingpage_cishu.py | 9 +- .../LunaTranslator/gui/settingpage_quick.py | 17 +- .../LunaTranslator/gui/settingpage_tts.py | 9 +- .../gui/settingpage_xianshishezhi.py | 213 ++++++++--------- .../LunaTranslator/gui/specialwidget.py | 2 +- .../LunaTranslator/gui/transhist.py | 3 +- .../LunaTranslator/gui/translatorUI.py | 14 +- .../LunaTranslator/gui/usefulwidget.py | 118 +++++++++- .../files/defaultconfig/config.json | 2 +- .../files/defaultconfig/static_data.json | 4 +- LunaTranslator/files/lang/ar.json | 4 +- LunaTranslator/files/lang/cht.json | 4 +- LunaTranslator/files/lang/en.json | 4 +- LunaTranslator/files/lang/es.json | 4 +- LunaTranslator/files/lang/fr.json | 4 +- LunaTranslator/files/lang/it.json | 4 +- LunaTranslator/files/lang/ja.json | 4 +- LunaTranslator/files/lang/ko.json | 4 +- LunaTranslator/files/lang/pl.json | 4 +- LunaTranslator/files/lang/ru.json | 4 +- LunaTranslator/files/lang/th.json | 4 +- LunaTranslator/files/lang/tr.json | 4 +- LunaTranslator/files/lang/uk.json | 4 +- LunaTranslator/files/lang/vi.json | 4 +- LunaTranslator/files/lang/zh.json | 4 +- plugins/CMakeLists.txt | 6 +- plugins/winsharedutils/hwnd.cpp | 4 +- 40 files changed, 517 insertions(+), 513 deletions(-) diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index b6f762f8..cd06b24d 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -3,6 +3,7 @@ import os, threading from traceback import print_exc from myutils.config import ( globalconfig, + _TR, savehook_new_list, savehook_new_data, setlanguage, @@ -18,7 +19,7 @@ from myutils.utils import ( getpostfile, stringfyerror, ) -from PyQt5.QtWidgets import QApplication +from PyQt5.QtWidgets import QApplication, QMenu, QAction, QFrame from PyQt5.QtCore import Qt, QObject, QEvent from myutils.wrapper import threader from gui.showword import searchwordW @@ -32,7 +33,7 @@ from gui.languageset import languageset import zhconv, functools import gui.transhist import gui.edittext -import importlib +import importlib, qtawesome from functools import partial from gui.settin import Settin from gui.showocrimage import showocrimage @@ -40,7 +41,7 @@ from gui.attachprocessdialog import AttachProcessDialog import windows import gobject import winsharedutils -from winsharedutils import pid_running +from winsharedutils import pid_running, isDark from myutils.post import POSTSOLVE @@ -108,7 +109,7 @@ class MAINUI: context = None try: if method["object"].using: - if 'process_before' in dir(method["object"]): + if "process_before" in dir(method["object"]): content, context = method["object"].process_before(content) except: print_exc() @@ -121,7 +122,7 @@ class MAINUI: context = mp[i] try: if method["object"].using: - if 'process_after' in dir(method["object"]): + if "process_after" in dir(method["object"]): res = method["object"].process_after(res, context) except: print_exc() @@ -720,6 +721,13 @@ class MAINUI: time.sleep(0.5) + def setdarktheme(self, widget, dark): + if widget.testAttribute(Qt.WA_TranslucentBackground): + return + winsharedutils.SetTheme( + int(widget.winId()), dark, globalconfig["WindowBackdrop"] + ) + def aa(self): class WindowEventFilter(QObject): def eventFilter(_, obj, event): @@ -727,18 +735,12 @@ class MAINUI: hwnd = obj.winId() if hwnd: # window create/destroy,when destroy winId is None - if ( - self.currentisdark is not None - and obj.testAttribute(Qt.WA_TranslucentBackground) == False - ): - winsharedutils.SetTheme( - int(obj.winId()), - self.currentisdark, - globalconfig["WindowBackdrop"], - ) + if self.currentisdark is not None: + self.setdarktheme(obj, self.currentisdark) windows.SetProp( int(obj.winId()), "Magpie.ToolWindow", windows.HANDLE(1) ) + self.setshowintab_checked(obj) return False self.currentisdark = None @@ -789,14 +791,101 @@ class MAINUI: except: print_exc() - def mainuiloadafter(self): + def setshowintab_checked(self, widget): + if widget == self.translation_ui: + winsharedutils.showintab(int(widget.winId()), globalconfig["showintab"]) + return + window_flags = widget.windowFlags() + if Qt.FramelessWindowHint & window_flags == Qt.FramelessWindowHint: + return + if isinstance(widget, QMenu): + return + if isinstance(widget, QFrame): + return + winsharedutils.showintab(int(widget.winId()), globalconfig["showintab_sub"]) + def inittray(self): + + trayMenu = QMenu(self.settin_ui) + showAction = QAction( + _TR("&显示"), + trayMenu, + triggered=self.translation_ui.show_, + ) + settingAction = QAction( + qtawesome.icon("fa.gear"), + _TR("&设置"), + trayMenu, + triggered=lambda: self.settin_ui.showsignal.emit(), + ) + quitAction = QAction( + qtawesome.icon("fa.times"), + _TR("&退出"), + trayMenu, + triggered=self.translation_ui.close, + ) + trayMenu.addAction(showAction) + trayMenu.addAction(settingAction) + trayMenu.addSeparator() + trayMenu.addAction(quitAction) + self.translation_ui.tray.setContextMenu(trayMenu) + + def setshowintab(self): + for widget in QApplication.topLevelWidgets(): + self.setshowintab_checked(widget) + + def setcommonstylesheet(self): + + dl = globalconfig["darklight"] + if dl == 0: + dark = False + elif dl == 1: + dark = True + elif dl == 2: + dark = isDark() + darklight = ["light", "dark"][dark] + + self.currentisdark = dark + + for widget in QApplication.topLevelWidgets(): + self.setdarktheme(widget, dark) + style = "" + for _ in (0,): + try: + idx = globalconfig[darklight + "theme"] - int(not dark) + if idx == -1: + break + _fn = static_data["themes"][darklight][idx]["file"] + + if _fn.endswith(".py"): + style = importlib.import_module( + "files.themes." + _fn[:-3] + ).stylesheet() + elif _fn.endswith(".qss"): + with open( + "./files/themes/{}".format(_fn), + "r", + ) as ff: + style = ff.read() + except: + print_exc() + style += ( + "*{font: %spt '" % (globalconfig["settingfontsize"]) + + (globalconfig["settingfonttype"]) + + "' ; }" + ) + self.settin_ui.setStyleSheet(style) + + def mainuiloadafter(self): + self.setshowintab() self.safeloadprocessmodels() self.prepare() self.startxiaoxueguan() self.starthira() self.startoutputer() self.settin_ui = Settin(self.translation_ui) + self.inittray() + self.setcommonstylesheet() self.transhis = gui.transhist.transhist(self.settin_ui) self.startreader() diff --git a/LunaTranslator/LunaTranslator/gui/dialog_memory.py b/LunaTranslator/LunaTranslator/gui/dialog_memory.py index 5f3325b8..1094520c 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_memory.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_memory.py @@ -1,4 +1,4 @@ -from PyQt5.QtWidgets import QPushButton, QVBoxLayout, QFileDialog +from PyQt5.QtWidgets import QPushButton, QFileDialog from PyQt5.QtWidgets import QHBoxLayout, QVBoxLayout, QTextEdit, QWidget from PyQt5.QtGui import QTextCursor @@ -6,7 +6,6 @@ from PyQt5.QtCore import Qt from myutils.config import _TR, globalconfig from gui.usefulwidget import saveposwindow from myutils.wrapper import Singleton_close -from winsharedutils import showintab import os @@ -32,8 +31,6 @@ class dialog_memory(saveposwindow): key="memorydialoggeo", ) self.setWindowTitle(_TR("备忘录")) - if globalconfig["showintab_sub"]: - showintab(int(self.winId()), True) self.gamemd5 = gamemd5 formLayout = QVBoxLayout() # self.showtext = QTextEdit() diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py index 384e9278..ba779f08 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame.py @@ -1,4 +1,4 @@ -import functools, time +import time from datetime import datetime, timedelta from gui.specialwidget import ScrollFlow, chartwidget, lazyscrollflow from PyQt5.QtWidgets import ( @@ -10,20 +10,11 @@ from PyQt5.QtWidgets import ( QLineEdit, QComboBox, QFormLayout, -) -import functools, threading -from traceback import print_exc -from PyQt5.QtWidgets import ( QHBoxLayout, QTableView, QAbstractItemView, QLabel, QTabWidget, -) -import windows -from PyQt5.QtCore import QRect, QSize, Qt, pyqtSignal, QObject -import os -from PyQt5.QtWidgets import ( QApplication, QSizePolicy, QWidget, @@ -31,6 +22,11 @@ from PyQt5.QtWidgets import ( QAction, QTabBar, ) +import functools, threading +from traceback import print_exc +import windows +from PyQt5.QtCore import QRect, QSize, Qt, pyqtSignal, QObject +import os from PyQt5.QtGui import ( QCloseEvent, QIntValidator, @@ -38,8 +34,9 @@ from PyQt5.QtGui import ( QPixmap, QPainter, QPen, + QStandardItem, + QStandardItemModel, ) -from PyQt5.QtCore import Qt from gui.usefulwidget import ( getsimplecombobox, getspinbox, @@ -48,11 +45,7 @@ from gui.usefulwidget import ( getspinbox, selectcolor, ) -from PyQt5.QtCore import QRect, QSize, Qt, pyqtSignal import os -from winsharedutils import showintab -from PyQt5.QtGui import QStandardItem, QStandardItemModel -from PyQt5.QtCore import Qt, QSize from myutils.config import savehook_new_list, savehook_new_data, vndbtagdata from myutils.hwnd import getExeIcon import gobject @@ -1462,6 +1455,7 @@ class dialog_savedgame_new(saveposwindow): if path.lower().endswith(".exe") == False: continue if path not in savehook_new_list: + checkifnewgame(path) self.newline(path, True) def clicked3(self): @@ -1472,6 +1466,7 @@ class dialog_savedgame_new(saveposwindow): if res != "": res = res.replace("/", "\\") if res not in savehook_new_list: + checkifnewgame(res) self.newline(res, True) def tagschanged(self, tags): @@ -1568,8 +1563,6 @@ class dialog_savedgame_new(saveposwindow): global _global_dialog_savedgame_new _global_dialog_savedgame_new = self self.setWindowTitle(_TR("游戏管理")) - if globalconfig["showintab_sub"]: - showintab(int(self.winId()), True) formLayout = QVBoxLayout() layout = QHBoxLayout() @@ -1728,7 +1721,6 @@ class dialog_savedgame_new(saveposwindow): return gameitem def newline(self, k, first=False): - checkifnewgame(k) itemw = globalconfig["dialog_savegame_layout"]["itemw"] itemh = globalconfig["dialog_savegame_layout"]["itemh"] diff --git a/LunaTranslator/LunaTranslator/gui/edittext.py b/LunaTranslator/LunaTranslator/gui/edittext.py index b547eb04..62887978 100644 --- a/LunaTranslator/LunaTranslator/gui/edittext.py +++ b/LunaTranslator/LunaTranslator/gui/edittext.py @@ -1,4 +1,4 @@ -from PyQt5.QtCore import Qt +from PyQt5.QtGui import QCursor from PyQt5.QtWidgets import ( QPlainTextEdit, QAction, @@ -90,7 +90,7 @@ class edittext(closeashidewindow): menu = QMenu(self.textOutput) qingkong = QAction(_TR("清空")) menu.addAction(qingkong) - action = menu.exec(self.mapToGlobal(self.textOutput.pos()) + point) + action = menu.exec(QCursor.pos()) if action == qingkong: self.textOutput.clear() diff --git a/LunaTranslator/LunaTranslator/gui/rangeselect.py b/LunaTranslator/LunaTranslator/gui/rangeselect.py index a784c15d..c4963b1c 100644 --- a/LunaTranslator/LunaTranslator/gui/rangeselect.py +++ b/LunaTranslator/LunaTranslator/gui/rangeselect.py @@ -1,16 +1,12 @@ from PyQt5.QtWidgets import ( QMenu, - QApplication, QMainWindow, QLabel, QAction, - QDialog, - QDesktopWidget, ) -from PyQt5.QtGui import QPainter, QPen, QColor, QResizeEvent -from PyQt5.QtCore import Qt, QPoint, QRect, QEvent +from PyQt5.QtGui import QPainter, QPen, QColor, QCursor +from PyQt5.QtCore import Qt, QPoint, QRect from myutils.config import _TR -import gobject from myutils.config import globalconfig from gui.resizeablemainwindow import Mainw import windows, winsharedutils @@ -38,7 +34,7 @@ class rangeadjust(Mainw): menu = QMenu(self) close = QAction(_TR("关闭")) menu.addAction(close) - action = menu.exec(self.mapToGlobal(p)) + action = menu.exec(QCursor.pos()) if action == close: self._rect = None self.close() diff --git a/LunaTranslator/LunaTranslator/gui/selecthook.py b/LunaTranslator/LunaTranslator/gui/selecthook.py index 8c0101e6..f030e3d8 100644 --- a/LunaTranslator/LunaTranslator/gui/selecthook.py +++ b/LunaTranslator/LunaTranslator/gui/selecthook.py @@ -716,6 +716,9 @@ class hookselect(closeashidewindow): self.changeprocessclear() def showmenu(self, p: QPoint): + r = self.tttable.currentIndex().row() + if r < 0: + return menu = QMenu(self.tttable) remove = QAction(_TR("移除")) copy = QAction(_TR("复制特殊码")) @@ -723,9 +726,6 @@ class hookselect(closeashidewindow): menu.addAction(copy) action = menu.exec(self.tttable.cursor().pos()) - r = self.tttable.currentIndex().row() - if r < 0: - return hc, hn, tp = self.save[r] if action == remove: pid = tp.processId diff --git a/LunaTranslator/LunaTranslator/gui/settin.py b/LunaTranslator/LunaTranslator/gui/settin.py index 2634d080..e376925d 100644 --- a/LunaTranslator/LunaTranslator/gui/settin.py +++ b/LunaTranslator/LunaTranslator/gui/settin.py @@ -1,26 +1,18 @@ -from PyQt5.QtCore import pyqtSignal, Qt, QSize, QObject, QEvent +from PyQt5.QtCore import pyqtSignal, Qt, QSize from PyQt5.QtWidgets import ( - QLabel, - QScrollArea, QWidget, - QGridLayout, - QVBoxLayout, QListWidget, QHBoxLayout, QListWidgetItem, QMenu, QAction, - QApplication, ) -from PyQt5.QtGui import QResizeEvent, QFont, QFontMetrics +from PyQt5.QtGui import QFont, QFontMetrics from PyQt5.QtWidgets import QTabWidget -import qtawesome, gobject, importlib, sys -import functools, threading, windows, winsharedutils -from traceback import print_exc -from winsharedutils import isDark +import qtawesome, gobject +import threading, windows, winsharedutils from myutils.config import globalconfig, _TR from myutils.utils import wavmp3player -from myutils.config import static_data from gui.settingpage1 import setTabOne, setTabOne_direct from gui.settingpage2 import setTabTwo, settab2d from gui.settingpage_xianshishezhi import setTabThree, setTabThree_direct @@ -31,11 +23,7 @@ from gui.setting_lang import setTablang, setTablangd from gui.setting_proxy import setTab_proxy from gui.settingpage7 import setTab7, settab7direct from gui.settingpage_about import setTab_about, setTab_about_dicrect -from gui.usefulwidget import closeashidewindow, tabadd_lazy - - -class gridwidget(QWidget): - pass +from gui.usefulwidget import closeashidewindow, makesubtab_lazy class TabWidget(QWidget): @@ -89,60 +77,7 @@ class Settin(closeashidewindow): showandsolvesig = pyqtSignal(str) setstylesheetsignal = pyqtSignal() - def resizefunction(self): - ww = self.size().width() - self.list_width - 30 - for w in self.needfitwidgets: - w.setFixedWidth(int(ww)) - for grid, maxl in self.needfitcols: - for c in range(maxl): - grid.setColumnMinimumWidth( - c, - int(ww / maxl), - ) - - def resizeEvent(self, a0: QResizeEvent) -> None: - - self.resizefunction() - return super().resizeEvent(a0) - - def automakegrid(self, grid, lis, save=False, savelist=None): - maxl = 0 - - for nowr, line in enumerate(lis): - nowc = 0 - if save: - ll = [] - for i in line: - if type(i) == str: - cols = 1 - wid = QLabel(_TR(i)) - elif type(i) != tuple: - wid, cols = i, 1 - elif len(i) == 2: - - wid, cols = i - if type(wid) == str: - wid = QLabel(_TR(wid)) - elif len(i) == 3: - wid, cols, arg = i - if type(wid) == str: - wid = QLabel((wid)) - if arg == "link": - wid.setOpenExternalLinks(True) - grid.addWidget(wid, nowr, nowc, 1, cols) - if save: - ll.append(wid) - nowc += cols - maxl = max(maxl, nowc) - if save: - savelist.append(ll) - - grid.setRowMinimumHeight(nowr, 35) - self.needfitcols.append([grid, maxl]) - def __init__(self, parent): - self.needfitwidgets = [] - self.needfitcols = [] super(Settin, self).__init__(parent, globalconfig, "setting_geo_2") # self.setWindowFlag(Qt.Tool,False) # self.setWindowFlags(self.windowFlags()&~Qt.WindowMinimizeButtonHint) @@ -158,7 +93,6 @@ class Settin(closeashidewindow): self.hooks = [] self.usevoice = 0 - self.inittray() setTabOne_direct(self) settab2d(self) settab7direct(self) @@ -168,14 +102,13 @@ class Settin(closeashidewindow): setTablangd(self) setTab_about_dicrect(self) - self.setstylesheet() - self.setstylesheetsignal.connect(self.setstylesheet) + self.setstylesheetsignal.connect(gobject.baseobject.setcommonstylesheet) threading.Thread(target=self.darklistener).start() self.setWindowTitle(_TR("设置")) self.setWindowIcon(qtawesome.icon("fa.gear")) - self.tab_widget = self.makesubtab_lazy(klass=TabWidget) + self.tab_widget = makesubtab_lazy(klass=TabWidget) self.setCentralWidget(self.tab_widget) self.tab_widget.setStyleSheet( @@ -209,28 +142,6 @@ class Settin(closeashidewindow): self.tab_widget.list_widget.setFixedWidth(width) self.list_width = width - def inittray(self): - - showAction = QAction( - _TR("&显示"), - self, - triggered=gobject.baseobject.translation_ui.show_, - ) - settingAction = QAction( - _TR("&设置"), - self, - triggered=lambda: gobject.baseobject.settin_ui.showsignal.emit(), - ) - quitAction = QAction( - _TR("&退出"), self, triggered=gobject.baseobject.translation_ui.close - ) - self.trayMenu = QMenu(self) - self.trayMenu.addAction(showAction) - self.trayMenu.addAction(settingAction) - self.trayMenu.addSeparator() - self.trayMenu.addAction(quitAction) - gobject.baseobject.translation_ui.tray.setContextMenu(self.trayMenu) - def opensolvetextfun(self): self.show() self.tab_widget.setCurrentIndex(3) @@ -243,114 +154,3 @@ class Settin(closeashidewindow): if globalconfig["darklight"] == 2: self.setstylesheetsignal.emit() windows.WaitForSingleObject(sema, windows.INFINITE) - - def setstylesheet(self): - - dl = globalconfig["darklight"] - if dl == 0: - dark = False - elif dl == 1: - dark = True - elif dl == 2: - dark = isDark() - darklight = ["light", "dark"][dark] - - gobject.baseobject.currentisdark = dark - - for widget in QApplication.topLevelWidgets(): - if widget.testAttribute(Qt.WA_TranslucentBackground): - continue - winsharedutils.SetTheme( - int(widget.winId()), dark, globalconfig["WindowBackdrop"] - ) - style = "" - for _ in (0,): - try: - idx = globalconfig[darklight + "theme"] - int(not dark) - if idx == -1: - break - _fn = static_data["themes"][darklight][idx]["file"] - - if _fn.endswith(".py"): - style = importlib.import_module( - "files.themes." + _fn[:-3] - ).stylesheet() - elif _fn.endswith(".qss"): - with open( - "./files/themes/{}".format(_fn), - "r", - ) as ff: - style = ff.read() - except: - print_exc() - style = "" - style += ( - "*{font: %spt '" % (globalconfig["settingfontsize"]) - + (globalconfig["settingfonttype"]) - + "' ; }" - ) - self.setStyleSheet(style) - - def makevbox(self, wids): - q = QWidget() - v = QVBoxLayout() - q.setLayout(v) - v.setContentsMargins(0, 0, 0, 0) - for wid in wids: - v.addWidget(wid) - return q - - def makegrid(self, grid, save=False, savelist=None, savelay=None): - - gridlayoutwidget = gridwidget() - gridlay = QGridLayout() - gridlayoutwidget.setLayout(gridlay) - gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}") - self.needfitwidgets.append(gridlayoutwidget) - gridlayoutwidget.setFixedHeight(len(grid) * 35) - margins = gridlay.contentsMargins() - gridlay.setContentsMargins(margins.left(), 0, margins.right(), 0) - self.automakegrid(gridlay, grid, save, savelist) - if save: - savelay.append(gridlay) - return gridlayoutwidget - - def makescroll(self, widget): - scroll = QScrollArea() - scroll.setHorizontalScrollBarPolicy(1) - scroll.setStyleSheet("""QScrollArea{background-color:transparent;border:0px}""") - - self.needfitwidgets.append(widget) - scroll.setWidget(widget) - return scroll - - def makesubtab(self, titles, widgets): - tab = QTabWidget() - for i, wid in enumerate(widgets): - tab.addTab(wid, _TR(titles[i])) - return tab - - def makesubtab_lazy(self, titles=None, functions=None, klass=None): - if klass: - tab = klass() - else: - tab = QTabWidget() - - def __(t, i): - try: - w = t.currentWidget() - if "lazyfunction" in dir(w): - w.lazyfunction() - delattr(w, "lazyfunction") - self.resizefunction() - except: - print_exc() - - tab.currentChanged.connect(functools.partial(__, tab)) - if titles and functions: - for i, func in enumerate(functions): - self.tabadd_lazy(tab, titles[i], func) - return tab - - def tabadd_lazy(self, tab, title, getrealwidgetfunction): - tabadd_lazy(tab, title, getrealwidgetfunction) diff --git a/LunaTranslator/LunaTranslator/gui/setting_lang.py b/LunaTranslator/LunaTranslator/gui/setting_lang.py index eb52861c..e8ef04ef 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_lang.py +++ b/LunaTranslator/LunaTranslator/gui/setting_lang.py @@ -1,10 +1,16 @@ import os -from myutils.config import globalconfig, _TRL, static_data,getlanguse -from gui.usefulwidget import getsimplecombobox, getcolorbutton +from myutils.config import globalconfig, _TRL, static_data, getlanguse +from gui.usefulwidget import ( + getsimplecombobox, + getcolorbutton, + makegrid, + tabadd_lazy, + makescroll, +) def setTablang(self): - self.tabadd_lazy(self.tab_widget, ("语言设置"), lambda: setTablanglz(self)) + tabadd_lazy(self.tab_widget, ("语言设置"), lambda: setTablanglz(self)) def setTablangd(self): @@ -45,9 +51,7 @@ def setTablanglz(self): globalconfig, "", callback=lambda: os.startfile( - os.path.abspath( - "./files/lang/{}.json".format(getlanguse()) - ) + os.path.abspath("./files/lang/{}.json".format(getlanguse())) ), icon="fa.gear", constcolor="#FF69B4", @@ -58,7 +62,7 @@ def setTablanglz(self): [], ] - gridlayoutwidget = self.makegrid(grids) - gridlayoutwidget = self.makescroll(gridlayoutwidget) + gridlayoutwidget = makegrid(grids) + gridlayoutwidget = makescroll(gridlayoutwidget) return gridlayoutwidget diff --git a/LunaTranslator/LunaTranslator/gui/setting_proxy.py b/LunaTranslator/LunaTranslator/gui/setting_proxy.py index 4f83da70..d7e9c1e7 100644 --- a/LunaTranslator/LunaTranslator/gui/setting_proxy.py +++ b/LunaTranslator/LunaTranslator/gui/setting_proxy.py @@ -2,7 +2,14 @@ from PyQt5.QtWidgets import QLineEdit, QPushButton from myutils.config import _TR from myutils.config import globalconfig from myutils.utils import splittranslatortypes -from gui.usefulwidget import getsimpleswitch +from gui.usefulwidget import ( + getsimpleswitch, + makegrid, + makesubtab_lazy, + tabadd_lazy, + makevbox, + makescroll, +) import os @@ -77,18 +84,18 @@ def setTab_proxy_lazy(self): item="ocr", name="./Lunatranslator/ocrengines/%s.py", ) - tab = self.makesubtab_lazy( + tab = makesubtab_lazy( ["在线翻译", "注册在线翻译", "在线OCR"], [ - lambda: self.makescroll(self.makegrid(mianfei)), - lambda: self.makescroll(self.makegrid(shoufei)), - lambda: self.makescroll(self.makegrid(ocrs)), + lambda: makescroll(makegrid(mianfei)), + lambda: makescroll(makegrid(shoufei)), + lambda: makescroll(makegrid(ocrs)), ], ) - gridlayoutwidget = self.makegrid(grid1) - return self.makevbox([gridlayoutwidget, tab]) + gridlayoutwidget = makegrid(grid1) + return makevbox([gridlayoutwidget, tab]) def setTab_proxy(self): - self.tabadd_lazy(self.tab_widget, ("代理设置"), lambda: setTab_proxy_lazy(self)) + tabadd_lazy(self.tab_widget, ("代理设置"), lambda: setTab_proxy_lazy(self)) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage1.py b/LunaTranslator/LunaTranslator/gui/settingpage1.py index 73739c33..77b6231f 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage1.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage1.py @@ -19,9 +19,14 @@ from gui.inputdialog import regexedit from gui.usefulwidget import ( getsimplecombobox, getspinbox, + makescroll, getcolorbutton, + makegrid, + tabadd_lazy, yuitsu_switch, + makevbox, getsimpleswitch, + makesubtab_lazy, ) from gui.codeacceptdialog import codeacceptdialog from myutils.utils import makehtml, getfilemd5 @@ -507,21 +512,21 @@ def setTabOne_direct(self): def setTabOne(self): - self.tabadd_lazy(self.tab_widget, ("文本输入"), lambda: setTabOne_lazy(self)) + tabadd_lazy(self.tab_widget, ("文本输入"), lambda: setTabOne_lazy(self)) def setTabOne_lazy(self): - tab = self.makesubtab_lazy( + tab = makesubtab_lazy( ["HOOK设置", "OCR设置", "剪贴板", "内嵌翻译", "文本输出"], [ - lambda: self.makescroll(self.makegrid(gethookgrid(self))), - lambda: self.makescroll(self.makegrid(getocrgrid(self))), - lambda: self.makescroll(self.makegrid(getTabclip(self))), - lambda: self.makescroll(self.makegrid(gethookembedgrid(self))), - lambda: self.makescroll(self.makegrid(outputgrid(self))), + lambda: makescroll(makegrid(gethookgrid(self))), + lambda: makescroll(makegrid(getocrgrid(self))), + lambda: makescroll(makegrid(getTabclip(self))), + lambda: makescroll(makegrid(gethookembedgrid(self))), + lambda: makescroll(makegrid(outputgrid(self))), ], ) - gridlayoutwidget = self.makegrid(self.tab1grids) - return self.makevbox([gridlayoutwidget, tab]) + gridlayoutwidget = makegrid(self.tab1grids) + return makevbox([gridlayoutwidget, tab]) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage2.py b/LunaTranslator/LunaTranslator/gui/settingpage2.py index 3fe4c84c..73eac3c3 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage2.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage2.py @@ -8,7 +8,17 @@ from myutils.config import globalconfig, _TR from myutils.utils import selectdebugfile, splittranslatortypes, checkportavailable import os, time, requests, threading from gui.inputdialog import autoinitdialog, autoinitdialog_items -from gui.usefulwidget import getspinbox, getcolorbutton, getsimpleswitch, selectcolor +from gui.usefulwidget import ( + getspinbox, + getcolorbutton, + getsimpleswitch, + selectcolor, + makegrid, + makesubtab_lazy, + makescroll, + makevbox, + tabadd_lazy, +) import time, hashlib @@ -94,7 +104,7 @@ def initsome11(self, l, label=None): def setTabTwo(self): - self.tabadd_lazy(self.tab_widget, ("翻译设置"), lambda: setTabTwo_lazy(self)) + tabadd_lazy(self.tab_widget, ("翻译设置"), lambda: setTabTwo_lazy(self)) def settab2d(self): @@ -245,16 +255,16 @@ def setTabTwo_lazy(self): developgrid += initsome11(self, develop) online_reg_grid += initsome11(self, shoufei) pretransgrid += initsome11(self, pre) - tab = self.makesubtab_lazy( + tab = makesubtab_lazy( ["在线翻译", "develop", "注册在线翻译", "离线翻译", "预翻译"], [ - lambda: self.makescroll(self.makegrid(onlinegrid)), - lambda: self.makescroll(self.makegrid(developgrid)), - lambda: self.makescroll(self.makegrid(online_reg_grid)), - lambda: self.makescroll(self.makegrid(offlinegrid)), - lambda: self.makescroll(self.makegrid(pretransgrid)), + lambda: makescroll(makegrid(onlinegrid)), + lambda: makescroll(makegrid(developgrid)), + lambda: makescroll(makegrid(online_reg_grid)), + lambda: makescroll(makegrid(offlinegrid)), + lambda: makescroll(makegrid(pretransgrid)), ], ) - gridlayoutwidget = self.makegrid(grids) - return self.makevbox([gridlayoutwidget, tab]) + gridlayoutwidget = makegrid(grids) + return makevbox([gridlayoutwidget, tab]) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage7.py b/LunaTranslator/LunaTranslator/gui/settingpage7.py index 16d00256..2a7d8fd4 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage7.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage7.py @@ -17,7 +17,15 @@ from myutils.config import ( _TR, ) import functools, gobject -from gui.usefulwidget import getcolorbutton, getsimpleswitch +from gui.usefulwidget import ( + getcolorbutton, + getsimpleswitch, + makevbox, + makescroll, + makegrid, + makesubtab_lazy, + tabadd_lazy, +) from gui.codeacceptdialog import codeacceptdialog from gui.inputdialog import ( postconfigdialog, @@ -73,7 +81,7 @@ def settab7direct(self): def setTab7(self): - self.tabadd_lazy(self.tab_widget, ("文本处理"), lambda: setTab7_lazy(self)) + tabadd_lazy(self.tab_widget, ("文本处理"), lambda: setTab7_lazy(self)) def getcomparelayout(self): @@ -229,9 +237,10 @@ def setTab7_lazy(self): constcolor="#FF69B4", ) ) + grids2 += [[("", 12)]] def __(): - _w = self.makescroll(self.makegrid(grids, True, savelist, savelay)) + _w = makescroll(makegrid(grids, True, savelist, savelay)) _w.setContextMenuPolicy(Qt.CustomContextMenu) def showmenu(p: QPoint): @@ -251,9 +260,9 @@ def setTab7_lazy(self): _w.customContextMenuRequested.connect(showmenu) return _w - tab = self.makesubtab_lazy( + tab = makesubtab_lazy( ["文本预处理", "翻译优化"], - [lambda: __(), lambda: self.makescroll(self.makegrid(grids2))], + [lambda: __(), lambda: makescroll(makegrid(grids2))], ) - return self.makevbox([tab, self.comparelayout]) + return makevbox([tab, self.comparelayout]) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_about.py b/LunaTranslator/LunaTranslator/gui/settingpage_about.py index ccf324fc..eb68cc08 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_about.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_about.py @@ -1,7 +1,14 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QPixmap, QImage -from PyQt5.QtWidgets import QWidget, QLabel, QProgressBar -from gui.usefulwidget import getsimpleswitch, getsimplecombobox +from PyQt5.QtWidgets import QLabel, QProgressBar +from gui.usefulwidget import ( + getsimpleswitch, + getsimplecombobox, + makegrid, + makescroll, + makesubtab_lazy, + tabadd_lazy, +) from myutils.config import globalconfig, _TR, static_data from myutils.wrapper import threader import platform, winsharedutils, sys @@ -64,11 +71,11 @@ def setTab_about_dicrect(self): def setTab_about(self): - self.tabadd_lazy(self.tab_widget, ("其他设置"), lambda: setTab_aboutlazy(self)) + tabadd_lazy(self.tab_widget, ("其他设置"), lambda: setTab_aboutlazy(self)) def double_(self, grid): - return self.makescroll(self.makegrid(grid)) + return makescroll(makegrid(grid)) def resourcegrid(self): @@ -98,7 +105,7 @@ def resourcegrid(self): __ = True grid.append([(_TR(name), 1, ""), (makehtml(link, __), 2, "link")]) makewidgetsfunctions.append(partial(double_, self, grid)) - return self.makesubtab_lazy(titles, makewidgetsfunctions) + return makesubtab_lazy(titles, makewidgetsfunctions) def setTab_aboutlazy(self): @@ -149,8 +156,19 @@ def setTab_aboutlazy(self): (makehtml("https://qm.qq.com/q/qE32v9NYBO", show=912525396), 3, "link"), ], [], - [("如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~", 4)], + [("如果你感觉该软件对你有帮助,欢迎微信扫码赞助,谢谢~", 0)], ] + lb = QLabel(self) + img = QPixmap.fromImage(QImage("./files/zan.jpg")) + img.setDevicePixelRatio(self.devicePixelRatioF()) + img = img.scaled( + 600, + 600, + Qt.KeepAspectRatio, + Qt.SmoothTransformation, + ) + lb.setPixmap(img) + shuominggrid += [[(lb, 0)]] else: shuominggrid += [ [], @@ -169,41 +187,15 @@ def setTab_aboutlazy(self): ) ], ] - tab = self.makesubtab_lazy( + + tab = makesubtab_lazy( ["相关说明", "其他设置", "资源下载"], [ - lambda: self.makevbox( - [ - self.makegrid(shuominggrid), - ( - imgwidget("./files/zan.jpg") - if globalconfig["languageuse"] == 0 - else QLabel() - ), - ] + lambda: makescroll( + makegrid(shuominggrid), ), - lambda: self.makescroll(self.makegrid(grid2)), + lambda: makescroll(makegrid(grid2)), lambda: resourcegrid(self), ], ) return tab - - -class imgwidget(QWidget): - def __init__(self, src) -> None: - super().__init__() - self.lb = QLabel(self) - rate = self.devicePixelRatioF() - self.img = QPixmap.fromImage(QImage(src)) - self.img.setDevicePixelRatio(rate) - - def paintEvent(self, a0) -> None: - self.lb.resize(self.size()) - self.lb.setPixmap( - self.img.scaled( - self.size() * self.devicePixelRatioF(), - Qt.KeepAspectRatio, - Qt.SmoothTransformation, - ) - ) - return super().paintEvent(a0) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_cishu.py b/LunaTranslator/LunaTranslator/gui/settingpage_cishu.py index ae7ce656..a149e318 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_cishu.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_cishu.py @@ -4,6 +4,9 @@ from gui.inputdialog import autoinitdialog, autoinitdialog_items from gui.usefulwidget import ( getcolorbutton, yuitsu_switch, + makescroll, + makegrid, + tabadd_lazy, getsimpleswitch, getsimplecombobox, ) @@ -11,7 +14,7 @@ import gobject def setTabcishu(self): - self.tabadd_lazy(self.tab_widget, ("辞书设置"), lambda: setTabcishu_l(self)) + tabadd_lazy(self.tab_widget, ("辞书设置"), lambda: setTabcishu_l(self)) def gethiragrid(self): @@ -171,7 +174,7 @@ def setTabcishu_l(self): (getsimpleswitch(globalconfig, "searchwordusewebview"), 1), ], ) - gridlayoutwidget = self.makegrid(grids) - gridlayoutwidget = self.makescroll(gridlayoutwidget) + gridlayoutwidget = makegrid(grids) + gridlayoutwidget = makescroll(gridlayoutwidget) return gridlayoutwidget diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_quick.py b/LunaTranslator/LunaTranslator/gui/settingpage_quick.py index d3f66aed..e14f5949 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_quick.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_quick.py @@ -1,11 +1,16 @@ import functools -from myutils.config import globalconfig, static_data, _TR +from myutils.config import globalconfig, _TR from myutils.winsyshotkey import SystemHotkey, registerException -from PyQt5.QtGui import QKeySequence import winsharedutils import gobject, windows from PyQt5.QtWidgets import QLabel -from gui.usefulwidget import getsimpleswitch, getsimplekeyseq +from gui.usefulwidget import ( + getsimpleswitch, + getsimplekeyseq, + makegrid, + tabadd_lazy, + makescroll, +) from myutils.hwnd import grabwindow from myutils.utils import getimageformat, parsekeystringtomodvkcode, unsupportkey @@ -58,7 +63,7 @@ def setTab_quick_direct(self): def setTab_quick(self): - self.tabadd_lazy(self.tab_widget, ("快捷按键"), lambda: setTab_quick_lazy(self)) + tabadd_lazy(self.tab_widget, ("快捷按键"), lambda: setTab_quick_lazy(self)) def setTab_quick_lazy(self): @@ -97,8 +102,8 @@ def setTab_quick_lazy(self): (self.referlabels[name], 4), ] ) - gridlayoutwidget = self.makegrid(grids) - gridlayoutwidget = self.makescroll(gridlayoutwidget) + gridlayoutwidget = makegrid(grids) + gridlayoutwidget = makescroll(gridlayoutwidget) return gridlayoutwidget # self.yitiaolong("快捷按键",grids) diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_tts.py b/LunaTranslator/LunaTranslator/gui/settingpage_tts.py index 3870b1ce..86e8ace2 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_tts.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_tts.py @@ -8,7 +8,10 @@ import gobject from gui.usefulwidget import ( getsimplecombobox, getspinbox, + makegrid, + makescroll, getcolorbutton, + tabadd_lazy, yuitsu_switch, getsimpleswitch, ) @@ -21,7 +24,7 @@ def setTab5_direct(self): def setTab5(self): - self.tabadd_lazy(self.tab_widget, ("语音合成"), lambda: setTab5lz(self)) + tabadd_lazy(self.tab_widget, ("语音合成"), lambda: setTab5lz(self)) def getttsgrid(self): @@ -147,8 +150,8 @@ def setTab5lz(self): ), ], ] - gridlayoutwidget = self.makegrid(grids) - gridlayoutwidget = self.makescroll(gridlayoutwidget) + gridlayoutwidget = makegrid(grids) + gridlayoutwidget = makescroll(gridlayoutwidget) return gridlayoutwidget diff --git a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py index 65b6404f..15c99dd4 100644 --- a/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py +++ b/LunaTranslator/LunaTranslator/gui/settingpage_xianshishezhi.py @@ -1,10 +1,9 @@ import functools -from PyQt5.QtCore import Qt from PyQt5.QtGui import QFont -from PyQt5.QtWidgets import QTableView, QAbstractItemView, QLabel, QVBoxLayout -from PyQt5.QtWidgets import QDialog, QVBoxLayout, QHeaderView -from PyQt5.QtCore import Qt, QSize +from PyQt5.QtWidgets import QTableView, QAbstractItemView +from PyQt5.QtWidgets import QHeaderView +from PyQt5.QtCore import Qt from PyQt5.QtGui import QStandardItem, QStandardItemModel from PyQt5.QtWidgets import QLabel, QSlider, QFontComboBox, QDialog, QGridLayout @@ -16,8 +15,13 @@ from winsharedutils import showintab from gui.inputdialog import getsomepath1 from gui.usefulwidget import ( getsimplecombobox, + makegrid, getspinbox, + tabadd_lazy, + makescroll, + makevbox, getcolorbutton, + makesubtab_lazy, getsimpleswitch, selectcolor, ) @@ -51,110 +55,74 @@ def setTabThree_direct(self): def setTabThree(self): - self.tabadd_lazy(self.tab_widget, ("显示设置"), lambda: setTabThree_lazy(self)) + tabadd_lazy(self.tab_widget, ("显示设置"), lambda: setTabThree_lazy(self)) def createbuttonwidget(self): + # return table + grids = [["显示", "", "", "对齐", "图标", "图标2", "说明"]] + sortlist = globalconfig["toolbutton"]["rank2"] + savelist = [] + savelay = [] - model = QStandardItemModel() - model.setHorizontalHeaderLabels( - _TRL(["显示", "", "", "对齐", "图标", "图标2", "说明"]) - ) + def changerank(item, up): - table = QTableView() - - table.horizontalHeader().setSectionResizeMode(QHeaderView.ResizeToContents) - table.horizontalHeader().setStretchLastSection(True) - table.setEditTriggers(QAbstractItemView.NoEditTriggers) - table.setSelectionBehavior(QAbstractItemView.SelectRows) - table.setSelectionMode((QAbstractItemView.SingleSelection)) - table.setWordWrap(False) - table.setModel(model) - - def changerank2(key, up): - idx = globalconfig["toolbutton"]["rank2"].index(key) + idx = sortlist.index(item) idx2 = idx + (-1 if up else 1) - if idx2 < 0 or idx2 >= len(globalconfig["toolbutton"]["rank2"]): + if idx2 < 0 or idx2 >= len(sortlist): return + headoffset = 1 idx2 = idx + (-1 if up else 1) - ( - globalconfig["toolbutton"]["rank2"][idx], - globalconfig["toolbutton"]["rank2"][idx2], - ) = ( - globalconfig["toolbutton"]["rank2"][idx2], - globalconfig["toolbutton"]["rank2"][idx], - ) + sortlist[idx], sortlist[idx2] = sortlist[idx2], sortlist[idx] + for i, ww in enumerate(savelist[idx + headoffset]): - model.removeRow(idx2) - newline(idx, globalconfig["toolbutton"]["rank2"][idx]), + w1 = savelay[0].indexOf(ww) + w2 = savelay[0].indexOf(savelist[idx2 + headoffset][i]) + p1 = savelay[0].getItemPosition(w1) + p2 = savelay[0].getItemPosition(w2) + savelay[0].removeWidget(ww) + savelay[0].removeWidget(savelist[idx2 + headoffset][i]) + + savelay[0].addWidget(savelist[idx2 + headoffset][i], *p1) + savelay[0].addWidget(ww, *p2) + savelist[idx + headoffset], savelist[idx2 + headoffset] = ( + savelist[idx2 + headoffset], + savelist[idx + headoffset], + ) gobject.baseobject.translation_ui.adjustbuttons() - def newline(row, k): - if "belong" in globalconfig["toolbutton"]["buttons"][k]: - belong = ( - "(" - + _TR("仅") - + " ".join(globalconfig["toolbutton"]["buttons"][k]["belong"]) - + ")" - ) - else: - belong = "" - model.insertRow( - row, - [ - QStandardItem(), - QStandardItem(), - QStandardItem(), - QStandardItem(), - QStandardItem(), - QStandardItem(), - QStandardItem( - _TR(globalconfig["toolbutton"]["buttons"][k]["tip"]) + " " + belong - ), - ], - ) - table.setIndexWidget( - model.index(row, 0), - getsimpleswitch( - globalconfig["toolbutton"]["buttons"][k], - "use", - callback=lambda _: gobject.baseobject.translation_ui.adjustbuttons(), - ), - ) + for i, k in enumerate(sortlist): + button_up = getcolorbutton( globalconfig, "", - callback=functools.partial(changerank2, k, True), + callback=functools.partial(changerank, k, True), icon="fa.arrow-up", constcolor="#FF69B4", ) button_down = getcolorbutton( globalconfig, "", - callback=functools.partial(changerank2, k, False), + callback=functools.partial(changerank, k, False), icon="fa.arrow-down", constcolor="#FF69B4", ) - table.setIndexWidget( - model.index(row, 1), - button_up, - ) - table.setIndexWidget( - model.index(row, 2), - button_down, - ) - table.setIndexWidget( - model.index(row, 3), + l = [ + getsimpleswitch( + globalconfig["toolbutton"]["buttons"][k], + "use", + callback=lambda _: gobject.baseobject.translation_ui.adjustbuttons(), + ), + button_up, + button_down, getsimplecombobox( _TRL(["居左", "居右", "居中"]), globalconfig["toolbutton"]["buttons"][k], "align", callback=lambda _: gobject.baseobject.translation_ui.adjustbuttons(), + fixedsize=True, ), - ) - table.setIndexWidget( - model.index(row, 4), getcolorbutton( "", "", @@ -166,10 +134,9 @@ def createbuttonwidget(self): color=globalconfig["buttoncolor"], ), ), - ) + ] if "icon2" in globalconfig["toolbutton"]["buttons"][k]: - table.setIndexWidget( - model.index(row, 5), + l.append( getcolorbutton( "", "", @@ -182,11 +149,20 @@ def createbuttonwidget(self): ), ), ) - - for row, k in enumerate(globalconfig["toolbutton"]["rank2"]): - newline(row, k) - - return table + else: + l.append("") + if "belong" in globalconfig["toolbutton"]["buttons"][k]: + belong = ( + "_" + + "仅" + + "_" + + " ".join(globalconfig["toolbutton"]["buttons"][k]["belong"]) + ) + else: + belong = "" + l.append(globalconfig["toolbutton"]["buttons"][k]["tip"] + belong) + grids.append(l) + return makescroll(makegrid(grids, True, savelist, savelay)) @Singleton @@ -268,7 +244,7 @@ def setTabThree_lazy(self): def callback(x): globalconfig.__setitem__("settingfonttype", x) - self.setstylesheet() + gobject.baseobject.setcommonstylesheet() self.sfont_comboBox.activated[str].connect(callback) self.sfont_comboBox.setCurrentFont(QFont(globalconfig["settingfonttype"])) @@ -437,14 +413,6 @@ def setTabThree_lazy(self): ], ] - def __changefontsize(x): - self.setstylesheet() - self.resizefunction() - - def __changeshowintab(x): - gobject.baseobject.translation_ui.showintab = x - showintab(int(gobject.baseobject.translation_ui.winId()), x) - def themelist(t): return [_["name"] for _ in static_data["themes"][t]] @@ -474,10 +442,21 @@ def setTabThree_lazy(self): (getspinbox(1, 100, globalconfig, "disappear_delay"), 2), ], [ - ("任务栏中显示", 6), - getsimpleswitch(globalconfig, "showintab", callback=__changeshowintab), + ("任务栏中显示_翻译窗口", 6), + getsimpleswitch( + globalconfig, + "showintab", + callback=lambda _: gobject.baseobject.setshowintab(), + ), + ], + [ + ("任务栏中显示_其他", 6), + getsimpleswitch( + globalconfig, + "showintab_sub", + callback=lambda _: gobject.baseobject.setshowintab(), + ), ], - [("子窗口任务栏中显示", 6), getsimpleswitch(globalconfig, "showintab_sub")], [ ("选择文本窗口中文本框只读", 6), getsimpleswitch( @@ -495,7 +474,11 @@ def setTabThree_lazy(self): ("字体大小", 4), ( getspinbox( - 1, 100, globalconfig, "settingfontsize", callback=__changefontsize + 1, + 100, + globalconfig, + "settingfontsize", + callback=lambda _: gobject.baseobject.setcommonstylesheet(), ), 2, ), @@ -592,7 +575,6 @@ def setTabThree_lazy(self): ), ], [], - [], [ ("明暗", 6), ( @@ -600,7 +582,7 @@ def setTabThree_lazy(self): _TRL(["明亮", "黑暗", "跟随系统"]), globalconfig, "darklight", - callback=lambda _: self.setstylesheet(), + callback=lambda _: gobject.baseobject.setcommonstylesheet(), ), 5, ), @@ -612,7 +594,7 @@ def setTabThree_lazy(self): _TRL(["默认"]) + themelist("light"), globalconfig, "lighttheme", - callback=lambda _: self.setstylesheet(), + callback=lambda _: gobject.baseobject.setcommonstylesheet(), ), 5, ), @@ -624,13 +606,14 @@ def setTabThree_lazy(self): themelist("dark"), globalconfig, "darktheme", - callback=lambda _: self.setstylesheet(), + callback=lambda _: gobject.baseobject.setcommonstylesheet(), ), 5, ), ], + [], [ - ("WindowEffect", 6), + ("窗口特效_翻译窗口", 6), ( getsimplecombobox( ["Disable", "Acrylic", "Aero"], @@ -645,13 +628,13 @@ def setTabThree_lazy(self): ), ], [ - ("WindowBackdrop", 6), + ("窗口特效_其他", 6), ( getsimplecombobox( ["Solid", "Acrylic", "Mica", "MicaAlt"], globalconfig, "WindowBackdrop", - callback=lambda _: self.setstylesheet(), + callback=lambda _: gobject.baseobject.setcommonstylesheet(), ), 5, ), @@ -950,21 +933,21 @@ def setTabThree_lazy(self): getsimpleswitch(globalconfig, "hookmagpie"), ], ] - tab = self.makesubtab_lazy( + tab = makesubtab_lazy( ["文本设置", "界面主题", "窗口行为", "工具按钮", "窗口缩放"], [ - lambda: self.makescroll(self.makegrid(textgrid)), - lambda: self.makescroll(self.makegrid(uigrid)), - lambda: self.makescroll(self.makegrid(xingweigrid)), + lambda: makescroll(makegrid(textgrid)), + lambda: makescroll(makegrid(uigrid)), + lambda: makescroll(makegrid(xingweigrid)), lambda: createbuttonwidget(self), - lambda: self.makevbox( + lambda: makevbox( [ - self.makegrid(commonfsgrid), - self.makesubtab_lazy( + makegrid(commonfsgrid), + makesubtab_lazy( ["Magpie", "外部缩放软件"], [ - lambda: self.makescroll(self.makegrid(innermagpie)), - lambda: self.makescroll(self.makegrid(losslessgrid)), + lambda: makescroll(makegrid(innermagpie)), + lambda: makescroll(makegrid(losslessgrid)), ], ), ] diff --git a/LunaTranslator/LunaTranslator/gui/specialwidget.py b/LunaTranslator/LunaTranslator/gui/specialwidget.py index 7d050e22..1c740265 100644 --- a/LunaTranslator/LunaTranslator/gui/specialwidget.py +++ b/LunaTranslator/LunaTranslator/gui/specialwidget.py @@ -327,7 +327,7 @@ class lazyscrollflow(QWidget): self.widgets = [] self.fakegeos = [] self._spacing = 6 - self._margin = 9 + self._margin = self._spacing # 9 self.lock = threading.Lock() self.internalwid = QWidget(self) self.qscrollarea = ScrollArea(self) diff --git a/LunaTranslator/LunaTranslator/gui/transhist.py b/LunaTranslator/LunaTranslator/gui/transhist.py index 2cd05108..c2244c5e 100644 --- a/LunaTranslator/LunaTranslator/gui/transhist.py +++ b/LunaTranslator/LunaTranslator/gui/transhist.py @@ -1,5 +1,6 @@ from PyQt5.QtWidgets import QPlainTextEdit, QAction, QMenu, QFileDialog from PyQt5.QtCore import Qt, pyqtSignal +from PyQt5.QtGui import QCursor import qtawesome, functools, winsharedutils from gui.usefulwidget import closeashidewindow from myutils.config import globalconfig, _TR @@ -54,7 +55,7 @@ class transhist(closeashidewindow): menu.addAction(hideshowraw) menu.addAction(hideshowapi) - action = menu.exec(self.mapToGlobal(p)) + action = menu.exec(QCursor.pos()) if action == qingkong: tb.clear() elif action == copy: diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index e2c786e0..840bfed8 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -258,8 +258,8 @@ class QUnFrameWindow(resizableframeless): self.translate_text.addsearchwordmask(hira, text, callback) if globalconfig["autodisappear"]: - flag = (self.showintab and self.isMinimized()) or ( - not self.showintab and self.isHidden() + flag = (globalconfig['showintab'] and self.isMinimized()) or ( + not globalconfig['showintab'] and self.isHidden() ) if flag: @@ -282,8 +282,8 @@ class QUnFrameWindow(resizableframeless): if self._move_drag: return - flag = (self.showintab and self.isMinimized()) or ( - not self.showintab and self.isHidden() + flag = (globalconfig['showintab'] and self.isMinimized()) or ( + not globalconfig['showintab'] and self.isHidden() ) if flag: @@ -481,13 +481,13 @@ class QUnFrameWindow(resizableframeless): ) def hide_(self): - if self.showintab: + if globalconfig['showintab']: windows.ShowWindow(int(self.winId()), windows.SW_SHOWMINIMIZED) else: self.hide() def show_(self): - if self.showintab: + if globalconfig['showintab']: windows.ShowWindow(int(self.winId()), windows.SW_SHOWNOACTIVATE) else: self.show() @@ -597,11 +597,9 @@ class QUnFrameWindow(resizableframeless): self.setWindowIcon(icon) self.tray = QSystemTrayIcon() self.tray.setIcon(icon) - showintab(int(self.winId()), globalconfig["showintab"]) self.isfirstshow = True self.setAttribute(Qt.WA_TranslucentBackground) self.setAttribute(Qt.WA_ShowWithoutActivating, True) - self.showintab = globalconfig["showintab"] self.setWindowTitle("LunaTranslator") self.hidesignal.connect(self.hide_) self.lastrefreshtime = time.time() diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 6f877b34..94f6b32e 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -4,8 +4,11 @@ from PyQt5.QtWidgets import ( QApplication, QPushButton, QMessageBox, + QTabWidget, + QScrollArea, QDialog, QLabel, + QGridLayout, QSizePolicy, QHBoxLayout, QWidget, @@ -39,7 +42,7 @@ from PyQt5.QtWidgets import ( from traceback import print_exc import qtawesome, functools, threading, time from myutils.wrapper import Singleton -from winsharedutils import showintab, HTMLBrowser +from winsharedutils import HTMLBrowser import windows, os, platform @@ -137,8 +140,6 @@ class closeashidewindow(saveposwindow): super().__init__(parent, dic, key) self.showsignal.connect(self.showfunction) self.realshowhide.connect(self.realshowhidefunction) - if globalconfig["showintab_sub"]: - showintab(int(self.winId()), True) def realshowhidefunction(self, show): if show: @@ -392,13 +393,15 @@ def callbackwrap(d, k, call, _): print_exc() -def getsimplecombobox(lst, d, k, callback=None): +def getsimplecombobox(lst, d, k, callback=None, fixedsize=False): s = QComboBox() s.addItems(lst) if (k not in d) or (d[k] >= len(lst)): d[k] = 0 s.setCurrentIndex(d[k]) s.currentIndexChanged.connect(functools.partial(callbackwrap, d, k, callback)) + if fixedsize: + s.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) return s @@ -525,6 +528,10 @@ def getboxlayout(widgets, lc=QHBoxLayout, margin0=False, makewidget=False): return cp_layout +def makevbox(wids): + return getboxlayout(wids, lc=QVBoxLayout, margin0=True, makewidget=True) + + def textbrowappendandmovetoend(textOutput, sentence, addspace=True): scrollbar = textOutput.verticalScrollBar() atBottom = ( @@ -654,6 +661,7 @@ def getsimplekeyseq(dic, key, callback=None): key1.changeedvent.connect(functools.partial(__, dic, key, callback)) return key1 + class auto_select_webview(QWidget): on_load = pyqtSignal(str) @@ -756,3 +764,105 @@ def tabadd_lazy(tab, title, getrealwidgetfunction): v.setContentsMargins(0, 0, 0, 0) q.lazyfunction = lambda: v.addWidget(getrealwidgetfunction()) tab.addTab(q, _TR(title)) + + +def automakegrid(grid: QGridLayout, lis, save=False, savelist=None): + + maxl = 0 + for nowr, line in enumerate(lis): + nowc = 0 + for i in line: + if type(i) == str: + cols = 1 + elif type(i) != tuple: + wid, cols = i, 1 + elif len(i) == 2: + + wid, cols = i + elif len(i) == 3: + wid, cols, arg = i + nowc += cols + maxl = max(maxl, nowc) + + for nowr, line in enumerate(lis): + nowc = 0 + if save: + ll = [] + for i in line: + if type(i) == str: + cols = 1 + wid = QLabel(_TR(i)) + elif type(i) != tuple: + wid, cols = i, 1 + elif len(i) == 2: + + wid, cols = i + if type(wid) == str: + wid = QLabel(_TR(wid)) + elif len(i) == 3: + wid, cols, arg = i + if type(wid) == str: + wid = QLabel((wid)) + if arg == "link": + wid.setOpenExternalLinks(True) + if cols > 0: + col = cols + elif cols == 0: + col = maxl + else: + col = -maxl // cols + grid.addWidget(wid, nowr, nowc, 1, col) + if save: + ll.append(wid) + nowc += cols + if save: + savelist.append(ll) + grid.setRowMinimumHeight(nowr, 30) + + +def makegrid(grid, save=False, savelist=None, savelay=None): + + class gridwidget(QWidget): + pass + + gridlayoutwidget = gridwidget() + gridlay = QGridLayout() + gridlay.setAlignment(Qt.AlignTop) + gridlayoutwidget.setLayout(gridlay) + gridlayoutwidget.setStyleSheet("gridwidget{background-color:transparent;}") + + automakegrid(gridlay, grid, save, savelist) + if save: + savelay.append(gridlay) + return gridlayoutwidget + + +def makesubtab_lazy(titles=None, functions=None, klass=None): + if klass: + tab = klass() + else: + tab = QTabWidget() + + def __(t, i): + try: + w = t.currentWidget() + if "lazyfunction" in dir(w): + w.lazyfunction() + delattr(w, "lazyfunction") + except: + print_exc() + + tab.currentChanged.connect(functools.partial(__, tab)) + if titles and functions: + for i, func in enumerate(functions): + tabadd_lazy(tab, titles[i], func) + return tab + + +def makescroll(widget): + scroll = QScrollArea() + # scroll.setHorizontalScrollBarPolicy(1) + scroll.setStyleSheet("""QScrollArea{background-color:transparent;border:0px}""") + scroll.setWidgetResizable(True) + scroll.setWidget(widget) + return scroll diff --git a/LunaTranslator/files/defaultconfig/config.json b/LunaTranslator/files/defaultconfig/config.json index 4c0b0a0d..a9c4118c 100644 --- a/LunaTranslator/files/defaultconfig/config.json +++ b/LunaTranslator/files/defaultconfig/config.json @@ -71,6 +71,7 @@ "uselongtermcache": false, "fixedheight": false, "showintab": true, + "showintab_sub": true, "remove_useless_hook": false, "button_color_close": "#D32424", "button_color_normal": "#FFFFFF", @@ -209,7 +210,6 @@ ], "searchwordusewebview": false, "settingfonttype": "Arial", - "showintab_sub": false, "setting_geo_2": [ 100, 100, diff --git a/LunaTranslator/files/defaultconfig/static_data.json b/LunaTranslator/files/defaultconfig/static_data.json index 005b989c..e2afe470 100644 --- a/LunaTranslator/files/defaultconfig/static_data.json +++ b/LunaTranslator/files/defaultconfig/static_data.json @@ -15,7 +15,7 @@ }, { "file": "dark_win11like.py", - "name": "win11like" + "name": "QTWin11" } ], "light": [ @@ -33,7 +33,7 @@ }, { "file": "light_win11like.py", - "name": "win11like" + "name": "QTWin11" } ] }, diff --git a/LunaTranslator/files/lang/ar.json b/LunaTranslator/files/lang/ar.json index 0dedd73e..943a8810 100644 --- a/LunaTranslator/files/lang/ar.json +++ b/LunaTranslator/files/lang/ar.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "تصفية الجمل التي يتم تحديثها مرارا وتكرارا", "选择图标": "اختيار الرموز", "图标2": "أيقونات", - "子窗口任务栏中显示": "عرض في شريط المهام نافذة الطفل", "刷新": "منعش", "读取剪贴板": "قراءة الحافظة", "进行一次OCR": "التعرف الضوئي على الحروف", @@ -802,5 +801,6 @@ "翻译窗口": "نافذة الترجمة", "工具按钮": "أداة زر", "界面主题": "واجهة الموضوع", - "窗口行为": "نافذة السلوك" + "窗口行为": "نافذة السلوك", + "窗口特效": "نافذة المؤثرات الخاصة" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/cht.json b/LunaTranslator/files/lang/cht.json index 08e94572..f0886dbb 100644 --- a/LunaTranslator/files/lang/cht.json +++ b/LunaTranslator/files/lang/cht.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "過濾反復重繪的句子", "选择图标": "選擇圖標", "图标2": "圖標2", - "子窗口任务栏中显示": "子視窗工作列中顯示", "刷新": "刷新", "读取剪贴板": "讀取剪貼板", "进行一次OCR": "進行一次OCR", @@ -802,5 +801,6 @@ "翻译窗口": "翻譯視窗", "工具按钮": "工具按鈕", "界面主题": "介面主題", - "窗口行为": "視窗行為" + "窗口行为": "視窗行為", + "窗口特效": "視窗特效" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/en.json b/LunaTranslator/files/lang/en.json index 194c106f..b662a340 100644 --- a/LunaTranslator/files/lang/en.json +++ b/LunaTranslator/files/lang/en.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Filter repeatedly refreshed sentences", "选择图标": "Select icon", "图标2": "Icon 2", - "子窗口任务栏中显示": "Display in the sub window Taskbar", "刷新": "Refresh", "读取剪贴板": "Read clipboard", "进行一次OCR": "Conduct an OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Translation Window", "工具按钮": "Tool buttons", "界面主题": "Interface Theme", - "窗口行为": "Window behavior" + "窗口行为": "Window behavior", + "窗口特效": "Window effects" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/es.json b/LunaTranslator/files/lang/es.json index c454f422..d865de77 100644 --- a/LunaTranslator/files/lang/es.json +++ b/LunaTranslator/files/lang/es.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Filtrar oraciones actualizadas repetidamente", "选择图标": "Seleccionar icono", "图标2": "Icono 2", - "子窗口任务栏中显示": "Se muestra en la barra de tareas de la ventana hijo", "刷新": "Refrescar", "读取剪贴板": "Leer el portapapeles", "进行一次OCR": "Realizar un OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Ventana de traducción", "工具按钮": "Botones de herramientas", "界面主题": "Tema de la interfaz", - "窗口行为": "Comportamiento de la ventana" + "窗口行为": "Comportamiento de la ventana", + "窗口特效": "Efectos especiales de la ventana" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/fr.json b/LunaTranslator/files/lang/fr.json index c10f2085..e5729510 100644 --- a/LunaTranslator/files/lang/fr.json +++ b/LunaTranslator/files/lang/fr.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Filtrer phrases rafraîchies à plusieurs reprises", "选择图标": "Sélectionner une icône", "图标2": "Icône 2", - "子窗口任务栏中显示": "Affichage dans la barre des tâches de la Sous - fenêtre", "刷新": "Rafraîchir", "读取剪贴板": "Lire le presse - papiers", "进行一次OCR": "Faites une ocr", @@ -802,5 +801,6 @@ "翻译窗口": "Fenêtre de traduction", "工具按钮": "Le bouton outils", "界面主题": "Thème de l'interface", - "窗口行为": "Comportement de la fenêtre" + "窗口行为": "Comportement de la fenêtre", + "窗口特效": "Effets spéciaux de fenêtre" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/it.json b/LunaTranslator/files/lang/it.json index 78dffe59..059be31a 100644 --- a/LunaTranslator/files/lang/it.json +++ b/LunaTranslator/files/lang/it.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Filtra frasi aggiornate ripetutamente", "选择图标": "Seleziona icona", "图标2": "Icona 2", - "子窗口任务栏中显示": "Mostra nella barra delle applicazioni della sottofinestra", "刷新": "Aggiorna", "读取剪贴板": "Leggi gli appunti", "进行一次OCR": "Condurre un OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Finestra di traduzione", "工具按钮": "Pulsanti strumenti", "界面主题": "Tema interfaccia", - "窗口行为": "Comportamento delle finestre" + "窗口行为": "Comportamento delle finestre", + "窗口特效": "Effetti finestra" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ja.json b/LunaTranslator/files/lang/ja.json index a900ffa0..39fc013e 100644 --- a/LunaTranslator/files/lang/ja.json +++ b/LunaTranslator/files/lang/ja.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "繰り返し更新された文をフィルタリングする", "选择图标": "アイコンを選択", "图标2": "アイコン2", - "子窗口任务栏中显示": "サブウィンドウタスクバーに表示", "刷新": "リフレッシュ", "读取剪贴板": "クリップボードを読み込む", "进行一次OCR": "OCRを1回実行する", @@ -802,5 +801,6 @@ "翻译窗口": "翻訳ウィンドウ", "工具按钮": "ツールボタン", "界面主题": "インタフェーストピック", - "窗口行为": "ウィンドウの動作" + "窗口行为": "ウィンドウの動作", + "窗口特效": "ウィンドウ効果" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ko.json b/LunaTranslator/files/lang/ko.json index dbcec3e8..26217af9 100644 --- a/LunaTranslator/files/lang/ko.json +++ b/LunaTranslator/files/lang/ko.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "반복적으로 새로 고친 문장 필터링", "选择图标": "아이콘 선택", "图标2": "아이콘 2", - "子窗口任务栏中显示": "하위 창 작업 표시줄에 표시", "刷新": "새로 고침", "读取剪贴板": "클립보드 읽기", "进行一次OCR": "OCR을 한번 진행해보도록 하겠습니다.", @@ -802,5 +801,6 @@ "翻译窗口": "번역 창", "工具按钮": "도구 단추", "界面主题": "인터페이스 주제", - "窗口行为": "창 동작" + "窗口行为": "창 동작", + "窗口特效": "창 효과" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/pl.json b/LunaTranslator/files/lang/pl.json index f0268911..680459d5 100644 --- a/LunaTranslator/files/lang/pl.json +++ b/LunaTranslator/files/lang/pl.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Filtruj wielokrotnie odświeżane zdania", "选择图标": "Wybierz ikonę", "图标2": "Ikona 2", - "子窗口任务栏中显示": "Wyświetlanie w podoknie Pasek zadań", "刷新": "Odśwież", "读取剪贴板": "Odczytaj schowek", "进行一次OCR": "Przeprowadzenie OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Okno tłumaczenia", "工具按钮": "Przyciski narzędziowe", "界面主题": "Motyw interfejsu", - "窗口行为": "Zachowanie okna" + "窗口行为": "Zachowanie okna", + "窗口特效": "Efekty okien" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/ru.json b/LunaTranslator/files/lang/ru.json index c71eaf6b..9e6940a9 100644 --- a/LunaTranslator/files/lang/ru.json +++ b/LunaTranslator/files/lang/ru.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Фильтровать повторяющиеся предложения", "选择图标": "Выберите значок", "图标2": "Значок 2", - "子窗口任务栏中显示": "Показать панель задач подсветки", "刷新": "Обновить", "读取剪贴板": "Прочитать буфер обмена", "进行一次OCR": "Выполнить OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Окно перевода", "工具按钮": "Кнопки инструментов", "界面主题": "Интерфейсная тема", - "窗口行为": "Поведение окна" + "窗口行为": "Поведение окна", + "窗口特效": "Специальные эффекты окон" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/th.json b/LunaTranslator/files/lang/th.json index 8ccb65c5..71661778 100644 --- a/LunaTranslator/files/lang/th.json +++ b/LunaTranslator/files/lang/th.json @@ -396,7 +396,6 @@ "相关说明": "คำแนะนำที่เกี่ยวข้อง", "字体": "แบบอักษร", "韩语(CP949,EUC-KR)": "เกาหลี (CP949, EUC-KR)", - "子窗口任务栏中显示": "แสดงในแถบงานของหน้าต่างย่อย", "分词": "แยกคำ", "基本设置": "การตั้งค่าพื้นฐาน", "光标缩放系数": "ค่าสัมประสิทธิ์การซูมเคอร์เซอร์", @@ -802,5 +801,6 @@ "翻译窗口": "หน้าต่างการแปล", "工具按钮": "ปุ่มเครื่องมือ", "界面主题": "ธีมอินเตอร์เฟซ", - "窗口行为": "พฤติกรรมของหน้าต่าง" + "窗口行为": "พฤติกรรมของหน้าต่าง", + "窗口特效": "เทคนิคพิเศษของหน้าต่าง" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/tr.json b/LunaTranslator/files/lang/tr.json index 5049c054..b181e8f0 100644 --- a/LunaTranslator/files/lang/tr.json +++ b/LunaTranslator/files/lang/tr.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Süzgücü tekrar yenilenmiş cümleler", "选择图标": "İşaretçiyi seç", "图标2": "İşaretçi 2", - "子窗口任务栏中显示": "Alt pencere Görev Çubuğunda Gösterin", "刷新": "Tazele", "读取剪贴板": "Pano Oku", "进行一次OCR": "OCR yap", @@ -802,5 +801,6 @@ "翻译窗口": "Çeviri Penceresi", "工具按钮": "Araç düğmeleri", "界面主题": "Interface Theme", - "窗口行为": "Pencere davranışları" + "窗口行为": "Pencere davranışları", + "窗口特效": "Pencere etkileri" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/uk.json b/LunaTranslator/files/lang/uk.json index 8f2a0140..17ff25e6 100644 --- a/LunaTranslator/files/lang/uk.json +++ b/LunaTranslator/files/lang/uk.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Фільтрувати повторно оновлені речення", "选择图标": "Виберіть піктограму", "图标2": "Піктограма 2", - "子窗口任务栏中显示": "Показати у панелі завдань підвікна", "刷新": "Оновити", "读取剪贴板": "Читати буфер обміну даними", "进行一次OCR": "Виконати OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Вікно перекладу", "工具按钮": "Кнопки інструментів", "界面主题": "Тема інтерфейсу", - "窗口行为": "Поведінка вікон" + "窗口行为": "Поведінка вікон", + "窗口特效": "Ефекти вікна" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/vi.json b/LunaTranslator/files/lang/vi.json index 30abf513..396195d8 100644 --- a/LunaTranslator/files/lang/vi.json +++ b/LunaTranslator/files/lang/vi.json @@ -570,7 +570,6 @@ "过滤反复刷新的句子": "Lọc các câu được làm mới nhiều lần", "选择图标": "Chọn biểu tượng", "图标2": "Biểu tượng 2", - "子窗口任务栏中显示": "Hiển thị trong thanh tác vụ cửa sổ con", "刷新": "Làm mới", "读取剪贴板": "Đọc bảng nháp", "进行一次OCR": "Thực hiện OCR", @@ -802,5 +801,6 @@ "翻译窗口": "Cửa sổ dịch", "工具按钮": "Nút công cụ", "界面主题": "Giao diện sắc thái", - "窗口行为": "Ứng xử cửa sổ" + "窗口行为": "Ứng xử cửa sổ", + "窗口特效": "Hiệu ứng cửa sổ" } \ No newline at end of file diff --git a/LunaTranslator/files/lang/zh.json b/LunaTranslator/files/lang/zh.json index b73bde01..1ceae747 100644 --- a/LunaTranslator/files/lang/zh.json +++ b/LunaTranslator/files/lang/zh.json @@ -391,7 +391,6 @@ "相关说明": "", "字体": "", "韩语(CP949,EUC-KR)": "", - "子窗口任务栏中显示": "", "分词": "", "基本设置": "", "光标缩放系数": "", @@ -802,5 +801,6 @@ "翻译窗口": "", "工具按钮": "", "界面主题": "", - "窗口行为": "" + "窗口行为": "", + "窗口特效": "" } \ No newline at end of file diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index fde8c59a..31278a55 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -27,9 +27,9 @@ include(libs/libs.cmake) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/version) include(generate_product_version) -set(VERSION_MAJOR 2) -set(VERSION_MINOR 53) -set(VERSION_PATCH 3) +set(VERSION_MAJOR 3) +set(VERSION_MINOR 0) +set(VERSION_PATCH 0) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h) diff --git a/plugins/winsharedutils/hwnd.cpp b/plugins/winsharedutils/hwnd.cpp index 2e0a972b..2dd93826 100644 --- a/plugins/winsharedutils/hwnd.cpp +++ b/plugins/winsharedutils/hwnd.cpp @@ -6,12 +6,12 @@ DECLARE void showintab(HWND hwnd, bool show) if (show) { style_ex |= WS_EX_APPWINDOW; - style_ex &= ~WS_EX_TOOLWINDOW; + // style_ex &= ~WS_EX_TOOLWINDOW; } else { style_ex &= ~WS_EX_APPWINDOW; - style_ex |= WS_EX_TOOLWINDOW; + // style_ex |= WS_EX_TOOLWINDOW; } SetWindowLong(hwnd, GWL_EXSTYLE, style_ex); }