Skip to content

Commit 40f9f37

Browse files
committed
Fixed critical bugs and display issues
- Fixed a crash caused by inconsistent method names in the MainPage class called _append_log - Refactored the About dialog display mechanism to resolve the issue where content needed to be dragged to display - Fixed hard-coded text to support internationalization and added missing language key-value pairs - Optimized card layout and font size to ensure text is fully displayed - Improved user experience; all features now function normally Fixed files: - main_page.py: Unified method name to _add_log - about_dialog.py: Refactored display logic and optimized layout - zh_CN.json/en_US.json: Added support for internationalized text
1 parent 8b21bad commit 40f9f37

File tree

5 files changed

+69
-47
lines changed

5 files changed

+69
-47
lines changed

config/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"language": "zh_CN",
33
"first_run": false,
44
"window_geometry": "680x780",
5-
"last_selected_ide": "JetBrains",
5+
"last_selected_ide": "Cursor",
66
"show_welcome": false,
77
"show_about_on_startup": true,
88
"theme": "default"

gui_qt6/about_dialog.py

Lines changed: 43 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,13 @@ def __init__(self, parent=None, config_manager=None, show_dont_show_again=False)
2323
super().__init__(parent)
2424
self.config_manager = config_manager
2525
self.show_dont_show_again = show_dont_show_again
26-
26+
2727
self._setup_dialog()
2828
self._setup_ui()
2929
self._connect_signals()
3030

31-
# 强制刷新布局,确保所有组件正确显示
32-
self.adjustSize()
33-
self.updateGeometry()
34-
self.update()
31+
# 立即完成所有布局计算
32+
self._finalize_layout()
3533

3634
def _setup_dialog(self):
3735
"""设置对话框属性"""
@@ -49,8 +47,8 @@ def _setup_dialog(self):
4947
def _setup_ui(self):
5048
"""设置用户界面"""
5149
layout = QVBoxLayout(self)
52-
layout.setContentsMargins(25, 25, 25, 25) # 增加边距
53-
layout.setSpacing(18) # 增加间距
50+
layout.setContentsMargins(20, 20, 20, 20) # 适中边距
51+
layout.setSpacing(12) # 适中间距
5452

5553
# 标题
5654
title_label = QLabel(get_text("app.title"))
@@ -74,8 +72,7 @@ def _setup_ui(self):
7472
layout.addWidget(line)
7573

7674
# 描述信息
77-
desc_text = "AugmentCode-Free 是一个开源免费的IDE维护工具。"
78-
desc_label = QLabel(desc_text)
75+
desc_label = QLabel(get_text("app.description"))
7976
desc_label.setFont(get_default_font(10))
8077
desc_label.setWordWrap(True)
8178
desc_label.setStyleSheet("color: #374151; margin: 8px 0px;")
@@ -84,50 +81,55 @@ def _setup_ui(self):
8481

8582
# 创建并列布局:支持的IDE和主要功能
8683
features_layout = QHBoxLayout()
87-
features_layout.setSpacing(20)
84+
features_layout.setSpacing(15)
85+
features_layout.setContentsMargins(0, 5, 0, 5)
8886

8987
# 左侧:支持的IDE
9088
ide_frame = QFrame()
89+
ide_frame.setMinimumHeight(90)
9190
ide_frame.setStyleSheet("""
9291
QFrame {
9392
background-color: #f8fafc;
9493
border: 1px solid #e2e8f0;
9594
border-radius: 8px;
96-
padding: 12px;
95+
padding: 10px;
9796
}
9897
""")
9998
ide_layout = QVBoxLayout(ide_frame)
99+
ide_layout.setContentsMargins(8, 12, 8, 12)
100100
ide_layout.setSpacing(8)
101101

102-
ide_title = QLabel("支持的IDE:")
102+
ide_title = QLabel(get_text("app.supported_ides"))
103103
ide_title.setFont(get_default_font(10, bold=True))
104104
ide_title.setStyleSheet("color: #374151 !important; margin-bottom: 5px; background: transparent;")
105105
ide_layout.addWidget(ide_title)
106106

107-
ide_list = QLabel("• VS Code\n• Cursor\n• Windsurf")
107+
ide_list = QLabel(get_text("app.ide_list"))
108108
ide_list.setFont(get_default_font(9))
109109
ide_list.setStyleSheet("color: #4b5563 !important; line-height: 1.5; background: transparent;")
110110
ide_layout.addWidget(ide_list)
111111

