diff --git a/LunaTranslator/LunaTranslator/LunaTranslator.py b/LunaTranslator/LunaTranslator/LunaTranslator.py index bdc4a201..4176bef3 100644 --- a/LunaTranslator/LunaTranslator/LunaTranslator.py +++ b/LunaTranslator/LunaTranslator/LunaTranslator.py @@ -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: diff --git a/LunaTranslator/LunaTranslator/gui/attachprocessdialog.py b/LunaTranslator/LunaTranslator/gui/attachprocessdialog.py index ccf36353..ccd56f8f 100644 --- a/LunaTranslator/LunaTranslator/gui/attachprocessdialog.py +++ b/LunaTranslator/LunaTranslator/gui/attachprocessdialog.py @@ -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: diff --git a/LunaTranslator/LunaTranslator/gui/translatorUI.py b/LunaTranslator/LunaTranslator/gui/translatorUI.py index 818c712f..62923b2b 100644 --- a/LunaTranslator/LunaTranslator/gui/translatorUI.py +++ b/LunaTranslator/LunaTranslator/gui/translatorUI.py @@ -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) diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index bf26beda..d63455b3 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -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) diff --git a/LunaTranslator/LunaTranslator/myutils/audioplayer.py b/LunaTranslator/LunaTranslator/myutils/audioplayer.py index 6f1104f6..cbab2dbb 100644 --- a/LunaTranslator/LunaTranslator/myutils/audioplayer.py +++ b/LunaTranslator/LunaTranslator/myutils/audioplayer.py @@ -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) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 06756a1d..ed25f8b4 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -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)