This commit is contained in:
恍兮惚兮 2024-07-10 17:05:58 +08:00
parent 73a5680374
commit 2b5b995ecd
6 changed files with 13 additions and 17 deletions

View File

@ -1,4 +1,4 @@
import time
import time, uuid
import os, threading, sys
from qtsymbols import *
from traceback import print_exc
@ -199,7 +199,7 @@ class MAINUI:
if text == "" or len(text) > 100000:
return safe_embedcallback_none()
if onlytrans == False:
self.currentsignature = time.time()
self.currentsignature = uuid.uuid4()
try:
origin = text
text = self._POSTSOLVE(text)
@ -246,7 +246,7 @@ class MAINUI:
_showrawfunction = None
_showrawfunction_sig = 0
else:
_showrawfunction_sig = time.time()
_showrawfunction_sig = uuid.uuid4()
text_solved, optimization_params = self.solvebeforetrans(text)
@ -327,7 +327,8 @@ class MAINUI:
)
if no_available_translator:
safe_embedcallback_none()
_showrawfunction()
if _showrawfunction:
_showrawfunction()
def ifuse_fix_translate_rank_preprare(self, engine, onlytrans, embedcallback):
if onlytrans:

View File

@ -100,9 +100,7 @@ class AttachProcessDialog(saveposwindow):
self.layout1.addLayout(bottomlayout)
w.setLayout(self.layout1)
# self.setLayout(self.layout1)
self.setCentralWidget(w)
# print(time.time()-t1)
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.close)
@ -132,9 +130,7 @@ class AttachProcessDialog(saveposwindow):
###########################
self.model = QStandardItemModel(self.processList)
# print(time.time()-t1)
self.processlist = ListProcess()
# print(time.time()-t1)
self.processList.setModel(self.model)
for pid, pexe in self.processlist:
if pexe in self.iconcache:
@ -150,7 +146,6 @@ class AttachProcessDialog(saveposwindow):
if self.hookselectdialog:
self.hookselectdialog.realshowhide.emit(False)
self.refreshfunction()
# print(time.time()-t1)
def safesplit(self, process):
try:

View File

@ -1,5 +1,5 @@
from qtsymbols import *
import time, functools, threading, os, sys, importlib, shutil
import time, functools, threading, os, sys, importlib, shutil, uuid
from traceback import print_exc
import windows, qtawesome, gobject, winsharedutils
from myutils.wrapper import threader, trypass
@ -845,7 +845,7 @@ class QUnFrameWindow(resizableframeless):
limit + self.translate_text._padding + int(globalconfig["buttonsize"] * 1.5)
)
size = QSize(self.width(), newHeight)
self.autoresizesig = time.time()
self.autoresizesig = uuid.uuid4()
if newHeight > self.height():
self.resize(size)
else:
@ -914,7 +914,7 @@ class QUnFrameWindow(resizableframeless):
@threader
def dodelayhide(self, delay):
enter_sig = time.time()
enter_sig = uuid.uuid4()
self.enter_sig = enter_sig
while self.checkisentered():
time.sleep(0.1)

View File

@ -1,5 +1,5 @@
from qtsymbols import *
import os, platform, functools, threading, time
import os, platform, functools, threading, uuid
from traceback import print_exc
import windows, qtawesome, winsharedutils, gobject
from webviewpy import (
@ -898,7 +898,7 @@ class abstractwebview(QWidget):
if len(html) < self.html_limit:
self._setHtml(html)
else:
lastcachehtml = gobject.gettempdir(str(time.time()) + ".html")
lastcachehtml = gobject.gettempdir(str(uuid.uuid4()) + ".html")
with open(lastcachehtml, "w", encoding="utf8") as ff:
ff.write(html)
self.navigate(lastcachehtml)

View File

@ -42,10 +42,10 @@ class player_mci:
os.remove(lastfile)
def play(self, binary, volume):
tgt = gobject.gettempdir(f"tts/{time.time()}.wav")
i = str(uuid.uuid4())
tgt = gobject.gettempdir(f"tts/{i}.wav")
with open(tgt, "wb") as ff:
ff.write(binary)
i = str(uuid.uuid4())
context = (i, tgt)
windows.mciSendString(
'open "{}" type mpegvideo alias lunatranslator_mci_{}'.format(tgt, i)

View File

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