This commit is contained in:
恍兮惚兮 2024-06-15 01:28:56 +08:00
parent 9250c15940
commit 5d8ca201dd
5 changed files with 34 additions and 42 deletions

View File

@ -162,44 +162,39 @@ class MAINUI:
returnandembedcallback = lambda: embedcallback("") if embedcallback else "" returnandembedcallback = lambda: embedcallback("") if embedcallback else ""
if type(text) == str: if text.startswith("<notrans>"):
if text.startswith("<notrans>"): self.translation_ui.displayres.emit(
self.translation_ui.displayres.emit( dict(
dict( color=globalconfig["rawtextcolor"],
color=globalconfig["rawtextcolor"], res=text[len("<notrans>") :],
res=text[len("<notrans>") :], onlytrans=onlytrans,
onlytrans=onlytrans, clear=True,
clear=True,
)
) )
self.currenttext = text )
self.currenttranslate = text self.currenttext = text
self.currentread = text self.currenttranslate = text
return self.currentread = text
else: return
msgs = [ else:
("<msg_info_not_refresh>", globalconfig["rawtextcolor"], False), msgs = [
("<msg_info_refresh>", globalconfig["rawtextcolor"], True), ("<msg_info_not_refresh>", globalconfig["rawtextcolor"], False),
("<msg_error_not_refresh>", "red", False), ("<msg_info_refresh>", globalconfig["rawtextcolor"], True),
("<msg_error_refresh>", "red", True), ("<msg_error_not_refresh>", "red", False),
] ("<msg_error_refresh>", "red", True),
for msg, color, refresh in msgs: ]
if text.startswith(msg): for msg, color, refresh in msgs:
self.translation_ui.displaystatus.emit( if text.startswith(msg):
text[len(msg) :], color, refresh, False self.translation_ui.displaystatus.emit(
) text[len(msg) :], color, refresh, False
return )
if text == "" or len(text) > 100000: return
return returnandembedcallback() if text == "" or len(text) > 100000:
return returnandembedcallback()
if onlytrans == False: if onlytrans == False:
self.currentsignature = time.time() self.currentsignature = time.time()
try: try:
if type(text) == list: origin = text
origin = "\n".join(text) text = self._POSTSOLVE(text)
text = "\n".join([self._POSTSOLVE(_) for _ in text])
else:
origin = text
text = self._POSTSOLVE(text)
except Exception as e: except Exception as e:
msg = str(type(e))[8:-2] + " " + str(e).replace("\n", "").replace("\r", "") msg = str(type(e))[8:-2] + " " + str(e).replace("\n", "").replace("\r", "")
self.translation_ui.displaystatus.emit(msg, "red", True, True) self.translation_ui.displaystatus.emit(msg, "red", True, True)
@ -725,7 +720,6 @@ class MAINUI:
print_exc() print_exc()
def autohookmonitorthread(self): def autohookmonitorthread(self):
while self.isrunning: while self.isrunning:
self.onwindowloadautohook() self.onwindowloadautohook()
@ -895,6 +889,7 @@ class MAINUI:
__t = time.time() __t = time.time()
time.sleep(1) time.sleep(1)
_t = time.time() _t = time.time()
def isok(name_): def isok(name_):
savehook_new_data[name_]["statistic_playtime"] += _t - __t savehook_new_data[name_]["statistic_playtime"] += _t - __t
if self.__currentexe == name_: if self.__currentexe == name_:

View File

@ -841,7 +841,7 @@ class dialog_setting_game_internal(QWidget):
else: else:
_methods = ["Locale-Emulator", "Locale_Remulator", "Ntleas"] _methods = ["Locale-Emulator", "Locale_Remulator", "Ntleas"]
if b == 6 and savehook_new_data[exepath]["localeswitcher"] == 0: if b == 6 and savehook_new_data[exepath]["localeswitcher"] == 0:
savehook_new_data[exepath]["localeswitcher"] = 2 savehook_new_data[exepath]["localeswitcher"] = 1
formLayout.addRow( formLayout.addRow(
_TR("转区启动"), _TR("转区启动"),
getboxlayout( getboxlayout(

View File

@ -453,7 +453,7 @@ class texthook(basetext):
collector.sort(key=lambda xx: self.selectedhook.index(xx[0])) collector.sort(key=lambda xx: self.selectedhook.index(xx[0]))
except: except:
pass pass
collector = [_[1] for _ in collector] collector = "\n".join([_[1] for _ in collector])
self.newline.put(collector) self.newline.put(collector)
self.runonce_line = collector self.runonce_line = collector

View File

@ -137,10 +137,7 @@ class basetext:
try: try:
t = self.gettextthread() t = self.gettextthread()
if t and globalconfig["autorun"]: if t and globalconfig["autorun"]:
if type(t) == tuple: self.textgetmethod(t)
self.textgetmethod(*t)
else:
self.textgetmethod(t)
except: except:
print_exc() print_exc()

View File

@ -29,7 +29,7 @@ include(generate_product_version)
set(VERSION_MAJOR 3) set(VERSION_MAJOR 3)
set(VERSION_MINOR 6) set(VERSION_MINOR 6)
set(VERSION_PATCH 2) set(VERSION_PATCH 3)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)