From cda0432d8956323fe56abfe1ff74cd619be1ce0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?= <101191390+HIllya51@users.noreply.github.com> Date: Tue, 1 Oct 2024 23:55:08 +0800 Subject: [PATCH] fix --- .../LunaTranslator/gui/dialog_savedgame_v3.py | 12 ++++++------ LunaTranslator/LunaTranslator/gui/usefulwidget.py | 8 ++++++-- LunaTranslator/LunaTranslator/myutils/hwnd.py | 4 +++- plugins/CMakeLists.txt | 2 +- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py index e6682614..192b9a92 100644 --- a/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py +++ b/LunaTranslator/LunaTranslator/gui/dialog_savedgame_v3.py @@ -589,12 +589,12 @@ class pixwrapper(QWidget): deleteimage_x = LAction(("删除图片文件")) hualang = LAction(("画廊")) pos = LAction(("位置")) - - menu.addAction(setimage) - menu.addAction(seticon) - menu.addAction(copyimage) - menu.addAction(deleteimage) - menu.addAction(deleteimage_x) + if curr and os.path.exists(curr): + menu.addAction(setimage) + menu.addAction(seticon) + menu.addAction(copyimage) + menu.addAction(deleteimage) + menu.addAction(deleteimage_x) menu.addAction(hualang) if _1: menu.addSeparator() diff --git a/LunaTranslator/LunaTranslator/gui/usefulwidget.py b/LunaTranslator/LunaTranslator/gui/usefulwidget.py index 7e84ba0c..70dab5c4 100644 --- a/LunaTranslator/LunaTranslator/gui/usefulwidget.py +++ b/LunaTranslator/LunaTranslator/gui/usefulwidget.py @@ -1,5 +1,5 @@ from qtsymbols import * -import os, platform, functools, uuid, json, math, csv, io +import os, platform, functools, uuid, json, math, csv, io, pickle from traceback import print_exc import windows, qtawesome, winsharedutils, gobject from webviewpy import webview_native_handle_kind_t, Webview, declare_library_path @@ -1955,6 +1955,8 @@ class listediter(LDialog): rows = self.hcmodel.rowCount() rowoffset = 0 dedump = set() + if self.closecallback: + before = pickle.dumps(self.lst) self.lst.clear() for row in range(rows): if self.namemapfunction: @@ -1967,7 +1969,9 @@ class listediter(LDialog): self.lst.append(k) dedump.add(k) if self.closecallback: - self.closecallback() + after = pickle.dumps(self.lst) + if before != after: + self.closecallback() def __cb(self, paths): if isinstance(paths, str): diff --git a/LunaTranslator/LunaTranslator/myutils/hwnd.py b/LunaTranslator/LunaTranslator/myutils/hwnd.py index 480ccbff..9270c73a 100644 --- a/LunaTranslator/LunaTranslator/myutils/hwnd.py +++ b/LunaTranslator/LunaTranslator/myutils/hwnd.py @@ -5,11 +5,13 @@ import gobject import os, subprocess, functools import time, winrtutils, winsharedutils, hashlib from myutils.config import savehook_new_data, globalconfig -from myutils.wrapper import threader, tryprint +from myutils.wrapper import threader from myutils.utils import qimage2binary def clipboard_set_image(p: QImage): + if not p: + return if isinstance(p, str): qimg = QImage() qimg.load(p) diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index b93e2369..dc218c9d 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -29,7 +29,7 @@ include(generate_product_version) set(VERSION_MAJOR 5) set(VERSION_MINOR 41) -set(VERSION_PATCH 0) +set(VERSION_PATCH 1) add_library(pch pch.cpp) target_precompile_headers(pch PUBLIC pch.h)