修复前景色不显示的问题
Showing
4 changed files
with
40 additions
and
37 deletions
| 1 | <?xml version="1.0" encoding="UTF-8"?> | 1 | <?xml version="1.0" encoding="UTF-8"?> |
| 2 | <project version="4"> | 2 | <project version="4"> |
| 3 | <component name="Black"> | ||
| 4 | <option name="sdkName" value="Python 3.9 (GoogleNanoBananaApp) (2)" /> | ||
| 5 | </component> | ||
| 3 | <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (GoogleNanoBananaApp) (2)" project-jdk-type="Python SDK" /> | 6 | <component name="ProjectRootManager" version="2" project-jdk-name="Python 3.9 (GoogleNanoBananaApp) (2)" project-jdk-type="Python SDK" /> |
| 4 | </project> | 7 | </project> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| 1 | { | 1 | { |
| 2 | "api_key": "AIzaSyBRIH8iItqTZXg7d4zAWVNhyit2CZbXWIU", | 2 | "api_key": "AIzaSyBRIH8iItqTZXg7d4zAWVNhyit2CZbXWIU", |
| 3 | "saved_prompts": [ | 3 | "saved_prompts": [ |
| 4 | "生成一张白人夫妻正常的买家秀展现我的戒指", | 4 | "主石换成闪耀的祖母绿", |
| 5 | "主石换成闪耀的鸽血红红宝石,火彩非常好", | 5 | "主石换成闪耀的钻石", |
| 6 | "生成一张白人夫妻在自家后院里的椅子坐着,亲密姿态,展现笑容,妻子手背捂嘴笑来展现我的戒指,两个人年龄大概40岁上下,男性微胖,女性短发,男士和女士脸上有一些痕迹,手要略显粗糙,普通人长相", | 6 | "主石换成闪耀的莫桑石", |
| 7 | "一副美丽的嵖岈山风景,冬日清晨,初雪" | 7 | "主石换成闪耀的鸽血红宝石" |
| 8 | ], | 8 | ], |
| 9 | "db_config": { | 9 | "db_config": { |
| 10 | "host": "rm-uf6hx9ka75jdm2474xo.mysql.rds.aliyuncs.com", | 10 | "host": "rm-uf6hx9ka75jdm2474xo.mysql.rds.aliyuncs.com", |
| ... | @@ -15,5 +15,5 @@ | ... | @@ -15,5 +15,5 @@ |
| 15 | "table": "nano_banana_users" | 15 | "table": "nano_banana_users" |
| 16 | }, | 16 | }, |
| 17 | "last_user": "testuser", | 17 | "last_user": "testuser", |
| 18 | "saved_password_hash": "" | 18 | "saved_password_hash": "50630320e4a550f2dba371820dad9d9301d456d101aca4d5ad8f4f3bcc9c1ed9" |
| 19 | } | 19 | } |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -114,20 +114,22 @@ class LoginDialog(QDialog): | ... | @@ -114,20 +114,22 @@ class LoginDialog(QDialog): |
| 114 | 114 | ||
| 115 | main_layout.addSpacing(10) | 115 | main_layout.addSpacing(10) |
| 116 | 116 | ||
| 117 | # Form layout for username and password | 117 | # Username field |
| 118 | form_layout = QFormLayout() | ||
| 119 | form_layout.setSpacing(15) | ||
| 120 | |||
| 121 | # Username | ||
| 122 | username_label = QLabel("用户名") | 118 | username_label = QLabel("用户名") |
| 123 | username_label.setObjectName("field_label") | 119 | username_label.setObjectName("field_label") |
| 120 | main_layout.addWidget(username_label) | ||
| 121 | |||
| 124 | self.username_entry = QLineEdit() | 122 | self.username_entry = QLineEdit() |
| 125 | self.username_entry.setText(self.last_user) | 123 | self.username_entry.setText(self.last_user) |
| 126 | form_layout.addRow(username_label, self.username_entry) | 124 | main_layout.addWidget(self.username_entry) |
| 125 | |||
| 126 | main_layout.addSpacing(10) | ||
| 127 | 127 | ||
| 128 | # Password | 128 | # Password field |
| 129 | password_label = QLabel("密码") | 129 | password_label = QLabel("密码") |
| 130 | password_label.setObjectName("field_label") | 130 | password_label.setObjectName("field_label") |
| 131 | main_layout.addWidget(password_label) | ||
| 132 | |||
| 131 | self.password_entry = QLineEdit() | 133 | self.password_entry = QLineEdit() |
| 132 | self.password_entry.setEchoMode(QLineEdit.Password) | 134 | self.password_entry.setEchoMode(QLineEdit.Password) |
| 133 | 135 | ||
| ... | @@ -139,9 +141,7 @@ class LoginDialog(QDialog): | ... | @@ -139,9 +141,7 @@ class LoginDialog(QDialog): |
| 139 | self.password_entry.textChanged.connect(self.on_password_change) | 141 | self.password_entry.textChanged.connect(self.on_password_change) |
| 140 | self.password_entry.returnPressed.connect(self.on_login) | 142 | self.password_entry.returnPressed.connect(self.on_login) |
| 141 | 143 | ||
| 142 | form_layout.addRow(password_label, self.password_entry) | 144 | main_layout.addWidget(self.password_entry) |
| 143 | |||
| 144 | main_layout.addLayout(form_layout) | ||
| 145 | 145 | ||
| 146 | # Checkboxes | 146 | # Checkboxes |
| 147 | checkbox_layout = QHBoxLayout() | 147 | checkbox_layout = QHBoxLayout() |
| ... | @@ -483,8 +483,6 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -483,8 +483,6 @@ class ImageGeneratorWindow(QMainWindow): |
| 483 | 483 | ||
| 484 | prompt_toolbar.addWidget(QLabel("快速选择:")) | 484 | prompt_toolbar.addWidget(QLabel("快速选择:")) |
| 485 | self.saved_prompts_combo = QComboBox() | 485 | self.saved_prompts_combo = QComboBox() |
| 486 | self.saved_prompts_combo.currentIndexChanged.connect(self.load_saved_prompt) | ||
| 487 | self.update_saved_prompts_list() | ||
| 488 | prompt_toolbar.addWidget(self.saved_prompts_combo) | 486 | prompt_toolbar.addWidget(self.saved_prompts_combo) |
| 489 | 487 | ||
| 490 | delete_prompt_btn = QPushButton("🗑️ 删除") | 488 | delete_prompt_btn = QPushButton("🗑️ 删除") |
| ... | @@ -500,6 +498,9 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -500,6 +498,9 @@ class ImageGeneratorWindow(QMainWindow): |
| 500 | self.prompt_text.textChanged.connect(self.check_favorite_status) | 498 | self.prompt_text.textChanged.connect(self.check_favorite_status) |
| 501 | prompt_layout.addWidget(self.prompt_text) | 499 | prompt_layout.addWidget(self.prompt_text) |
| 502 | 500 | ||
| 501 | # Update list first (before connecting signal to avoid triggering it during init) | ||
| 502 | self.update_saved_prompts_list() | ||
| 503 | |||
| 503 | prompt_group.setLayout(prompt_layout) | 504 | prompt_group.setLayout(prompt_layout) |
| 504 | content_row.addWidget(prompt_group, 2) | 505 | content_row.addWidget(prompt_group, 2) |
| 505 | 506 | ||
| ... | @@ -517,7 +518,7 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -517,7 +518,7 @@ class ImageGeneratorWindow(QMainWindow): |
| 517 | settings_layout.addWidget(QLabel("图片尺寸")) | 518 | settings_layout.addWidget(QLabel("图片尺寸")) |
| 518 | self.image_size = QComboBox() | 519 | self.image_size = QComboBox() |
| 519 | self.image_size.addItems(["1K", "2K", "4K"]) | 520 | self.image_size.addItems(["1K", "2K", "4K"]) |
| 520 | self.image_size.setCurrentIndex(1) | 521 | self.image_size.setCurrentIndex(1) # Default to 2K |
| 521 | settings_layout.addWidget(self.image_size) | 522 | settings_layout.addWidget(self.image_size) |
| 522 | 523 | ||
| 523 | settings_layout.addStretch() | 524 | settings_layout.addStretch() |
| ... | @@ -563,6 +564,7 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -563,6 +564,7 @@ class ImageGeneratorWindow(QMainWindow): |
| 563 | 564 | ||
| 564 | def apply_styles(self): | 565 | def apply_styles(self): |
| 565 | """Apply QSS stylesheet""" | 566 | """Apply QSS stylesheet""" |
| 567 | """Apply QSS stylesheet - 最小化自定义样式""" | ||
| 566 | self.setStyleSheet(""" | 568 | self.setStyleSheet(""" |
| 567 | QMainWindow { | 569 | QMainWindow { |
| 568 | background-color: #ffffff; | 570 | background-color: #ffffff; |
| ... | @@ -576,50 +578,45 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -576,50 +578,45 @@ class ImageGeneratorWindow(QMainWindow): |
| 576 | padding-top: 10px; | 578 | padding-top: 10px; |
| 577 | } | 579 | } |
| 578 | QGroupBox::title { | 580 | QGroupBox::title { |
| 579 | color: #1d1d1f; | ||
| 580 | subcontrol-origin: margin; | 581 | subcontrol-origin: margin; |
| 581 | left: 10px; | 582 | left: 10px; |
| 582 | padding: 0 5px; | 583 | padding: 0 5px; |
| 583 | } | 584 | } |
| 584 | QPushButton { | 585 | QPushButton { |
| 585 | background-color: #f6f6f6; | ||
| 586 | color: #1d1d1f; | ||
| 587 | border: 1px solid #e5e5e5; | ||
| 588 | border-radius: 4px; | ||
| 589 | padding: 6px 12px; | 586 | padding: 6px 12px; |
| 590 | font-size: 9pt; | 587 | font-size: 9pt; |
| 591 | } | 588 | border: 1px solid #cccccc; |
| 592 | QPushButton:hover { | 589 | border-radius: 4px; |
| 593 | background-color: #e8e8e8; | ||
| 594 | } | ||
| 595 | QPushButton:pressed { | ||
| 596 | background-color: #c8c8c8; | ||
| 597 | } | 590 | } |
| 598 | QPushButton:disabled { | 591 | QPushButton:disabled { |
| 599 | background-color: #f6f6f6; | ||
| 600 | color: #999999; | 592 | color: #999999; |
| 601 | } | 593 | } |
| 602 | QComboBox { | 594 | QComboBox { |
| 603 | border: 1px solid #e5e5e5; | ||
| 604 | border-radius: 4px; | ||
| 605 | padding: 5px; | 595 | padding: 5px; |
| 606 | background-color: white; | 596 | min-width: 100px; |
| 607 | } | 597 | } |
| 608 | QTextEdit { | 598 | QTextEdit { |
| 609 | border: 1px solid #e5e5e5; | 599 | border: 1px solid #e5e5e5; |
| 610 | border-radius: 4px; | 600 | border-radius: 4px; |
| 611 | background-color: #fafafa; | ||
| 612 | font-size: 10pt; | 601 | font-size: 10pt; |
| 613 | } | 602 | } |
| 614 | QLabel { | ||
| 615 | color: #1d1d1f; | ||
| 616 | } | ||
| 617 | QScrollArea { | 603 | QScrollArea { |
| 618 | border: none; | 604 | border: none; |
| 619 | background-color: #f6f6f6; | 605 | background-color: #f6f6f6; |
| 620 | } | 606 | } |
| 607 | /* 只保留必要的边框和背景,不设置颜色 */ | ||
| 608 | QLineEdit, QComboBox, QTextEdit { | ||
| 609 | border: 1px solid #cccccc; | ||
| 610 | border-radius: 4px; | ||
| 611 | } | ||
| 612 | QLineEdit:focus, QComboBox:focus, QTextEdit:focus { | ||
| 613 | border: 1px solid #007AFF; /* 保持焦点状态 */ | ||
| 614 | } | ||
| 621 | """) | 615 | """) |
| 622 | 616 | ||
| 617 | # Connect signals after all widgets are created | ||
| 618 | self.saved_prompts_combo.currentIndexChanged.connect(self.load_saved_prompt) | ||
| 619 | |||
| 623 | def upload_images(self): | 620 | def upload_images(self): |
| 624 | """Upload reference images""" | 621 | """Upload reference images""" |
| 625 | files, _ = QFileDialog.getOpenFileNames( | 622 | files, _ = QFileDialog.getOpenFileNames( |
| ... | @@ -710,10 +707,13 @@ class ImageGeneratorWindow(QMainWindow): | ... | @@ -710,10 +707,13 @@ class ImageGeneratorWindow(QMainWindow): |
| 710 | 707 | ||
| 711 | def update_saved_prompts_list(self): | 708 | def update_saved_prompts_list(self): |
| 712 | """Update the saved prompts dropdown""" | 709 | """Update the saved prompts dropdown""" |
| 710 | # Block signals to avoid triggering load_saved_prompt during update | ||
| 711 | self.saved_prompts_combo.blockSignals(True) | ||
| 713 | self.saved_prompts_combo.clear() | 712 | self.saved_prompts_combo.clear() |
| 714 | if self.saved_prompts: | 713 | if self.saved_prompts: |
| 715 | display_prompts = [p[:50] + "..." if len(p) > 50 else p for p in self.saved_prompts] | 714 | display_prompts = [p[:50] + "..." if len(p) > 50 else p for p in self.saved_prompts] |
| 716 | self.saved_prompts_combo.addItems(display_prompts) | 715 | self.saved_prompts_combo.addItems(display_prompts) |
| 716 | self.saved_prompts_combo.blockSignals(False) | ||
| 717 | 717 | ||
| 718 | def check_favorite_status(self): | 718 | def check_favorite_status(self): |
| 719 | """Check if current prompt is favorited""" | 719 | """Check if current prompt is favorited""" | ... | ... |
screenshot.png
deleted
100644 → 0
41.6 KB
-
Please register or sign in to post a comment