-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_concept_integration.py
More file actions
executable file
·86 lines (67 loc) · 2.35 KB
/
test_concept_integration.py
File metadata and controls
executable file
·86 lines (67 loc) · 2.35 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
#!/usr/bin/env python3
"""
Test script for verifying the integration of the Concept tab with the main UI
This script creates a simplified version of the main UI with just the Concept tab
to verify that it works correctly.
"""
import os
import sys
import dearpygui.dearpygui as dpg
from typing import Optional, Dict, Any, List
# Add the parent directory to sys.path
parent_dir = os.path.abspath(os.path.dirname(__file__))
if parent_dir not in sys.path:
sys.path.insert(0, parent_dir)
# Import required modules
from dpg_ui.core.state_manager import StateManager
from dpg_ui.tabs.concept_tab import ConceptTab
class SimpleWindow:
"""Simple window for testing the concept tab"""
def __init__(self, title: str = "Concept Tab Test", width: int = 1000, height: int = 800):
"""Initialize the window"""
self.title = title
self.width = width
self.height = height
self.state = StateManager()
self.window_id = "main_window"
self.tab_bar_id = "tab_bar"
self.concept_tab = None
def create_ui(self):
"""Create the UI structure"""
# Create viewport
dpg.create_viewport(title=self.title, width=self.width, height=self.height)
# Create main window
with dpg.window(tag=self.window_id, label=self.title):
# Create tab bar
with dpg.tab_bar(tag=self.tab_bar_id):
# Create concept tab
with dpg.tab(label="Concept", tag="concept_tab"):
self.concept_tab = ConceptTab(dpg.last_item(), self.state)
# Set the primary window
dpg.set_primary_window(self.window_id, True)
def show(self):
"""Show the window and start the main loop"""
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
def cleanup(self):
"""Clean up resources"""
dpg.destroy_context()
def main():
"""Main entry point"""
print("Starting concept tab integration test...")
# Create window
window = None
try:
# Initialize DPG
dpg.create_context()
# Create and show the window
window = SimpleWindow()
window.create_ui()
window.show()
finally:
# Clean up
if window:
window.cleanup()
if __name__ == "__main__":
main()