-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_modern_gui.py
More file actions
64 lines (50 loc) · 1.81 KB
/
test_modern_gui.py
File metadata and controls
64 lines (50 loc) · 1.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env python3
"""
测试现代化GUI界面
"""
import tkinter as tk
from claude_model_manager.modern_gui import ModernModelManagerGUI
def test_modern_gui():
"""测试现代化GUI界面"""
print("=== 现代化GUI界面测试 ===")
try:
# 创建主窗口但不运行主循环
root = tk.Tk()
root.withdraw() # 隐藏主窗口
# 测试对话框
from claude_model_manager.modern_gui import ModernModelDialog
print("1. 测试添加模型对话框...")
dialog = None
try:
dialog = ModernModelDialog(root, "测试对话框")
print(" ✅ 模型对话框创建成功")
if dialog.dialog:
dialog.dialog.destroy()
except Exception as e:
print(f" ❌ 模型对话框错误: {e}")
print("2. 测试GUI主类创建...")
try:
app = ModernModelManagerGUI()
print(" ✅ GUI主类创建成功")
# 测试界面组件
print("3. 测试界面组件...")
if hasattr(app, 'model_tree'):
print(" ✅ 模型树组件存在")
if hasattr(app, 'current_model_info'):
print(" ✅ 当前模型信息组件存在")
if hasattr(app, 'refresh_model_list'):
print(" ✅ 刷新方法存在")
# 测试状态更新
print("4. 测试状态更新...")
app.refresh_model_list()
print(" ✅ 状态更新成功")
app.root.quit()
app.root.destroy()
except Exception as e:
print(f" ❌ GUI创建错误: {e}")
root.destroy()
except Exception as e:
print(f"测试失败: {e}")
print("=== 测试完成 ===")
if __name__ == "__main__":
test_modern_gui()