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