mirror of
https://github.com/HIllya51/LunaTranslator.git
synced 2024-12-29 00:24:13 +08:00
fix
This commit is contained in:
parent
9638fda582
commit
7404c1911c
@ -91,7 +91,12 @@ class MAINUI:
|
|||||||
|
|
||||||
@threader
|
@threader
|
||||||
def safeloadprocessmodels(self):
|
def safeloadprocessmodels(self):
|
||||||
for model in ["noundict", "gongxiangcishu", "transerrorfix", "myprocess"]:
|
for model, d, k in [
|
||||||
|
("noundict", noundictconfig, "use"),
|
||||||
|
("transerrorfix", transerrorfixdictconfig, "use"),
|
||||||
|
("gongxiangcishu", globalconfig["gongxiangcishu"], "use"),
|
||||||
|
("myprocess", globalconfig, "selfdefinedprocesspair"),
|
||||||
|
]:
|
||||||
try:
|
try:
|
||||||
if model == "myprocess":
|
if model == "myprocess":
|
||||||
mm = "myprocess"
|
mm = "myprocess"
|
||||||
@ -101,7 +106,17 @@ class MAINUI:
|
|||||||
checkpath = "./LunaTranslator/transoptimi/" + model + ".py"
|
checkpath = "./LunaTranslator/transoptimi/" + model + ".py"
|
||||||
if os.path.exists(checkpath) == False:
|
if os.path.exists(checkpath) == False:
|
||||||
continue
|
continue
|
||||||
klass = importlib.import_module(mm).Process()
|
Process = importlib.import_module(mm).Process
|
||||||
|
|
||||||
|
def __(kls, _d, _k):
|
||||||
|
class klass(kls):
|
||||||
|
@property
|
||||||
|
def using(self):
|
||||||
|
return _d[_k]
|
||||||
|
|
||||||
|
return klass()
|
||||||
|
|
||||||
|
klass = __(Process, d, k)
|
||||||
process_before = klass.process_before
|
process_before = klass.process_before
|
||||||
process_after = klass.process_after
|
process_after = klass.process_after
|
||||||
self.processmethods.append(klass)
|
self.processmethods.append(klass)
|
||||||
|
@ -326,10 +326,6 @@ def POSTSOLVE(line):
|
|||||||
ff.write(
|
ff.write(
|
||||||
"""
|
"""
|
||||||
class Process:
|
class Process:
|
||||||
@property
|
|
||||||
def using(self):
|
|
||||||
return True
|
|
||||||
|
|
||||||
def process_before(self, text):
|
def process_before(self, text):
|
||||||
context = {}
|
context = {}
|
||||||
return text, context
|
return text, context
|
||||||
|
@ -87,9 +87,6 @@ def vnrshareddict(self):
|
|||||||
|
|
||||||
|
|
||||||
class Process:
|
class Process:
|
||||||
@property
|
|
||||||
def using(self):
|
|
||||||
return globalconfig["gongxiangcishu"]["use"]
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.status = None
|
self.status = None
|
||||||
@ -133,4 +130,4 @@ class Process:
|
|||||||
for key, value in self.sorted_vnrshareddict_post:
|
for key, value in self.sorted_vnrshareddict_post:
|
||||||
if key in res:
|
if key in res:
|
||||||
res = res.replace(key, value["text"])
|
res = res.replace(key, value["text"])
|
||||||
return res
|
return res
|
||||||
|
@ -3,9 +3,6 @@ import gobject, re
|
|||||||
|
|
||||||
|
|
||||||
class Process:
|
class Process:
|
||||||
@property
|
|
||||||
def using(self):
|
|
||||||
return noundictconfig["use"]
|
|
||||||
|
|
||||||
def process_before(self, content):
|
def process_before(self, content):
|
||||||
|
|
||||||
|
@ -3,9 +3,6 @@ from myutils.utils import parsemayberegexreplace
|
|||||||
|
|
||||||
|
|
||||||
class Process:
|
class Process:
|
||||||
@property
|
|
||||||
def using(self):
|
|
||||||
return transerrorfixdictconfig["use"]
|
|
||||||
|
|
||||||
def process_before(self, content):
|
def process_before(self, content):
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user