Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
柴进
/
GoogleNanoBananaApp
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
dd2274bf
authored
2026-02-28 11:54:39 +0800
by
柴进
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
处理mac打包后粘贴图片缩略图不可见的问题
1 parent
932fb58c
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
image_generator.py
image_generator.py
View file @
dd2274b
...
...
@@ -2049,12 +2049,34 @@ class ImageGeneratorWindow(QMainWindow):
self
.
logger
.
info
(
"开始粘贴剪贴板图片"
)
image
=
self
.
_safe_get_clipboard_image
()
if
image
is
not
None
:
self
.
logger
.
info
(
f
"成功获取剪贴板图像: {image.width()}x{image.height()}"
)
self
.
add_clipboard_image
(
image
)
else
:
if
image
is
None
:
self
.
logger
.
warning
(
"剪贴板中没有可用的图像"
)
QMessageBox
.
information
(
self
,
"信息"
,
"剪贴板中没有图片,请先复制一张图片"
)
return
self
.
logger
.
info
(
f
"成功获取剪贴板图像: {image.width()}x{image.height()}"
)
# 保存到临时文件
timestamp
=
datetime
.
now
()
.
strftime
(
"
%
Y
%
m
%
d_
%
H
%
M
%
S_
%
f"
)
temp_dir
=
Path
(
tempfile
.
gettempdir
())
/
"nano_banana_app"
temp_dir
.
mkdir
(
exist_ok
=
True
)
temp_file_path
=
str
(
temp_dir
/
f
"clipboard_{timestamp}.png"
)
normalized
=
image
.
convertToFormat
(
QImage
.
Format
.
Format_ARGB32
)
if
not
normalized
.
save
(
temp_file_path
,
"PNG"
):
if
not
image
.
save
(
temp_file_path
,
"PNG"
):
self
.
logger
.
error
(
"剪贴板图片保存失败"
)
QMessageBox
.
critical
(
self
,
"错误"
,
"无法保存剪贴板图片"
)
return
self
.
logger
.
info
(
f
"剪贴板图片已保存: {temp_file_path}"
)
# 走和"添加图片"按钮完全相同的路径
self
.
uploaded_images
.
append
(
temp_file_path
)
self
.
update_image_preview
()
self
.
image_count_label
.
setText
(
f
"已选择 {len(self.uploaded_images)} 张"
)
self
.
status_label
.
setText
(
"● 已添加剪贴板图片"
)
self
.
status_label
.
setStyleSheet
(
"QLabel { color: #34C759; }"
)
except
Exception
as
e
:
self
.
logger
.
error
(
f
"粘贴剪贴板图片时发生错误: {str(e)}"
,
exc_info
=
True
)
...
...
Please
register
or
sign in
to post a comment