This commit is contained in:
恍兮惚兮 2024-11-03 12:39:29 +08:00
parent c679924b03
commit 2cb8a09c64
2 changed files with 8 additions and 9 deletions

View File

@ -10,6 +10,7 @@ from myutils.config import (
static_data, static_data,
getlanguse, getlanguse,
set_font_default, set_font_default,
_TR,
) )
from ctypes import c_int, CFUNCTYPE, c_void_p from ctypes import c_int, CFUNCTYPE, c_void_p
from myutils.utils import ( from myutils.utils import (
@ -512,11 +513,11 @@ class MAINUI:
safe_callback = ( safe_callback = (
waitforresultcallback if waitforresultcallback else lambda _: 1 waitforresultcallback if waitforresultcallback else lambda _: 1
) )
apiname = _TR(dynamicapiname(classname))
if iserror: if iserror:
if currentsignature == self.currentsignature: if currentsignature == self.currentsignature:
self.translation_ui.displaystatus.emit( self.translation_ui.displaystatus.emit(
dynamicapiname(classname) + " " + res, apiname + " " + res,
True, True,
False, False,
) )
@ -540,7 +541,7 @@ class MAINUI:
iter_res_status in (0, 1) iter_res_status in (0, 1)
): ):
displayreskwargs = dict( displayreskwargs = dict(
name=dynamicapiname(classname), name=apiname,
color=globalconfig["fanyi"][classname]["color"], color=globalconfig["fanyi"][classname]["color"],
res=res, res=res,
iter_context=(iter_res_status, classname), iter_context=(iter_res_status, classname),
@ -548,7 +549,7 @@ class MAINUI:
self.translation_ui.displayres.emit(displayreskwargs) self.translation_ui.displayres.emit(displayreskwargs)
if iter_res_status in (0, 2): # 0为普通1为iter2为iter终止 if iter_res_status in (0, 2): # 0为普通1为iter2为iter终止
self.transhis.getnewtranssignal.emit(dynamicapiname(classname), res) self.transhis.getnewtranssignal.emit(apiname, res)
if not waitforresultcallback: if not waitforresultcallback:
if ( if (
globalconfig["read_trans"] globalconfig["read_trans"]
@ -820,9 +821,7 @@ class MAINUI:
return aclass(classname) return aclass(classname)
except Exception as e: except Exception as e:
self.displayinfomessage( self.displayinfomessage(
dynamicapiname(classname) dynamicapiname(classname) + " import failed : " + str(stringfyerror(e)),
+ " import failed : "
+ str(stringfyerror(e)),
"<msg_error_not_refresh>", "<msg_error_not_refresh>",
) )
raise e raise e

View File

@ -363,12 +363,12 @@ class basetrans(commonbase):
self.longtermcacheset(cache_use, res) self.longtermcacheset(cache_use, res)
def __parse_gpt_dict(self, contentsolved, optimization_params): def __parse_gpt_dict(self, contentsolved, optimization_params):
gpt_dict = None gpt_dict = []
contentraw = contentsolved contentraw = contentsolved
for _ in optimization_params: for _ in optimization_params:
if isinstance(_, dict): if isinstance(_, dict):
_gpt_dict = _.get("gpt_dict", None) _gpt_dict = _.get("gpt_dict", None)
if _gpt_dict is None: if not _gpt_dict:
continue continue
gpt_dict = _gpt_dict gpt_dict = _gpt_dict
contentraw = _.get("gpt_dict_origin") contentraw = _.get("gpt_dict_origin")