-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathui_shortcuts.rb
101 lines (99 loc) · 2.02 KB
/
ui_shortcuts.rb
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
89
90
91
92
93
94
95
96
97
98
99
100
101
require "yast/term"
module Yast
# Module that provides shortcuts for known UI terms, so UI can be constructed in nice way.
module UIShortcuts
# Define symbols for the UI
# See https://github.com/libyui/libyui/blob/master/src/YUISymbols.h
UI_TERMS = [
:BarGraph,
:BusyIndicator,
:Bottom,
:ButtonBox,
:Cell,
:Center,
:CheckBox,
:CheckBoxFrame,
:ColoredLabel,
:ComboBox,
:CustomStatusItemSelector,
:DateField,
:DownloadProgress,
:DumbTab,
:Dummy,
:DummySpecialWidget,
:Empty,
:Frame,
:HBox,
:HCenter,
:HMultiProgressMeter,
:HSpacing,
:HSquash,
:HStretch,
:HVCenter,
:HVSquash,
:HVStretch,
:HWeight,
:Heading,
:IconButton,
:Image,
:InputField,
:IntField,
:Label,
:Left,
:LogView,
:MarginBox,
:MenuBar,
:MenuButton,
:MinHeight,
:MinSize,
:MinWidth,
:MultiItemSelector,
:MultiLineEdit,
:MultiSelectionBox,
:PackageSelector,
:PatternSelector,
:PartitionSplitter,
:Password,
:PkgSpecial,
:ProgressBar,
:PushButton,
:RadioButton,
:RadioButtonGroup,
:ReplacePoint,
:RichText,
:Right,
:SelectionBox,
:SingleItemSelector,
:Slider,
:Table,
:TextEntry,
:TimeField,
:TimezoneSelector,
:Top,
:Tree,
:VBox,
:VCenter,
:VMultiProgressMeter,
:VSpacing,
:VSquash,
:VStretch,
:VWeight,
:Wizard,
# special ones that will be upper cased
:icon,
:id,
:item,
:header,
:menu,
:opt
].freeze
# for each symbol define a util function that will create a term
UI_TERMS.each do |term_name|
method_name = term_name.to_s
method_name[0] = method_name[0].upcase
define_method(method_name.to_sym) do |*args|
Yast::Term.new(term_name, *args)
end
end
end
end