mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
iter
This commit is contained in:
parent
ce21815930
commit
db3ff84804
@ -78,15 +78,24 @@ class QGraphicsDropShadowEffect_multi(QGraphicsDropShadowEffect):
|
|||||||
|
|
||||||
class BorderedLabel(QLabel):
|
class BorderedLabel(QLabel):
|
||||||
def move(self, point: QPoint):
|
def move(self, point: QPoint):
|
||||||
|
self.movedx = 0
|
||||||
|
self.movedy = 0
|
||||||
text = self.text()
|
text = self.text()
|
||||||
isarabic = any((ord(char) >= 0x0600 and ord(char) <= 0x06E0) for char in text)
|
isarabic = any((ord(char) >= 0x0600 and ord(char) <= 0x06E0) for char in text)
|
||||||
if isarabic:
|
if isarabic:
|
||||||
point.setX(point.x() - self.width())
|
self.movedx -= self.width()
|
||||||
|
self.movedx -= self.m_fontOutLineWidth
|
||||||
point.setX(int(point.x() - self.m_fontOutLineWidth))
|
self.movedy -= self.m_fontOutLineWidth
|
||||||
point.setY(int(point.y() - self.m_fontOutLineWidth))
|
point.setX(int(point.x() + self.movedx))
|
||||||
|
point.setY(int(point.y() + self.movedy))
|
||||||
super().move(point)
|
super().move(point)
|
||||||
|
|
||||||
|
def pos(self) -> QPoint:
|
||||||
|
p = super().pos()
|
||||||
|
p.setX(int(p.x() - self.movedx))
|
||||||
|
p.setY(int(p.y() - self.movedy))
|
||||||
|
return p
|
||||||
|
|
||||||
def clearShadow(self):
|
def clearShadow(self):
|
||||||
self.setGraphicsEffect(None)
|
self.setGraphicsEffect(None)
|
||||||
|
|
||||||
@ -104,6 +113,8 @@ class BorderedLabel(QLabel):
|
|||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
self.movedy = 0
|
||||||
|
self.movedx = 0
|
||||||
self.m_outLineColor = QColor()
|
self.m_outLineColor = QColor()
|
||||||
self.m_fontOutLineWidth = 1
|
self.m_fontOutLineWidth = 1
|
||||||
self.m_contentColor = QColor()
|
self.m_contentColor = QColor()
|
||||||
@ -380,6 +391,7 @@ class Textbrowser(QLabel):
|
|||||||
_.move(subpos[i])
|
_.move(subpos[i])
|
||||||
_.show()
|
_.show()
|
||||||
self.iteryinyinglabelsave[iter_context_class][1] += 1
|
self.iteryinyinglabelsave[iter_context_class][1] += 1
|
||||||
|
|
||||||
if maxh:
|
if maxh:
|
||||||
if maxnewh == 0:
|
if maxnewh == 0:
|
||||||
maxnewh = maxh2
|
maxnewh = maxh2
|
||||||
@ -387,7 +399,9 @@ class Textbrowser(QLabel):
|
|||||||
if label.isVisible() == False:
|
if label.isVisible() == False:
|
||||||
continue
|
continue
|
||||||
if label.pos().y() > maxh:
|
if label.pos().y() > maxh:
|
||||||
label.move(label.pos().x(), label.pos().y() + maxnewh - maxh)
|
label.move(
|
||||||
|
QPoint(label.pos().x(), label.pos().y() + maxnewh - maxh)
|
||||||
|
)
|
||||||
for klass in self.iteryinyinglabelsave:
|
for klass in self.iteryinyinglabelsave:
|
||||||
if klass == iter_context_class:
|
if klass == iter_context_class:
|
||||||
continue
|
continue
|
||||||
@ -395,7 +409,9 @@ class Textbrowser(QLabel):
|
|||||||
if label.isVisible() == False:
|
if label.isVisible() == False:
|
||||||
continue
|
continue
|
||||||
if label.pos().y() > maxh:
|
if label.pos().y() > maxh:
|
||||||
label.move(label.pos().x(), label.pos().y() + maxnewh - maxh)
|
label.move(
|
||||||
|
QPoint(label.pos().x(), label.pos().y() + maxnewh - maxh)
|
||||||
|
)
|
||||||
|
|
||||||
def showyinyingtext(self, b1, b2, color):
|
def showyinyingtext(self, b1, b2, color):
|
||||||
linei = self.yinyingposline
|
linei = self.yinyingposline
|
||||||
|
Loading…
x
Reference in New Issue
Block a user