mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
fix
This commit is contained in:
parent
4d70fff72b
commit
6c2913fe47
@ -275,8 +275,10 @@ class TextBrowser(QWidget, dataget):
|
|||||||
textlines, linetags = self._splitlinestags(font, tag, text)
|
textlines, linetags = self._splitlinestags(font, tag, text)
|
||||||
text = "\n".join(textlines)
|
text = "\n".join(textlines)
|
||||||
tag = self._join_tags(linetags, True)
|
tag = self._join_tags(linetags, True)
|
||||||
tag = tag if isshowhira else []
|
tagshow = tag if isshowhira else []
|
||||||
self._textbrowser_append(origin, atcenter, text, tag, color)
|
else:
|
||||||
|
tagshow = []
|
||||||
|
self._textbrowser_append(origin, atcenter, text, tagshow, color)
|
||||||
if len(tag) and (isshow_fenci or isfenciclick):
|
if len(tag) and (isshow_fenci or isfenciclick):
|
||||||
self.addsearchwordmask(isshow_fenci, isfenciclick, tag)
|
self.addsearchwordmask(isshow_fenci, isfenciclick, tag)
|
||||||
|
|
||||||
@ -466,7 +468,7 @@ class TextBrowser(QWidget, dataget):
|
|||||||
|
|
||||||
for label in self.iteryinyinglabelsave[iter_context_class]:
|
for label in self.iteryinyinglabelsave[iter_context_class]:
|
||||||
label.hide()
|
label.hide()
|
||||||
|
maxh = self.maxvisheight
|
||||||
subtext = []
|
subtext = []
|
||||||
subpos = []
|
subpos = []
|
||||||
lastpos = None
|
lastpos = None
|
||||||
@ -475,6 +477,8 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.textcursor.setPosition(posx)
|
self.textcursor.setPosition(posx)
|
||||||
posx += 1
|
posx += 1
|
||||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||||
|
if tl1.y() > maxh:
|
||||||
|
break
|
||||||
if lastpos is None or tl1.y() != lastpos.y():
|
if lastpos is None or tl1.y() != lastpos.y():
|
||||||
lastpos = tl1
|
lastpos = tl1
|
||||||
subpos.append(lastpos)
|
subpos.append(lastpos)
|
||||||
@ -534,15 +538,21 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.textcursor.setPosition(blockstart + s)
|
self.textcursor.setPosition(blockstart + s)
|
||||||
self.textbrowser.setTextCursor(self.textcursor)
|
self.textbrowser.setTextCursor(self.textcursor)
|
||||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||||
|
if tl1.y() > maxh:
|
||||||
|
return
|
||||||
collects[collecti].move(tl1.x(), tl1.y() + self.labeloffset_y)
|
collects[collecti].move(tl1.x(), tl1.y() + self.labeloffset_y)
|
||||||
collecti += 1
|
collecti += 1
|
||||||
|
|
||||||
|
@property
|
||||||
|
def maxvisheight(self):
|
||||||
|
return QApplication.primaryScreen().virtualGeometry().height() * 2
|
||||||
|
|
||||||
def _showyinyingtext(self, b1, b2, color, font):
|
def _showyinyingtext(self, b1, b2, color, font):
|
||||||
linei = self.yinyingposline
|
linei = self.yinyingposline
|
||||||
|
|
||||||
doc = self.textbrowser.document()
|
doc = self.textbrowser.document()
|
||||||
block = doc.findBlockByNumber(0)
|
block = doc.findBlockByNumber(0)
|
||||||
|
maxh = self.maxvisheight
|
||||||
for blocki in range(b1, b2):
|
for blocki in range(b1, b2):
|
||||||
block = doc.findBlockByNumber(blocki)
|
block = doc.findBlockByNumber(blocki)
|
||||||
layout = block.layout()
|
layout = block.layout()
|
||||||
@ -558,18 +568,20 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.textcursor.setPosition(blockstart + s)
|
self.textcursor.setPosition(blockstart + s)
|
||||||
self.textbrowser.setTextCursor(self.textcursor)
|
self.textbrowser.setTextCursor(self.textcursor)
|
||||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||||
|
if tl1.y() > maxh:
|
||||||
|
self.yinyingposline = linei
|
||||||
|
return
|
||||||
if self.yinyinglabels_idx >= len(self.yinyinglabels):
|
if self.yinyinglabels_idx >= len(self.yinyinglabels):
|
||||||
self.yinyinglabels.append(self.currentclass(self.toplabel2))
|
self.yinyinglabels.append(self.currentclass(self.toplabel2))
|
||||||
_ = self.yinyinglabels[self.yinyinglabels_idx]
|
_ = self.yinyinglabels[self.yinyinglabels_idx]
|
||||||
self.yinyinglabels_idx += 1
|
self.yinyinglabels_idx += 1
|
||||||
|
|
||||||
_.setColor(color)
|
_.setColor(color)
|
||||||
_.setText(block.text()[s : s + l])
|
_.setText(block.text()[s : s + l])
|
||||||
_.setFont(font)
|
_.setFont(font)
|
||||||
_.adjustSize()
|
_.adjustSize()
|
||||||
_.move(tl1.x(), tl1.y() + self.labeloffset_y)
|
_.move(tl1.x(), tl1.y() + self.labeloffset_y)
|
||||||
_.show()
|
_.show()
|
||||||
|
|
||||||
linei += 1
|
linei += 1
|
||||||
self.yinyingposline = linei
|
self.yinyingposline = linei
|
||||||
|
|
||||||
@ -663,6 +675,7 @@ class TextBrowser(QWidget, dataget):
|
|||||||
self.settextposcursor(pos)
|
self.settextposcursor(pos)
|
||||||
savetaglabels_idx = 0
|
savetaglabels_idx = 0
|
||||||
lines = [[]]
|
lines = [[]]
|
||||||
|
maxh = self.maxvisheight
|
||||||
for word in x:
|
for word in x:
|
||||||
l = len(word["orig_X"])
|
l = len(word["orig_X"])
|
||||||
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
tl1 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||||
@ -672,6 +685,8 @@ class TextBrowser(QWidget, dataget):
|
|||||||
if not self._checkwordhastag(word):
|
if not self._checkwordhastag(word):
|
||||||
continue
|
continue
|
||||||
tl2 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
tl2 = self.textbrowser.cursorRect(self.textcursor).topLeft()
|
||||||
|
if tl2.y() > maxh:
|
||||||
|
break
|
||||||
_ = self.solvejiaminglabel(
|
_ = self.solvejiaminglabel(
|
||||||
savetaglabels_idx, word, fonthira, fontori_m, tl1, fha
|
savetaglabels_idx, word, fonthira, fontori_m, tl1, fha
|
||||||
)
|
)
|
||||||
|
@ -15,9 +15,6 @@ class base(QWidget):
|
|||||||
def extraWH(self):
|
def extraWH(self):
|
||||||
return 2 * self.config.get("width", 0), 2 * self.config.get("width", 0)
|
return 2 * self.config.get("width", 0), 2 * self.config.get("width", 0)
|
||||||
|
|
||||||
def init(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def config(self):
|
def config(self):
|
||||||
return globalconfig["rendertext"]["textbrowser"][self.typename].get("args", {})
|
return globalconfig["rendertext"]["textbrowser"][self.typename].get("args", {})
|
||||||
@ -41,8 +38,6 @@ class base(QWidget):
|
|||||||
self._pix = None
|
self._pix = None
|
||||||
self._m_text = ""
|
self._m_text = ""
|
||||||
|
|
||||||
self.init()
|
|
||||||
|
|
||||||
def adjustSize(self):
|
def adjustSize(self):
|
||||||
self._pix = None
|
self._pix = None
|
||||||
font = self.font()
|
font = self.font()
|
||||||
|
@ -2009,7 +2009,7 @@
|
|||||||
"ZoomFactor": 1,
|
"ZoomFactor": 1,
|
||||||
"realtime_edit_target": "realtime_edit",
|
"realtime_edit_target": "realtime_edit",
|
||||||
"magpiepath": "",
|
"magpiepath": "",
|
||||||
"movefollow": true,
|
"movefollow": false,
|
||||||
"focusnotop": false,
|
"focusnotop": false,
|
||||||
"autostarthook": true,
|
"autostarthook": true,
|
||||||
"minlength": 0,
|
"minlength": 0,
|
||||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
|||||||
|
|
||||||
set(VERSION_MAJOR 5)
|
set(VERSION_MAJOR 5)
|
||||||
set(VERSION_MINOR 35)
|
set(VERSION_MINOR 35)
|
||||||
set(VERSION_PATCH 4)
|
set(VERSION_PATCH 5)
|
||||||
|
|
||||||
add_library(pch pch.cpp)
|
add_library(pch pch.cpp)
|
||||||
target_precompile_headers(pch PUBLIC pch.h)
|
target_precompile_headers(pch PUBLIC pch.h)
|
||||||
|
@ -31,8 +31,7 @@ std::optional<std::wstring> clipboard_get_internal()
|
|||||||
LPWSTR pszText = static_cast<LPWSTR>(GlobalLock(hData));
|
LPWSTR pszText = static_cast<LPWSTR>(GlobalLock(hData));
|
||||||
if (pszText == 0)
|
if (pszText == 0)
|
||||||
break;
|
break;
|
||||||
int sz = GlobalSize(hData);
|
data = std::move(std::wstring(pszText));
|
||||||
data = std::move(std::wstring(pszText, sz));
|
|
||||||
GlobalUnlock(hData);
|
GlobalUnlock(hData);
|
||||||
} while (false);
|
} while (false);
|
||||||
CloseClipboard();
|
CloseClipboard();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user