/
Tree-Checkbox.py
65 lines (58 loc) · 1.82 KB
/
Tree-Checkbox.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
# encoding: utf-8
# Tree with icons
from yast import import_module
import_module('UI')
from yast import *
class TreeCheckboxClient:
def main(self):
UI.OpenDialog(
MinSize( 40, 15,
VBox(
Heading("YaST2 Mini Control Center"),
Tree(
Id("mod"),
Opt("multiSelection"),
"Modules",
[
Item(
Id("country"),
Term("icon", "yast-yast-language.png"),
"Localization",
True,
[
Item(
Id("keyboard"),
Term("icon", "yast-keyboard.png"),
"Keyboard"
),
Item(
Id("timezone"),
Term("icon", "yast-timezone.png"),
"Time zone"
)
]
),
Item(Id("mouse"), Term("icon", "yast-mouse.png"), "Mouse"),
Item(Id("lan"), Term("icon", "yast-lan.png"), "Network"),
Item(Id("xmas"), Term("icon", "yast-software.png"), "Merry X-Mas"),
Item(
Id("newyear"),
Term("icon", "yast-software.png"),
"Happy New Year"
)
]
),
PushButton(Id("ok"), Opt("default"), "&OK")
)
)
)
UI.ChangeWidget("mod", "SelectedItems", [Id("xmas"), Id("newyear")])
id = None
while True:
id = UI.TimeoutUserInput(300)
selected_items = UI.QueryWidget(Id("mod"), "SelectedItems")
ycpbuiltins.y2warning("Selected items: %1", selected_items)
if id == "ok":
break
UI.CloseDialog()
TreeCheckboxClient().main()