112112
# 右侧:主要功能
113113
func_frame = QFrame()
114+
func_frame.setMinimumHeight(90)
114115
func_frame.setStyleSheet("""
115116
QFrame {
116117
background-color: #f8fafc;
117118
border: 1px solid #e2e8f0;
118119
border-radius: 8px;
119-
padding: 12px;
120+
padding: 10px;
120121
}
121122
""")
122123
func_layout = QVBoxLayout(func_frame)
124+
func_layout.setContentsMargins(8, 12, 8, 12)
123125
func_layout.setSpacing(8)
124126

125-
func_title = QLabel("主要功能:")
127+
func_title = QLabel(get_text("app.main_features"))
126128
func_title.setFont(get_default_font(10, bold=True))
127129
func_title.setStyleSheet("color: #374151 !important; margin-bottom: 5px; background: transparent;")
128130
func_layout.addWidget(func_title)
129131

130-
func_list = QLabel("• 清理IDE数据库\n• 修改遥测ID\n• 一键修改所有配置")
132+
func_list = QLabel(get_text("app.feature_list"))
131133
func_list.setFont(get_default_font(9))
132134
func_list.setStyleSheet("color: #4b5563 !important; line-height: 1.5; background: transparent;")
133135
func_layout.addWidget(func_list)
@@ -138,7 +140,7 @@ def _setup_ui(self):
138140
layout.addLayout(features_layout)
139141

140142
# 添加开源声明
141-
opensource_label = QLabel("本项目完全开源免费!")
143+
opensource_label = QLabel(get_text("app.opensource_notice"))
142144
opensource_label.setFont(get_default_font(10, bold=True))
143145
opensource_label.setAlignment(Qt.AlignmentFlag.AlignCenter)
144146
opensource_label.setStyleSheet("color: #059669; margin: 10px 0px;")
@@ -158,8 +160,7 @@ def _setup_ui(self):
158160
warning_layout = QVBoxLayout(warning_frame)
159161
warning_layout.setContentsMargins(8, 8, 8, 8) # 减小内边距
160162

161-
warning_text = "⚠️ 重要提示:\n本项目完全开源免费!如果有人向您收费,请立即联系销售方退款并举报诈骗行为。"
162-
warning_label = QLabel(warning_text)
163+
warning_label = QLabel(get_text("app.warning_notice"))
163164
warning_label.setFont(get_default_font(8)) # 减小字体
164165
warning_label.setStyleSheet("color: #92400e; line-height: 1.3;")
165166
warning_label.setWordWrap(True)
@@ -171,7 +172,7 @@ def _setup_ui(self):
171172
github_layout = QHBoxLayout()
172173
github_layout.addStretch()
173174

174-
github_label = QLabel("项目地址:")
175+
github_label = QLabel(get_text("app.project_address"))
175176
github_label.setFont(get_default_font(9)) # 减小字体
176177
github_label.setStyleSheet("color: #6b7280; margin: 5px 0px;")
177178
github_layout.addWidget(github_label)
@@ -198,7 +199,7 @@ def _setup_ui(self):
198199

199200
# "启动时不再显示"选项
200201
if self.show_dont_show_again:
201-
self.dont_show_checkbox = QCheckBox("启动时不再显示此对话框")
202+
self.dont_show_checkbox = QCheckBox(get_text("app.dont_show_again"))
202203
self.dont_show_checkbox.setFont(get_default_font(8)) # 减小字体
203204
self.dont_show_checkbox.setStyleSheet("color: #6b7280; margin: 5px 0px;")
204205
bottom_layout.addWidget(self.dont_show_checkbox)
@@ -234,14 +235,26 @@ def _setup_ui(self):
234235

235236
layout.addLayout(bottom_layout)
236237

237-
# 强制刷新所有组件,确保文字正确显示
238+
def _finalize_layout(self):
239+
"""完成布局设置,确保内容立即可见"""
240+
# 强制布局系统立即计算所有组件
241+
self.layout().activate()
242+
243+
# 设置所有标签为可见
244+
for label in self.findChildren(QLabel):
245+
label.setVisible(True)
246+
label.show()
247+
248+
# 设置所有框架为可见
249+
for frame in self.findChildren(QFrame):
250+
frame.setVisible(True)
251+
frame.show()
252+
253+
# 重新计算布局并调整大小
238254
self.layout().update()
239-
for child in self.findChildren(QLabel):
240-
child.adjustSize()
241-
child.update()
242-
for child in self.findChildren(QFrame):
243-
child.update()
244-
255+
self.adjustSize()
256+
self.setVisible(True)
257+
245258
def _connect_signals(self):
246259
"""连接信号"""
247260
self.github_link.mousePressEvent = self._open_github
@@ -266,15 +279,6 @@ def _on_ok_clicked(self):
266279

