mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-28 08:04:13 +08:00
refresh
This commit is contained in:
parent
b2fedcc5a0
commit
79cabf96ef
@ -93,8 +93,10 @@ class extrahtml(saveposwindow):
|
||||
|
||||
|
||||
def createinternalfontsettings(self, forml: LFormLayout, group, _type):
|
||||
|
||||
need = globalconfig["rendertext_using_internal"][group] != _type
|
||||
globalconfig["rendertext_using_internal"][group] = _type
|
||||
if need:
|
||||
gobject.baseobject.translation_ui.translate_text.refreshcontent()
|
||||
__internal = globalconfig["rendertext"][group][_type]
|
||||
dd = __internal.get("args", {})
|
||||
|
||||
@ -287,6 +289,7 @@ def resetgroudswitchcallback(self, group):
|
||||
globalconfig["rendertext_using_internal"][group]
|
||||
)
|
||||
)
|
||||
gobject.baseobject.translation_ui.translate_text.loadinternal()
|
||||
|
||||
|
||||
def creategoodfontwid(self):
|
||||
|
@ -1,6 +1,6 @@
|
||||
from qtsymbols import *
|
||||
from myutils.config import globalconfig
|
||||
import importlib
|
||||
import importlib, copy
|
||||
from webviewpy import webview_exception
|
||||
from gui.usefulwidget import getQMessageBox
|
||||
from traceback import print_exc
|
||||
@ -56,6 +56,16 @@ class Textbrowser(QFrame):
|
||||
self.textbrowser.setselectable(globalconfig["selectable"])
|
||||
self.textbrowser.showhideorigin(globalconfig["isshowrawtext"])
|
||||
self.textbrowser.showhidetranslate(globalconfig["showfanyi"])
|
||||
self.refreshcontent()
|
||||
|
||||
def refreshcontent(self):
|
||||
traces = self.trace.copy()
|
||||
self.clear()
|
||||
for t, trace in traces:
|
||||
if t == 0:
|
||||
self.append(*trace)
|
||||
elif t == 1:
|
||||
self.iter_append(*trace)
|
||||
|
||||
def __init__(self, parent):
|
||||
super().__init__(parent)
|
||||
@ -63,17 +73,22 @@ class Textbrowser(QFrame):
|
||||
self.textbrowser = None
|
||||
self.cleared = True
|
||||
self.curr_eng = None
|
||||
self.trace = []
|
||||
self.loadinternal()
|
||||
|
||||
def iter_append(self, iter_context_class, origin, atcenter, text, color):
|
||||
self.trace.append((1, (iter_context_class, origin, atcenter, text, color)))
|
||||
self.cleared = False
|
||||
self.textbrowser.iter_append(iter_context_class, origin, atcenter, text, color)
|
||||
|
||||
def append(self, origin, atcenter, text, tag, flags, color):
|
||||
self.trace.append(
|
||||
(0, (origin, atcenter, text, copy.deepcopy(tag), flags, color))
|
||||
)
|
||||
self.cleared = False
|
||||
self.textbrowser.append(origin, atcenter, text, tag, flags, color)
|
||||
|
||||
def clear(self):
|
||||
self.cleared = True
|
||||
self.trace.clear()
|
||||
self.textbrowser.clear()
|
||||
self.loadinternal()
|
||||
|
@ -1,7 +1,7 @@
|
||||
from qtsymbols import *
|
||||
from myutils.config import globalconfig, static_data
|
||||
from rendertext.somefunctions import dataget
|
||||
import gobject, functools, importlib, copy
|
||||
import gobject, functools, importlib
|
||||
from traceback import print_exc
|
||||
from rendertext.textbrowser_imp.base import base
|
||||
|
||||
@ -131,7 +131,6 @@ class TextBrowser(QWidget, dataget):
|
||||
self.iteryinyinglabelsave = {}
|
||||
self.saveiterclasspointer = {}
|
||||
self.extra_height = 0
|
||||
self.trace = []
|
||||
self.cleared = True
|
||||
self.resets1()
|
||||
|
||||
@ -204,13 +203,7 @@ class TextBrowser(QWidget, dataget):
|
||||
self.showhideorigin(show)
|
||||
|
||||
def showhideorigin(self, show):
|
||||
traces = self.trace.copy()
|
||||
self.clear()
|
||||
for t, trace in traces:
|
||||
if t == 0:
|
||||
self.append(*trace)
|
||||
elif t == 1:
|
||||
self.iter_append(*trace)
|
||||
self.parent().refreshcontent()
|
||||
|
||||
def checkskip(self, origin):
|
||||
if origin and not globalconfig["isshowrawtext"]:
|
||||
@ -220,7 +213,6 @@ class TextBrowser(QWidget, dataget):
|
||||
return False
|
||||
|
||||
def iter_append(self, iter_context_class, origin, atcenter, text, color):
|
||||
self.trace.append((1, (iter_context_class, origin, atcenter, text, color)))
|
||||
if self.checkskip(origin):
|
||||
return
|
||||
if iter_context_class not in self.saveiterclasspointer:
|
||||
@ -266,9 +258,6 @@ class TextBrowser(QWidget, dataget):
|
||||
self.cleared = False
|
||||
|
||||
def append(self, origin, atcenter, text, tag, flags, color):
|
||||
self.trace.append(
|
||||
(0, (origin, atcenter, text, copy.deepcopy(tag), flags, color))
|
||||
)
|
||||
if self.checkskip(origin):
|
||||
return
|
||||
if len(tag):
|
||||
@ -760,4 +749,3 @@ class TextBrowser(QWidget, dataget):
|
||||
self.saveiterclasspointer.clear()
|
||||
self.textbrowser.move(0, 0)
|
||||
self.atback_color.move(0, 0)
|
||||
self.trace = []
|
||||
|
@ -29,7 +29,7 @@ include(generate_product_version)
|
||||
|
||||
set(VERSION_MAJOR 5)
|
||||
set(VERSION_MINOR 38)
|
||||
set(VERSION_PATCH 5)
|
||||
set(VERSION_PATCH 6)
|
||||
|
||||
add_library(pch pch.cpp)
|
||||
target_precompile_headers(pch PUBLIC pch.h)
|
||||
|
Loading…
x
Reference in New Issue
Block a user