mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 16:44:13 +08:00
rate
This commit is contained in:
parent
0b3647e0bb
commit
96cabbfea7
@ -20,6 +20,6 @@ def gen_html(configs, text, fm, fs, bold, atcenter, color, extra_space):
|
|||||||
{bold}
|
{bold}
|
||||||
text-shadow:{ntimes};
|
text-shadow:{ntimes};
|
||||||
{align};
|
{align};
|
||||||
line-height: calc(1.5em + {extra_space}px);
|
line-height: calc(1.2em + {extra_space}px);
|
||||||
}}</style>"""
|
}}</style>"""
|
||||||
return style + f'<div id="{_id}">{text}</div>'
|
return style + f'<div id="{_id}">{text}</div>'
|
||||||
|
@ -13,7 +13,7 @@ def gen_html(configs, text, fm, fs, bold, atcenter, color, extra_space):
|
|||||||
color:{color};
|
color:{color};
|
||||||
{bold}
|
{bold}
|
||||||
{align}
|
{align}
|
||||||
line-height: calc(1.5em + {extra_space}px);
|
line-height: calc(1.2em + {extra_space}px);
|
||||||
}}</style>"""
|
}}</style>"""
|
||||||
|
|
||||||
return style + f'<div id="{_id}">{text}</div>'
|
return style + f'<div id="{_id}">{text}</div>'
|
||||||
|
@ -148,7 +148,11 @@ class TextBrowser(QWidget, dataget):
|
|||||||
isshowhira, isshow_fenci, isfenciclick = flags
|
isshowhira, isshow_fenci, isfenciclick = flags
|
||||||
fm, fskana, bold = self._getfontinfo_kana()
|
fm, fskana, bold = self._getfontinfo_kana()
|
||||||
kanacolor = self._getkanacolor()
|
kanacolor = self._getkanacolor()
|
||||||
text = "<ruby>"
|
if isshowhira:
|
||||||
|
rb, rb2, rt, rt2 = "<ruby>", "</ruby>", "<rt>", "</rt>"
|
||||||
|
else:
|
||||||
|
rb, rb2, rt, rt2 = "<ruby>", "</ruby>", "", ""
|
||||||
|
text = rb
|
||||||
for word in tag:
|
for word in tag:
|
||||||
color1 = self._randomcolor(word, ignorealpha=True)
|
color1 = self._randomcolor(word, ignorealpha=True)
|
||||||
if isshow_fenci and color1:
|
if isshow_fenci and color1:
|
||||||
@ -160,7 +164,7 @@ class TextBrowser(QWidget, dataget):
|
|||||||
else:
|
else:
|
||||||
click = ""
|
click = ""
|
||||||
if word["orig"] == "\n":
|
if word["orig"] == "\n":
|
||||||
text = text + "</ruby><br><ruby>"
|
text = text + rb2 + "<br>" + rb
|
||||||
continue
|
continue
|
||||||
text += (
|
text += (
|
||||||
f"""<div {style} {click}>"""
|
f"""<div {style} {click}>"""
|
||||||
@ -168,22 +172,19 @@ class TextBrowser(QWidget, dataget):
|
|||||||
+ "</div>"
|
+ "</div>"
|
||||||
)
|
)
|
||||||
if (word["orig"] != word["hira"]) and isshowhira:
|
if (word["orig"] != word["hira"]) and isshowhira:
|
||||||
text += (
|
inner = self.gen_html(
|
||||||
f"<rt>"
|
word["hira"],
|
||||||
+ self.gen_html(
|
fm,
|
||||||
word["hira"],
|
fskana,
|
||||||
fm,
|
bold,
|
||||||
fskana,
|
True,
|
||||||
bold,
|
kanacolor,
|
||||||
True,
|
globalconfig["extra_space"],
|
||||||
kanacolor,
|
|
||||||
globalconfig["extra_space"],
|
|
||||||
)
|
|
||||||
+ "</rt>"
|
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
text += "<rt></rt>"
|
inner = ""
|
||||||
text = text + "</ruby>"
|
text += rt + inner + rt2
|
||||||
|
text = text + rb2
|
||||||
|
|
||||||
fm, fs, bold = self._getfontinfo(origin)
|
fm, fs, bold = self._getfontinfo(origin)
|
||||||
text = self.gen_html(
|
text = self.gen_html(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user