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
4e39556d
authored
2025-12-02 15:10:18 +0800
by
shady
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
修复前景色不显示的问题
1 parent
e8857bcd
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
73 deletions
.idea/misc.xml
config.json
image_generator.py
screenshot.png
.idea/misc.xml
View file @
4e39556
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"Black"
>
<option
name=
"sdkName"
value=
"Python 3.9 (GoogleNanoBananaApp) (2)"
/>
</component>
<component
name=
"ProjectRootManager"
version=
"2"
project-jdk-name=
"Python 3.9 (GoogleNanoBananaApp) (2)"
project-jdk-type=
"Python SDK"
/>
</project>
\ No newline at end of file
...
...
config.json
View file @
4e39556
{
"api_key"
:
"AIzaSyBRIH8iItqTZXg7d4zAWVNhyit2CZbXWIU"
,
"saved_prompts"
:
[
"
生成一张白人夫妻正常的买家秀展现我的戒指
"
,
"主石换成闪耀的
鸽血红红宝石,火彩非常好
"
,
"
生成一张白人夫妻在自家后院里的椅子坐着,亲密姿态,展现笑容,妻子手背捂嘴笑来展现我的戒指,两个人年龄大概40岁上下,男性微胖,女性短发,男士和女士脸上有一些痕迹,手要略显粗糙,普通人长相
"
,
"
一副美丽的嵖岈山风景,冬日清晨,初雪
"
"
主石换成闪耀的祖母绿
"
,
"主石换成闪耀的
钻石
"
,
"
主石换成闪耀的莫桑石
"
,
"
主石换成闪耀的鸽血红宝石
"
],
"db_config"
:
{
"host"
:
"rm-uf6hx9ka75jdm2474xo.mysql.rds.aliyuncs.com"
,
...
...
@@ -15,5 +15,5 @@
"table"
:
"nano_banana_users"
},
"last_user"
:
"testuser"
,
"saved_password_hash"
:
""
"saved_password_hash"
:
"
50630320e4a550f2dba371820dad9d9301d456d101aca4d5ad8f4f3bcc9c1ed9
"
}
\ No newline at end of file
...
...
image_generator.py
View file @
4e39556
...
...
@@ -114,20 +114,22 @@ class LoginDialog(QDialog):
main_layout
.
addSpacing
(
10
)
# Form layout for username and password
form_layout
=
QFormLayout
()
form_layout
.
setSpacing
(
15
)
# Username
# Username field
username_label
=
QLabel
(
"用户名"
)
username_label
.
setObjectName
(
"field_label"
)
main_layout
.
addWidget
(
username_label
)
self
.
username_entry
=
QLineEdit
()
self
.
username_entry
.
setText
(
self
.
last_user
)
form_layout
.
addRow
(
username_label
,
self
.
username_entry
)
main_layout
.
addWidget
(
self
.
username_entry
)
main_layout
.
addSpacing
(
10
)
# Password
# Password
field
password_label
=
QLabel
(
"密码"
)
password_label
.
setObjectName
(
"field_label"
)
main_layout
.
addWidget
(
password_label
)
self
.
password_entry
=
QLineEdit
()
self
.
password_entry
.
setEchoMode
(
QLineEdit
.
Password
)
...
...
@@ -139,9 +141,7 @@ class LoginDialog(QDialog):
self
.
password_entry
.
textChanged
.
connect
(
self
.
on_password_change
)
self
.
password_entry
.
returnPressed
.
connect
(
self
.
on_login
)
form_layout
.
addRow
(
password_label
,
self
.
password_entry
)
main_layout
.
addLayout
(
form_layout
)
main_layout
.
addWidget
(
self
.
password_entry
)
# Checkboxes
checkbox_layout
=
QHBoxLayout
()
...
...
@@ -483,8 +483,6 @@ class ImageGeneratorWindow(QMainWindow):
prompt_toolbar
.
addWidget
(
QLabel
(
"快速选择:"
))
self
.
saved_prompts_combo
=
QComboBox
()
self
.
saved_prompts_combo
.
currentIndexChanged
.
connect
(
self
.
load_saved_prompt
)
self
.
update_saved_prompts_list
()
prompt_toolbar
.
addWidget
(
self
.
saved_prompts_combo
)
delete_prompt_btn
=
QPushButton
(
"🗑️ 删除"
)
...
...
@@ -500,6 +498,9 @@ class ImageGeneratorWindow(QMainWindow):
self
.
prompt_text
.
textChanged
.
connect
(
self
.
check_favorite_status
)
prompt_layout
.
addWidget
(
self
.
prompt_text
)
# Update list first (before connecting signal to avoid triggering it during init)
self
.
update_saved_prompts_list
()
prompt_group
.
setLayout
(
prompt_layout
)
content_row
.
addWidget
(
prompt_group
,
2
)
...
...
@@ -517,7 +518,7 @@ class ImageGeneratorWindow(QMainWindow):
settings_layout
.
addWidget
(
QLabel
(
"图片尺寸"
))
self
.
image_size
=
QComboBox
()
self
.
image_size
.
addItems
([
"1K"
,
"2K"
,
"4K"
])
self
.
image_size
.
setCurrentIndex
(
1
)
self
.
image_size
.
setCurrentIndex
(
1
)
# Default to 2K
settings_layout
.
addWidget
(
self
.
image_size
)
settings_layout
.
addStretch
()
...
...
@@ -563,62 +564,58 @@ class ImageGeneratorWindow(QMainWindow):
def
apply_styles
(
self
):
"""Apply QSS stylesheet"""
"""Apply QSS stylesheet - 最小化自定义样式"""
self
.
setStyleSheet
(
"""
QMainWindow {
background-color: #ffffff;
}
QGroupBox {
font-weight: bold;
font-size: 10pt;
border: 1px solid #e5e5e5;
border-radius: 6px;
margin-top: 10px;
padding-top: 10px;
}
QGroupBox::title {
color: #1d1d1f;
subcontrol-origin: margin;
left: 10px;
padding: 0 5px;
}
QPushButton {
background-color: #f6f6f6;
color: #1d1d1f;
border: 1px solid #e5e5e5;
border-radius: 4px;
padding: 6px 12px;
font-size: 9pt;
}
QPushButton:hover {
background-color: #e8e8e8;
}
QPushButton:pressed {
background-color: #c8c8c8;
}
QPushButton:disabled {
background-color: #f6f6f6;
color: #999999;
}
QComboBox {
border: 1px solid #e5e5e5;
border-radius: 4px;
padding: 5px;
background-color: white;
}
QTextEdit {
border: 1px solid #e5e5e5;
border-radius: 4px;
background-color: #fafafa;
font-size: 10pt;
}
QLabel {
color: #1d1d1f;
}
QScrollArea {
border: none;
background-color: #f6f6f6;
}
"""
)
QMainWindow {
background-color: #ffffff;
}
QGroupBox {
font-weight: bold;
font-size: 10pt;
border: 1px solid #e5e5e5;
border-radius: 6px;
margin-top: 10px;
padding-top: 10px;
}
QGroupBox::title {
subcontrol-origin: margin;
left: 10px;
padding: 0 5px;
}
QPushButton {
padding: 6px 12px;
font-size: 9pt;
border: 1px solid #cccccc;
border-radius: 4px;
}
QPushButton:disabled {
color: #999999;
}
QComboBox {
padding: 5px;
min-width: 100px;
}
QTextEdit {
border: 1px solid #e5e5e5;
border-radius: 4px;
font-size: 10pt;
}
QScrollArea {
border: none;
background-color: #f6f6f6;
}
/* 只保留必要的边框和背景,不设置颜色 */
QLineEdit, QComboBox, QTextEdit {
border: 1px solid #cccccc;
border-radius: 4px;
}
QLineEdit:focus, QComboBox:focus, QTextEdit:focus {
border: 1px solid #007AFF; /* 保持焦点状态 */
}
"""
)
# Connect signals after all widgets are created
self
.
saved_prompts_combo
.
currentIndexChanged
.
connect
(
self
.
load_saved_prompt
)
def
upload_images
(
self
):
"""Upload reference images"""
...
...
@@ -710,10 +707,13 @@ class ImageGeneratorWindow(QMainWindow):
def
update_saved_prompts_list
(
self
):
"""Update the saved prompts dropdown"""
# Block signals to avoid triggering load_saved_prompt during update
self
.
saved_prompts_combo
.
blockSignals
(
True
)
self
.
saved_prompts_combo
.
clear
()
if
self
.
saved_prompts
:
display_prompts
=
[
p
[:
50
]
+
"..."
if
len
(
p
)
>
50
else
p
for
p
in
self
.
saved_prompts
]
self
.
saved_prompts_combo
.
addItems
(
display_prompts
)
self
.
saved_prompts_combo
.
blockSignals
(
False
)
def
check_favorite_status
(
self
):
"""Check if current prompt is favorited"""
...
...
screenshot.png
deleted
100644 → 0
View file @
e8857bc
41.6 KB
Please
register
or
sign in
to post a comment