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

View File

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

View File

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

View File

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

View File

@ -42,10 +42,10 @@ class player_mci:
os.remove(lastfile) os.remove(lastfile)
def play(self, binary, volume): 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: with open(tgt, "wb") as ff:
ff.write(binary) ff.write(binary)
i = str(uuid.uuid4())
context = (i, tgt) context = (i, tgt)
windows.mciSendString( windows.mciSendString(
'open "{}" type mpegvideo alias lunatranslator_mci_{}'.format(tgt, i) '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_MAJOR 5)
set(VERSION_MINOR 9) set(VERSION_MINOR 9)
set(VERSION_PATCH 1) set(VERSION_PATCH 2)
add_library(pch pch.cpp) add_library(pch pch.cpp)
target_precompile_headers(pch PUBLIC pch.h) target_precompile_headers(pch PUBLIC pch.h)