This commit is contained in:
恍兮惚兮 2024-06-22 17:25:11 +08:00
parent 72306d15ca
commit 5bc71c24f7
23 changed files with 81 additions and 115 deletions

View File

@ -14,6 +14,7 @@ from gui.usefulwidget import (
D_getIconButton,
D_getcolorbutton,
getcolorbutton,
MySwitch,
D_getsimpleswitch,
selectcolor,
FocusFontCombo,
@ -177,6 +178,9 @@ def createinternalfontsettings(self, forml, group, _type):
lineW.setSingleStep(line.get("step", 1))
lineW.setValue(dd[key])
lineW.valueChanged.connect(functools.partial(dd.__setitem__, key))
elif _type == "switch":
lineW = MySwitch(sign=dd[key])
lineW.clicked.connect(functools.partial(dd.__setitem__, key))
forml.addRow(
_TR(name),
lineW,

View File

@ -1,5 +1,5 @@
from qtsymbols import *
from myutils.config import globalconfig
from myutils.config import globalconfig, static_data
from rendertext.somefunctions import dataget
import gobject, functools, importlib
from traceback import print_exc
@ -105,9 +105,13 @@ class TextBrowser(QWidget, dataget):
def resets1(self):
self.currenttype = globalconfig["rendertext_using_internal"]["textbrowser"]
__ = importlib.import_module(
f"rendertext.textbrowser_imp.{self.currenttype}"
)
if self.currenttype not in static_data["textrender"]["textbrowser"]:
self.currenttype = static_data["textrender"]["textbrowser"][0]
globalconfig["rendertext_using_internal"]["textbrowser"] = static_data[
"textrender"
]["textbrowser"][0]
__ = importlib.import_module(f"rendertext.textbrowser_imp.{self.currenttype}")
self.currentclass = functools.partial(__.TextLine, self.currenttype)

View File

@ -20,7 +20,10 @@ class TextLine(base):
return (fontOutLineWidth, fontOutLineWidth)
def colorpair(self):
return QColor(self.config["fillcolor"]), QColor(self.basecolor)
_ = QColor(self.config["fillcolor"]), QColor(self.basecolor)
if self.config["reverse"]:
_ = reversed(_)
return _
def paintText(self, painter: QPainter):
self.m_outLineColor, self.m_contentColor = self.colorpair()

View File

@ -1,7 +0,0 @@
from qtsymbols import *
from rendertext.textbrowser_imp.miaobian1 import TextLine as TB1
class TextLine(TB1):
def colorpair(self):
return QColor(self.basecolor), QColor(self.config["fillcolor"])

View File

@ -14,6 +14,7 @@
margin-bottom: 0;
/* word-break: break-all; */
}
body::-webkit-scrollbar {
display: none;
}
@ -88,7 +89,13 @@
ele.appendChild(style)
return ele
}
function miaobian12_common(styleargs, text, args, c1, c2) {
function miaobian12_common(styleargs, text, args) {
let c2 = args.color
let c1 = styleargs.fillcolor
if (styleargs.reverse) {
c2 = styleargs.fillcolor
c1 = args.color
}
let ele = document.createElement('div')
let _id = _simpleuid()
ele.id = _id
@ -124,24 +131,11 @@
return ele
}
function miaobian2_create_internal(styleargs, text, args) {
let c1 = args.color
let c2 = styleargs.fillcolor
return miaobian12_common(styleargs, text, args, c1, c2)
}
function miaobian1_create_internal(styleargs, text, args) {
let c2 = args.color
let c1 = styleargs.fillcolor
return miaobian12_common(styleargs, text, args, c1, c2)
}
regist_style_imp = {
normal: normal_create_internal,
yinying: yinying_create_internal,
miaobian0: miaobian0_create_internal,
miaobian1: miaobian1_create_internal,
miaobian2: miaobian2_create_internal,
miaobian1: miaobian12_common,
}
</script>
<script>

View File

@ -2,9 +2,8 @@ from qtsymbols import *
from rendertext.somefunctions import dataget
import gobject, uuid, json, os, functools
from urllib.parse import quote
from myutils.config import globalconfig
from gui.usefulwidget import WebivewWidget, QWebWrap, saveposwindow
from myutils.utils import checkportavailable
from myutils.config import globalconfig, static_data
from gui.usefulwidget import WebivewWidget, QWebWrap
testsavejs = False
@ -160,13 +159,23 @@ class TextBrowser(QWidget, dataget):
return fmetrics.height()
def _getstylevalid(self):
currenttype = globalconfig["rendertext_using_internal"]["webview"]
if currenttype not in static_data["textrender"]["webview"]:
currenttype = static_data["textrender"]["webview"][0]
globalconfig["rendertext_using_internal"]["webview"] = static_data[
"textrender"
]["webview"][0]
return currenttype
def _webview_append(self, _id, origin, atcenter, text, tag, flags, color):
fmori, fsori, boldori = self._getfontinfo(origin)
fmkana, fskana, boldkana = self._getfontinfo_kana()
kanacolor = self._getkanacolor()
line_height = self.measureH(fmori, fsori) + globalconfig["extra_space"]
style = globalconfig["rendertext_using_internal"]["webview"]
style = self._getstylevalid()
styleargs = globalconfig["rendertext"]["webview"][style].get("args", {})
if len(tag):
isshowhira, isshow_fenci, isfenciclick = flags

View File

@ -89,37 +89,14 @@
"args": {
"fillcolor": "#eeeeee",
"width_rate": 0.1,
"width": 3
"width": 3,
"reverse": true
},
"argstype": {
"fillcolor": {
"name": "填充颜色",
"type": "colorselect"
"reverse": {
"name": "反转颜色",
"type": "switch"
},
"width": {
"name": "描边宽度_固定值",
"type": "spin",
"min": 0,
"max": 100,
"step": 0.1
},
"width_rate": {
"name": "描边宽度_字体倍率",
"type": "spin",
"min": 0,
"max": 10,
"step": 0.01
}
}
},
"miaobian2": {
"name": "描边字体_3",
"args": {
"fillcolor": "#eeeeee",
"width_rate": 0.1,
"width": 3
},
"argstype": {
"fillcolor": {
"name": "填充颜色",
"type": "colorselect"
@ -171,45 +148,14 @@
"fillcolor": "#eeeeee",
"width_rate": 0.1,
"width": 3,
"trace": 5
"trace": 5,
"reverse": true
},
"argstype": {
"fillcolor": {
"name": "填充颜色",
"type": "colorselect"
"reverse": {
"name": "反转颜色",
"type": "switch"
},
"width": {
"name": "描边宽度_固定值",
"type": "spin",
"min": 0,
"max": 100,
"step": 0.1
},
"width_rate": {
"name": "描边宽度_字体倍率",
"type": "spin",
"min": 0,
"max": 10,
"step": 0.01
},
"trace": {
"name": "投影距离",
"type": "intspin",
"min": 0,
"max": 100,
"step": 1
}
}
},
"miaobian2": {
"name": "描边字体_3",
"args": {
"fillcolor": "#eeeeee",
"width_rate": 0.1,
"width": 3,
"trace": 5
},
"argstype": {
"fillcolor": {
"name": "填充颜色",
"type": "colorselect"

View File

@ -1679,15 +1679,13 @@
"normal",
"yinying",
"miaobian0",
"miaobian1",
"miaobian2"
"miaobian1"
],
"webview": [
"normal",
"yinying",
"miaobian0",
"miaobian1",
"miaobian2"
"miaobian1"
]
}
}

View File

@ -809,5 +809,6 @@
"字体倍率": "معدل الخط",
"固定值": "قيمة ثابتة",
"可选取的": "قابل للاختيار",
"投影距离": "المسافة المتوقعة"
"投影距离": "المسافة المتوقعة",
"反转颜色": "عكس اللون"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "字體倍率",
"固定值": "固定值",
"可选取的": "可選取的",
"投影距离": "投影距離"
"投影距离": "投影距離",
"反转颜色": "反轉顏色"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Font magnification",
"固定值": "Fixed value",
"可选取的": "Selectable",
"投影距离": "Projection distance"
"投影距离": "Projection distance",
"反转颜色": "invert colors"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Multiplicación de fuentes",
"固定值": "Valor fijo",
"可选取的": "Seleccionable",
"投影距离": "Distancia de proyección"
"投影距离": "Distancia de proyección",
"反转颜色": "Invertir color"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Multiplication des polices",
"固定值": "Valeur fixe",
"可选取的": "Sélectionnable",
"投影距离": "Distance de projection"
"投影距离": "Distance de projection",
"反转颜色": "Inverser les couleurs"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Ingrandimento dei caratteri",
"固定值": "Valore fisso",
"可选取的": "Selezionabile",
"投影距离": "Distanza di proiezione"
"投影距离": "Distanza di proiezione",
"反转颜色": "inverti colori"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "フォント倍率",
"固定值": "固定値",
"可选取的": "選択可能",
"投影距离": "とうえいきょり"
"投影距离": "とうえいきょり",
"反转颜色": "色を反転"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "글꼴 배율",
"固定值": "고정값",
"可选取的": "선택 가능",
"投影距离": "투영 거리"
"投影距离": "투영 거리",
"反转颜色": "색상 반전"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Powiększenie czcionki",
"固定值": "Wartość stała",
"可选取的": "Wybór",
"投影距离": "Odległość projekcji"
"投影距离": "Odległość projekcji",
"反转颜色": "odwróć kolory"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Увеличить шрифт",
"固定值": "Постоянная величина",
"可选取的": "Выбор",
"投影距离": "Расстояние проекции"
"投影距离": "Расстояние проекции",
"反转颜色": "Инвертировать цвет"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "แบบอักษรคูณ",
"固定值": "ค่าคงที่",
"可选取的": "เลือกได้",
"投影距离": "ระยะการฉาย"
"投影距离": "ระยะการฉาย",
"反转颜色": "การย้อนกลับสี"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Yazıtipi büyütmesi",
"固定值": "Tam değer",
"可选取的": "Seçilebilir",
"投影距离": "Projeksyon mesafesi"
"投影距离": "Projeksyon mesafesi",
"反转颜色": "Ters renkler"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Збільшення шрифту",
"固定值": "Визначене значення",
"可选取的": "Вибраний",
"投影距离": "Відстань проекту"
"投影距离": "Відстань проекту",
"反转颜色": "звернути кольори"
}

View File

@ -809,5 +809,6 @@
"字体倍率": "Độ phóng đại phông chữ",
"固定值": "Giá trị cố định",
"可选取的": "Chọn",
"投影距离": "Khoảng cách chiếu"
"投影距离": "Khoảng cách chiếu",
"反转颜色": "Đảo ngược màu"
}

View File

@ -809,5 +809,6 @@
"阴影半径": "",
"字体倍率": "",
"固定值": "",
"投影距离": ""
"投影距离": "",
"反转颜色": ""
}