mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2025-01-01 10:04:12 +08:00
44 lines
1.3 KiB
Python
44 lines
1.3 KiB
Python
from qtsymbols import *
|
|
from myutils.config import globalconfig
|
|
|
|
|
|
class dataget:
|
|
|
|
def _randomcolor_1(self, word):
|
|
if word.get("isdeli", False):
|
|
return None
|
|
c = QColor("white")
|
|
if "cixing" in word:
|
|
try:
|
|
if globalconfig["cixingcolorshow"][word["cixing"]] == False:
|
|
return None
|
|
c = QColor(globalconfig["cixingcolor"][word["cixing"]])
|
|
except:
|
|
pass
|
|
return (c.red(), c.green(), c.blue(), globalconfig["showcixing_touming"] / 100)
|
|
|
|
def _randomcolor(self, word):
|
|
color = self._randomcolor_1(word)
|
|
if not color:
|
|
return None
|
|
r, g, b, a = color
|
|
return "rgba({}, {}, {}, {})".format(r, g, b, a)
|
|
|
|
def _getfontinfo(self, origin):
|
|
if origin:
|
|
fm = globalconfig["fonttype"]
|
|
fs = globalconfig["fontsizeori"]
|
|
bold = globalconfig["showbold"]
|
|
else:
|
|
fm = globalconfig["fonttype2"]
|
|
fs = globalconfig["fontsize"]
|
|
bold = globalconfig["showbold_trans"]
|
|
return fm, fs, bold
|
|
|
|
def _getfontinfo_kana(self):
|
|
fm, fs, bold = self._getfontinfo(True)
|
|
return fm, fs * globalconfig["kanarate"], bold
|
|
|
|
def _getkanacolor(self):
|
|
return globalconfig["jiamingcolor"]
|