This commit is contained in:
恍兮惚兮 2024-04-14 17:49:23 +08:00
parent 9638fda582
commit 7404c1911c
5 changed files with 18 additions and 16 deletions

View File

@ -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)

View File

@ -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

View File

@ -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

View File

@ -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):

View File

@ -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):