-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path05_custom_settings_widget.py
executable file
·52 lines (42 loc) · 1.32 KB
/
05_custom_settings_widget.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
#!/usr/bin/env python3
import sys
from PySide6.QtWidgets import QApplication
from sopic import MainWindow, Station
from sopic.gui.settings_widgets import number_widget, bool_widget, combobox_widget
from examples.steps import PrintSettings, GetSettings
class SettingsStation(Station):
STATION_NAME = "custom-settings-widget-station"
STATION_ID = 1
STATION_VERSION = "1.0.0"
DEBUG = True
dag = {
"print": (PrintSettings, ["get"]),
"get": (GetSettings, []),
}
# the widget key allow to use specific widgets for the settings
default_settings = {
"random-settings": {
"value": "foo",
"label": "A random settings",
},
"int-settings": {
"value": 42,
"label": "A random int settings",
"widget": number_widget,
},
"bool-settings": {
"value": True,
"label": "A random bool settings",
"widget": bool_widget,
},
"combobox-settings": {
"value": "lorem",
"values": ["lorem", "ipsum", "dolor", "sit", "amet"],
"label": "A random combobox settings",
"widget": combobox_widget,
},
}
if __name__ == "__main__":
app = QApplication([])
MainWindow(SettingsStation).show()
sys.exit(app.exec())