This repository has been archived by the owner on Jan 25, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
mainwindow.py
88 lines (72 loc) · 2.72 KB
/
mainwindow.py
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
from .examples import *
class MainWindow(QMainWindow):
def __init__(self, parent: QWidget = None):
QMainWindow.__init__(self, parent)
widget = QWidget()
layout = QHBoxLayout(widget)
self.stack = QStackedLayout()
self.list = QListWidget()
self.list.currentChanged = self.currentItemChanged
layout.addWidget(self.list)
layout.addLayout(self.stack)
layout.setStretch(1, 2)
self.setCentralWidget(widget)
self.setMinimumSize(800, 800)
# self.setStyleSheet('QWidget{background: blue;}')
appBar = AppBarSettingsEditor, "App Bar"
autocomplete = AutoCompleteSettingsEditor, "Auto Complete"
avatar = AvatarSettingsEditor, "Avatar"
badge = BadgeSettingsEditor, "Badge"
checkbox = CheckBoxSettingsEditor, "CheckBox"
circularProgress = CircularProgressSettingsEditor, "Circular Progress"
dialog = DialogSettingsEditor, "Dialog"
drawer = DrawerSettingsEditor, "Drawer"
fab = FloatingActionButtonSettingsEditor, "Floating Action Button"
flatButton = FlatButtonSettingsEditor, "Flat Button"
iconButton = IconButtonSettingsEditor, "Icon Button"
menu = MenuSettingsEditor, "Menu"
progress = ProgressSettingsEditor, "Progress"
radioButton = RadioButtonSettingsEditor, "Radio Button"
raisedButton = RaisedButtonSettingsEditor, "Raised Button"
scrollBar = ScrollBarSettingsEditor, "Scroll Bar"
slider = SliderSettingsEditor, "Slider"
snackbar = SnackbarSettingsEditor, "Snackbar"
tabs = TabsSettingsEditor, "Tabs"
textField = TextFieldSettingsEditor, "Text Field"
toggle = ToggleSettingsEditor, "Toggle"
apps = (
appBar,
autocomplete,
avatar,
badge,
checkbox,
circularProgress,
dialog,
drawer,
fab,
flatButton,
iconButton,
menu,
progress,
radioButton,
raisedButton,
scrollBar,
slider,
snackbar,
tabs,
textField,
toggle,
)
for n in apps:
self.setup(n)
# break
self.list.setCurrentRow(0)
def currentChanged(self, current: QModelIndex, previous: QModelIndex):
self.stack.setCurrentIndex(self.list.currentRow())
def currentItemChanged(self, current: QListWidgetItem, previous: QListWidgetItem):
self.stack.setCurrentIndex(self.list.currentRow())
def setup(self, tup: tuple):
klass, name = tup
wid = klass()
self.stack.addWidget(wid)
self.list.addItem(name)