mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
update
This commit is contained in:
parent
afa8abb81e
commit
731ab0a08f
@ -24,6 +24,7 @@ import winsharedutils
|
|||||||
from myutils.wrapper import Singleton_close, Singleton, threader, tryprint
|
from myutils.wrapper import Singleton_close, Singleton, threader, tryprint
|
||||||
from myutils.utils import (
|
from myutils.utils import (
|
||||||
checkifnewgame,
|
checkifnewgame,
|
||||||
|
str2rgba,
|
||||||
vidchangedtask,
|
vidchangedtask,
|
||||||
titlechangedtask,
|
titlechangedtask,
|
||||||
imgchangedtask,
|
imgchangedtask,
|
||||||
@ -57,7 +58,7 @@ class ItemWidget(QWidget):
|
|||||||
def mousePressEvent(self, ev) -> None:
|
def mousePressEvent(self, ev) -> None:
|
||||||
try:
|
try:
|
||||||
self.bottommask.setStyleSheet(
|
self.bottommask.setStyleSheet(
|
||||||
f'background-color: {globalconfig["dialog_savegame_layout"]["onselectcolor"]};'
|
f'background-color: {str2rgba(globalconfig["dialog_savegame_layout"]["onselectcolor"],globalconfig["dialog_savegame_layout"]["transparent"])};'
|
||||||
)
|
)
|
||||||
|
|
||||||
if self != ItemWidget.globallashfocus:
|
if self != ItemWidget.globallashfocus:
|
||||||
@ -121,6 +122,7 @@ class ItemWidget(QWidget):
|
|||||||
c = globalconfig["dialog_savegame_layout"][
|
c = globalconfig["dialog_savegame_layout"][
|
||||||
("onfilenoexistscolor", "backcolor")[os.path.exists(exe)]
|
("onfilenoexistscolor", "backcolor")[os.path.exists(exe)]
|
||||||
]
|
]
|
||||||
|
c = str2rgba(c, globalconfig["dialog_savegame_layout"]["transparent"])
|
||||||
self.maskshowfileexists.setStyleSheet(f"background-color:{c};")
|
self.maskshowfileexists.setStyleSheet(f"background-color:{c};")
|
||||||
|
|
||||||
|
|
||||||
@ -1221,6 +1223,10 @@ class dialog_syssetting(QDialog):
|
|||||||
parent=self,
|
parent=self,
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
formLayout.addRow(
|
||||||
|
(_TR("不透明度")),
|
||||||
|
getspinbox(0, 100, globalconfig["dialog_savegame_layout"], "transparent"),
|
||||||
|
)
|
||||||
formLayout.addRow(
|
formLayout.addRow(
|
||||||
_TR("缩放"),
|
_TR("缩放"),
|
||||||
getsimplecombobox(
|
getsimplecombobox(
|
||||||
|
@ -4,7 +4,7 @@ import threading, windows
|
|||||||
import gobject, time
|
import gobject, time
|
||||||
from myutils.config import globalconfig, _TR
|
from myutils.config import globalconfig, _TR
|
||||||
from gui.usefulwidget import closeashidewindow, saveposwindow
|
from gui.usefulwidget import closeashidewindow, saveposwindow
|
||||||
from myutils.config import globalconfig
|
from myutils.utils import str2rgba
|
||||||
from myutils.wrapper import Singleton_close, threader
|
from myutils.wrapper import Singleton_close, threader
|
||||||
|
|
||||||
|
|
||||||
@ -97,13 +97,8 @@ class edittrans(QMainWindow):
|
|||||||
super().__init__(parent, Qt.WindowType.FramelessWindowHint)
|
super().__init__(parent, Qt.WindowType.FramelessWindowHint)
|
||||||
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
self.setAttribute(Qt.WidgetAttribute.WA_TranslucentBackground)
|
||||||
self.setStyleSheet(
|
self.setStyleSheet(
|
||||||
"background-color: rgba(%s, %s, %s, %s)"
|
"background-color: %s"
|
||||||
% (
|
% str2rgba(globalconfig["backcolor"], globalconfig["transparent"])
|
||||||
int(globalconfig["backcolor"][1:3], 16),
|
|
||||||
int(globalconfig["backcolor"][3:5], 16),
|
|
||||||
int(globalconfig["backcolor"][5:7], 16),
|
|
||||||
globalconfig["transparent"],
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
self.setupUi()
|
self.setupUi()
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ from gui.usefulwidget import (
|
|||||||
getsimpleswitch,
|
getsimpleswitch,
|
||||||
getsimplekeyseq,
|
getsimplekeyseq,
|
||||||
getcolorbutton,
|
getcolorbutton,
|
||||||
|
makesubtab_lazy,
|
||||||
tabadd_lazy,
|
tabadd_lazy,
|
||||||
)
|
)
|
||||||
from myutils.subproc import subproc_w
|
from myutils.subproc import subproc_w
|
||||||
@ -142,7 +143,7 @@ class AnkiWindow(QWidget):
|
|||||||
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
self.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding)
|
||||||
self.setWindowTitle("Anki Connect")
|
self.setWindowTitle("Anki Connect")
|
||||||
self.currentword = ""
|
self.currentword = ""
|
||||||
self.tabs = QTabWidget()
|
self.tabs = makesubtab_lazy(callback=self.ifshowrefresh)
|
||||||
self.tabs.addTab(self.createaddtab(), _TR("添加"))
|
self.tabs.addTab(self.createaddtab(), _TR("添加"))
|
||||||
tabadd_lazy(self.tabs, "设置", self.creatsetdtab)
|
tabadd_lazy(self.tabs, "设置", self.creatsetdtab)
|
||||||
tabadd_lazy(self.tabs, "模板", self.creattemplatetab)
|
tabadd_lazy(self.tabs, "模板", self.creattemplatetab)
|
||||||
@ -156,13 +157,6 @@ class AnkiWindow(QWidget):
|
|||||||
self.tabs.currentChanged.connect(self.ifshowrefresh)
|
self.tabs.currentChanged.connect(self.ifshowrefresh)
|
||||||
|
|
||||||
def ifshowrefresh(self, idx):
|
def ifshowrefresh(self, idx):
|
||||||
try:
|
|
||||||
w = self.tabs.currentWidget()
|
|
||||||
if "lazyfunction" in dir(w):
|
|
||||||
w.lazyfunction()
|
|
||||||
delattr(w, "lazyfunction")
|
|
||||||
except:
|
|
||||||
print_exc()
|
|
||||||
if idx == 2:
|
if idx == 2:
|
||||||
self.refreshhtml.emit()
|
self.refreshhtml.emit()
|
||||||
|
|
||||||
|
@ -211,6 +211,7 @@ class Textbrowser(QLabel):
|
|||||||
def resizeEvent(self, event):
|
def resizeEvent(self, event):
|
||||||
self.atback2.resize(event.size())
|
self.atback2.resize(event.size())
|
||||||
self.toplabel2.resize(event.size())
|
self.toplabel2.resize(event.size())
|
||||||
|
self.masklabel.resize(event.size())
|
||||||
|
|
||||||
def contentchangedfunction(self):
|
def contentchangedfunction(self):
|
||||||
sz = self.textbrowser.document().size().toSize()
|
sz = self.textbrowser.document().size().toSize()
|
||||||
@ -250,7 +251,6 @@ class Textbrowser(QLabel):
|
|||||||
Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
Qt.ScrollBarPolicy.ScrollBarAlwaysOff
|
||||||
)
|
)
|
||||||
self.masklabel = QLabel(self.textbrowser)
|
self.masklabel = QLabel(self.textbrowser)
|
||||||
self.masklabel.setGeometry(0, 0, 9999, 9999)
|
|
||||||
self.masklabel.setMouseTracking(True)
|
self.masklabel.setMouseTracking(True)
|
||||||
|
|
||||||
self.savetaglabels = []
|
self.savetaglabels = []
|
||||||
|
@ -12,7 +12,7 @@ import winsharedutils
|
|||||||
from myutils.config import globalconfig, saveallconfig, _TR, static_data
|
from myutils.config import globalconfig, saveallconfig, _TR, static_data
|
||||||
from myutils.subproc import endsubprocs
|
from myutils.subproc import endsubprocs
|
||||||
from myutils.ocrutil import ocr_run, imageCut
|
from myutils.ocrutil import ocr_run, imageCut
|
||||||
from myutils.utils import loadpostsettingwindowmethod, getimageformat
|
from myutils.utils import loadpostsettingwindowmethod, getimageformat, str2rgba
|
||||||
from myutils.hwnd import mouseselectwindow, grabwindow, getExeIcon
|
from myutils.hwnd import mouseselectwindow, grabwindow, getExeIcon
|
||||||
from gui.dialog_savedgame import dialog_savedgame_new
|
from gui.dialog_savedgame import dialog_savedgame_new
|
||||||
from gui.dialog_memory import dialog_memory
|
from gui.dialog_memory import dialog_memory
|
||||||
@ -699,23 +699,22 @@ class QUnFrameWindow(resizableframeless):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.translate_text.setStyleSheet(
|
self.translate_text.setStyleSheet(
|
||||||
"border-width: 0;%s;background-color: rgba(%s, %s, %s, %s)"
|
"border-width: 0;%s;background-color: %s"
|
||||||
% (
|
% (
|
||||||
topr,
|
topr,
|
||||||
int(globalconfig["backcolor"][1:3], 16),
|
str2rgba(
|
||||||
int(globalconfig["backcolor"][3:5], 16),
|
globalconfig["backcolor"],
|
||||||
int(globalconfig["backcolor"][5:7], 16),
|
globalconfig["transparent"] * (not self.backtransparent),
|
||||||
globalconfig["transparent"] * (not self.backtransparent) / 100,
|
),
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self._TitleLabel.setStyleSheet(
|
self._TitleLabel.setStyleSheet(
|
||||||
"border-width: 0;%s;background-color: rgba(%s, %s, %s, %s)"
|
"border-width: 0;%s;background-color: %s"
|
||||||
% (
|
% (
|
||||||
bottomr,
|
bottomr,
|
||||||
int(globalconfig["backcolor_tool"][1:3], 16),
|
str2rgba(
|
||||||
int(globalconfig["backcolor_tool"][3:5], 16),
|
globalconfig["backcolor_tool"], globalconfig["transparent_tool"]
|
||||||
int(globalconfig["backcolor_tool"][5:7], 16),
|
),
|
||||||
globalconfig["transparent_tool"] / 100,
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
for _type in self.stylebuttons:
|
for _type in self.stylebuttons:
|
||||||
@ -951,14 +950,15 @@ class QUnFrameWindow(resizableframeless):
|
|||||||
|
|
||||||
self.dodelayhide(delay)
|
self.dodelayhide(delay)
|
||||||
|
|
||||||
def resizeEvent(self, e):
|
def resizeEvent(self, e: QResizeEvent):
|
||||||
super().resizeEvent(e)
|
super().resizeEvent(e)
|
||||||
wh = globalconfig["buttonsize"] * 1.5
|
wh = globalconfig["buttonsize"] * 1.5
|
||||||
height = self.height() - wh
|
height = self.height() - wh
|
||||||
|
|
||||||
self.translate_text.resize(self.width(), int(height))
|
self.translate_text.resize(self.width(), int(height))
|
||||||
self.adjustbuttons()
|
if e.oldSize().width() != e.size().width():
|
||||||
self._TitleLabel.setFixedWidth(self.width())
|
self.adjustbuttons()
|
||||||
|
self._TitleLabel.setFixedWidth(self.width())
|
||||||
|
|
||||||
def adjustbuttons(self):
|
def adjustbuttons(self):
|
||||||
left = []
|
left = []
|
||||||
|
@ -117,10 +117,10 @@ class closeashidewindow(saveposwindow):
|
|||||||
def showfunction(self):
|
def showfunction(self):
|
||||||
if self.isMinimized():
|
if self.isMinimized():
|
||||||
self.showNormal()
|
self.showNormal()
|
||||||
elif self.isHidden():
|
elif self.isVisible():
|
||||||
self.show()
|
|
||||||
else:
|
|
||||||
self.hide()
|
self.hide()
|
||||||
|
else:
|
||||||
|
self.show()
|
||||||
|
|
||||||
def closeEvent(self, event: QCloseEvent):
|
def closeEvent(self, event: QCloseEvent):
|
||||||
self.hide()
|
self.hide()
|
||||||
@ -812,7 +812,7 @@ def makegrid(grid, save=False, savelist=None, savelay=None):
|
|||||||
return gridlayoutwidget
|
return gridlayoutwidget
|
||||||
|
|
||||||
|
|
||||||
def makesubtab_lazy(titles=None, functions=None, klass=None):
|
def makesubtab_lazy(titles=None, functions=None, klass=None, callback=None):
|
||||||
if klass:
|
if klass:
|
||||||
tab = klass()
|
tab = klass()
|
||||||
else:
|
else:
|
||||||
@ -826,6 +826,8 @@ def makesubtab_lazy(titles=None, functions=None, klass=None):
|
|||||||
delattr(w, "lazyfunction")
|
delattr(w, "lazyfunction")
|
||||||
except:
|
except:
|
||||||
print_exc()
|
print_exc()
|
||||||
|
if callback:
|
||||||
|
callback(i)
|
||||||
|
|
||||||
tab.currentChanged.connect(functools.partial(__, tab))
|
tab.currentChanged.connect(functools.partial(__, tab))
|
||||||
if titles and functions:
|
if titles and functions:
|
||||||
|
@ -623,3 +623,12 @@ def parsekeystringtomodvkcode(keystring, modes=False):
|
|||||||
if modes:
|
if modes:
|
||||||
mode = _modes
|
mode = _modes
|
||||||
return mode, vkcode
|
return mode, vkcode
|
||||||
|
|
||||||
|
|
||||||
|
def str2rgba(string, alpha100):
|
||||||
|
return "rgba(%s, %s, %s, %s)" % (
|
||||||
|
int(string[1:3], 16),
|
||||||
|
int(string[3:5], 16),
|
||||||
|
int(string[5:7], 16),
|
||||||
|
alpha100 / 100,
|
||||||
|
)
|
||||||
|
@ -240,7 +240,8 @@
|
|||||||
"textH": 50,
|
"textH": 50,
|
||||||
"backcolor": "#c38282",
|
"backcolor": "#c38282",
|
||||||
"onselectcolor": "#007fff",
|
"onselectcolor": "#007fff",
|
||||||
"onfilenoexistscolor": "#acacac"
|
"onfilenoexistscolor": "#acacac",
|
||||||
|
"transparent": 25
|
||||||
},
|
},
|
||||||
"profiles_index": 0,
|
"profiles_index": 0,
|
||||||
"ocrautobindwindow": true,
|
"ocrautobindwindow": true,
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 3)
|
set(VERSION_MAJOR 3)
|
||||||
set(VERSION_MINOR 0)
|
set(VERSION_MINOR 0)
|
||||||
set(VERSION_PATCH 2)
|
set(VERSION_PATCH 3)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user