-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_dpg_ui_loading.py
More file actions
executable file
·97 lines (82 loc) · 2.75 KB
/
test_dpg_ui_loading.py
File metadata and controls
executable file
·97 lines (82 loc) · 2.75 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#!/usr/bin/env python3
"""
Test script to check Dear PyGui UI loading
This script attempts to import and initialize each module separately to identify issues
"""
import os
import sys
import importlib
from typing import Optional, List, Dict, Any
print("Starting UI loading test...")
# Add parent directory to path to allow proper imports
parent_dir = os.path.abspath(os.path.dirname(__file__))
if parent_dir not in sys.path:
sys.path.insert(0, parent_dir)
# Try importing Dear PyGui
try:
import dearpygui.dearpygui as dpg
print("✅ Dear PyGui imported successfully")
except ImportError as e:
print(f"❌ Failed to import Dear PyGui: {e}")
sys.exit(1)
# Test state manager loading
try:
from dpg_ui.core.state_manager import StateManager
print("✅ StateManager imported successfully")
# Test creating a state manager
state = StateManager()
print("✅ StateManager instance created")
# Test register_computed method
def test_compute():
return "test value"
state.register_computed("test_path", test_compute)
print("✅ StateManager.register_computed working")
# Test get_computed
test_value = state.get_computed("test_path")
print(f"✅ StateManager.get_computed returned: {test_value}")
except ImportError as e:
print(f"❌ Failed to import StateManager: {e}")
except Exception as e:
print(f"❌ Error in StateManager: {e}")
# Test window loading
try:
from dpg_ui.window import OneTrainerWindow
print("✅ OneTrainerWindow imported successfully")
except ImportError as e:
print(f"❌ Failed to import OneTrainerWindow: {e}")
except Exception as e:
print(f"❌ Error in OneTrainerWindow: {e}")
# Test basic components
try:
from dpg_ui.components.basic import Components
print("✅ Components imported successfully")
except ImportError as e:
print(f"❌ Failed to import Components: {e}")
except Exception as e:
print(f"❌ Error in Components: {e}")
# Test individual tabs
tabs = [
"training_tab",
"model_tab",
"lora_tab",
"concept_tab",
"sampling_tab",
"cloud_tab"
]
for tab_name in tabs:
try:
tab_module = importlib.import_module(f"dpg_ui.tabs.{tab_name}")
print(f"✅ {tab_name} imported successfully")
except ImportError as e:
print(f"❌ Failed to import {tab_name}: {e}")
except Exception as e:
print(f"❌ Error in {tab_name}: {e}")
# Test concept window separately
try:
from dpg_ui.windows.concept_window import ConceptWindow
print("✅ ConceptWindow imported successfully")
except ImportError as e:
print(f"❌ Failed to import ConceptWindow: {e}")
except Exception as e:
print(f"❌ Error in ConceptWindow: {e}")
print("\nTest completed. Check the results above for any issues.")