267280
def show(self):
268281
"""显示对话框"""
269-
# 强制刷新布局和重绘
270-
self.updateGeometry()
271-
self.update()
272-
self.repaint()
273-
274-
# 确保所有子组件也更新
275-
for child in self.findChildren(QLabel):
276-
child.updateGeometry()
277-
child.update()
278-
child.repaint()
279-
282+
# 确保所有组件都可见
283+
self._finalize_layout()
280284
return self.exec()

gui_qt6/main_page.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ def _apply_patch_clicked(self):
674674

675675
# 创建并启动补丁Worker
676676
self.current_worker = PatchWorker(ide_type, patch_mode)
677-
self.current_worker.progress_updated.connect(self._append_log)
677+
self.current_worker.progress_updated.connect(self._add_log)
678678
self.current_worker.patch_completed.connect(self._on_patch_completed)
679679
self.current_worker.file_found.connect(self._on_patch_file_found)
680680
self.current_worker.start()
@@ -709,7 +709,7 @@ def _restore_patch_clicked(self):
709709

710710
# 创建并启动恢复Worker
711711
self.current_worker = RestoreWorker(ide_type)
712-
self.current_worker.progress_updated.connect(self._append_log)
712+
self.current_worker.progress_updated.connect(self._add_log)
713713
self.current_worker.restore_completed.connect(self._on_restore_completed)
714714
self.current_worker.start()
715715

@@ -729,7 +729,7 @@ def _scan_patch_clicked(self):
729729

730730
# 创建并启动扫描Worker
731731
self.current_worker = ScanWorker([ide_type])
732-
self.current_worker.progress_updated.connect(self._append_log)
732+
self.current_worker.progress_updated.connect(self._add_log)
733733
self.current_worker.scan_completed.connect(self._on_scan_completed)
734734
self.current_worker.file_found.connect(self._on_scan_file_found)
735735
self.current_worker.start()
@@ -781,8 +781,8 @@ def _on_scan_completed(self, results: dict):
781781

782782
def _on_patch_file_found(self, file_path: str, status: str):
783783
"""补丁文件发现回调"""
784-
self._append_log(f"📄 文件: {file_path} - {status}")
784+
self._add_log(f"📄 文件: {file_path} - {status}")
785785

786786
def _on_scan_file_found(self, ide_type: str, file_path: str, status: str):
787787
"""扫描文件发现回调"""
788-
self._append_log(f"📄 {ide_type}: {file_path} - {status}")
788+
self._add_log(f"📄 {ide_type}: {file_path} - {status}")

languages/en_US.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
"about": "About",
99
"patch_mode": "Patch Mode:",
1010
"code_patch": "Code Patch",
11-
"operation_log": "Operation Log:"
11+
"operation_log": "Operation Log:",
12+
"description": "AugmentCode-Free is an open-source and free IDE maintenance tool.",
13+
"supported_ides": "Supported IDEs:",
14+
"ide_list": "• VS Code\n• Cursor\n• Windsurf",
15+
"main_features": "Main Features:",
16+
"feature_list": "• Clean IDE Database\n• Modify Telemetry IDs\n• One-click Modify All",
17+
"opensource_notice": "This project is completely open source and free!",
18+
"warning_notice": "⚠️ Important Notice:\nThis project is completely open source and free! If someone charges you, please contact the seller immediately for a refund and report the fraud.",
19+
"project_address": "Project Address:",
20+
"dont_show_again": "Don't show this dialog on startup"
1221
},
1322
"patch_modes": {
1423
"random": "Random Fake Data",

languages/zh_CN.json

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,16 @@
88
"about": "关于",
99
"patch_mode": "补丁模式:",
1010
"code_patch": "代码补丁",
11-
"operation_log": "操作日志:"
11+
"operation_log": "操作日志:",
12+
"description": "AugmentCode-Free 是一个开源免费的IDE维护工具。",
13+
"supported_ides": "支持的IDE:",
14+
"ide_list": "• VS Code\n• Cursor\n• Windsurf",
15+
"main_features": "主要功能:",
16+
"feature_list": "• 清理IDE数据库\n• 修改遥测ID\n• 一键修改所有配置",
17+
"opensource_notice": "本项目完全开源免费!",
18+
"warning_notice": "⚠️ 重要提示:\n本项目完全开源免费!如果有人向您收费,请立即联系销售方退款并举报诈骗行为。",
19+
"project_address": "项目地址:",
20+
"dont_show_again": "启动时不再显示此对话框"
1221
},
1322
"patch_modes": {
1423
"random": "随机假数据",

0 commit comments

Comments
 (0)