-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathsample.py
More file actions
68 lines (52 loc) · 1.91 KB
/
sample.py
File metadata and controls
68 lines (52 loc) · 1.91 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
import os
import sys
from QtGuidedUI import GuidedUI
import sys
from Qt.QtWidgets import (
QApplication, QPushButton, QTabWidget, QWidget, QVBoxLayout, QLabel
)
class MyApp(GuidedUI):
def __init__(self):
self.guide_config_path = os.path.join(
os.path.dirname(__file__), "guide_config.json"
)
super().__init__(self.guide_config_path)
self.setup_ui()
def setup_ui(self):
self.setWindowTitle("Example Guided Application")
self.resize(700, 400)
layout = QVBoxLayout(self)
# Save button
self.btn_save = QPushButton("Save")
self.btn_save.setObjectName("btnSave")
layout.addWidget(self.btn_save)
# Tab widget
self.tabs = QTabWidget()
self.tabs.setObjectName("mainTabs")
# Tab 1
self.tab_home = QWidget()
self.tab_home_layout = QVBoxLayout()
self.tab_home_layout.addWidget(QLabel("Home tab content"))
self.tab_home.setLayout(self.tab_home_layout)
# Tab 2 (Settings tab)
self.tab_settings = QWidget()
self.tab_settings.setObjectName("tabSettings")
self.tab_settings_layout = QVBoxLayout()
self.tab_settings_layout.addWidget(QLabel("Settings tab content"))
self.tab_settings.setLayout(self.tab_settings_layout)
# Add tabs
self.tabs.addTab(self.tab_home, "Home")
self.tabs.addTab(self.tab_settings, "Settings")
layout.addWidget(self.tabs)
# Button to trigger the guide
self.btn_start_guide = QPushButton("Start Guide")
self.btn_start_guide.clicked.connect(self.start_guide)
layout.addWidget(self.btn_start_guide)
def show_settings_tab(self):
print("Showing settings tab...")
self.tabs.setCurrentWidget(self.tab_settings)
if __name__ == '__main__':
app = QApplication(sys.argv)
window = MyApp()
window.show()
sys.exit(app.exec_())