-
Notifications
You must be signed in to change notification settings - Fork 0
/
kemenydemo.kv
301 lines (275 loc) · 8.19 KB
/
kemenydemo.kv
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<SplashScreen>:
# Welcome text
Label:
text: 'Welcome to this demo application for the Group Assignment Tool.\nThis app provides an example of generating groups with the Group Assignment Tool.'
halign: 'center'
size_hint: (.50,.3)
pos_hint: {'center_x':.5, 'center_y':.7}
# Begin
Button:
text: 'Begin'
size_hint: (.20,.10)
pos_hint: {'center_x':.5, 'center_y':.5}
on_press:
app.root.transition.direction = 'left'
app.root.current = app.root.next()
<ParamScreen>:
default_timelimit: 15
default_iterations: 10000
default_combinations: 15000
# Return to questions
Button:
text: 'Review Questions'
size_hint: (.20,.10)
pos_hint: {'center_x':.15, 'center_y':.1}
on_press:
app.root.transition.direction = 'right'
app.root.current = app.root.previous()
# Process data
Button:
text: 'Process Dataset'
size_hint: (.20,.10)
pos_hint: {'center_x':.85, 'center_y':.1}
on_press:
app.root.transition.direction = 'left'
app.root.current = app.root.next()
root.call_process()
# Group size selection
Spinner:
id: select_per_group
text: '4'
values: ('2', '3', '4', '5', '6', '7', '8', '9', '10')
size_hint: (.11,.08)
pos_hint: {'center_x':.5, 'center_y':.1}
Label:
text: 'Group Size'
size_hint: (.20,.10)
pos_hint: {'center_x':.5, 'center_y':.2}
# Initialization switches
ToggleButton:
id: strong_toggle
text: "Strong"
group: "init_type"
allow_no_selection: False
state: 'down'
size_hint: (.20,.10)
pos_hint: {'center_x':.2, 'center_y':.8}
on_press:
root.init_type_callback(True)
ToggleButton:
id: random_toggle
text: "Random"
group: "init_type"
allow_no_selection: False
size_hint: (.20,.10)
pos_hint: {'center_x':.4, 'center_y':.8}
on_press:
root.init_type_callback(False)
Label:
text: 'Initialization Style'
size_hint: (.20,.10)
pos_hint: {'center_x':.3, 'center_y':.9}
# Time limit input
TextInput:
id: time_limit_input
text: str(root.default_timelimit)
multiline: False
disabled: True
input_filter: 'float'
hint_text: 'Timelimit (s)'
size_hint: (.1,.06)
pos_hint: {'center_x':.4, 'center_y':.55}
Label:
text: 'Time Limit (s)'
size_hint: (.20,.10)
pos_hint: {'center_x':.4, 'center_y':.61}
# Number Iterations
TextInput:
id: iteration_input
text: str(root.default_iterations)
multiline: False
input_filter: 'int'
hint_text: '# Iterations'
size_hint: (.1,.06)
pos_hint: {'center_x':.3, 'center_y':.35}
Label:
text: '# Iterations'
size_hint: (.20,.10)
pos_hint: {'center_x':.3, 'center_y':.41}
# Number Combinations
TextInput:
id: combination_input
text: str(root.default_combinations)
multiline: False
disabled: False
input_filter: 'int'
hint_text: '# Samples'
size_hint: (.1,.06)
pos_hint: {'center_x':.2, 'center_y':.55}
Label:
text: '# Samples'
size_hint: (.20,.10)
pos_hint: {'center_x':.2, 'center_y':.61}
# Compare to optimal?
Label:
id: result_label
text: 'Compare to optimal groups?'
size_hint: (.50,.30)
pos_hint: {'center_x':.75, 'center_y':.9}
ToggleButton:
id: compare_toggle
allow_no_selection: False
text: 'Yes'
group: 'compare_group'
state: 'down'
size_hint: (.10,.10)
pos_hint: {'center_x':.7, 'center_y':.8}
ToggleButton:
id: no_compare_toggle
allow_no_selection: False
text: 'No'
group: 'compare_group'
state: 'normal'
size_hint: (.10,.10)
pos_hint: {'center_x':.8, 'center_y':.8}
# Group size selection
Spinner:
id: select_n_groups
text: '8'
values: ('5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15')
size_hint: (.11,.08)
pos_hint: {'center_x':.75, 'center_y':.5}
Label:
id: select_n_groups_label
text: '# Groups'
size_hint: (.20,.10)
pos_hint: {'center_x':.75, 'center_y':.6}
<ResultScreen>:
max_iter: 50000
max_combo: 750000
max_time: 300
# Display score
Label:
id: result_label
text: 'Processing results...'
size_hint: (.50,.30)
pos_hint: {'center_x':.5, 'center_y':.83}
# Compare to Optimal
Label:
id: opt_label
text: ''
halign: 'center'
size_hint: (.50,.30)
pos_hint: {'center_x':.5, 'center_y':.92}
# Display result groups
TextInput:
id: result_box
readonly: True
size_hint: (.40,.40)
pos_hint: {'center_x':.5, 'center_y':.6}
# Collect filename for output
TextInput:
hint_text: 'Output Filename'
id: csv_filename
size_hint: (.20, .07)
pos_hint: {'center_x':.5, 'center_y':.22}
# Generate CSV
Button:
text: 'Generate CSV'
size_hint: (.20,.10)
pos_hint: {'center_x':.5, 'center_y':.1}
on_press:
root.make_csv(root.ids.csv_filename.text)
# Return to splash screen
Button:
text: 'Restart'
size_hint: (.20,.10)
pos_hint: {'center_x':.85, 'center_y':.1}
on_press:
app.root.transition.direction = 'left'
app.root.current = app.root.next()
<Question>:
# Question text and type
Label:
id: text_label
text: 'Undefined Question'
size_hint: (.50,.15)
pos_hint: {'center_x':.5, 'center_y':.8}
Label:
id: type_label
text: '(Undefined Question Type)'
size_hint: (.50,.15)
pos_hint: {'center_x':.5, 'center_y':.75}
# Activation/Deactivation switches
ToggleButton:
id: activate_toggle
allow_no_selection: False
text: 'Yes'
group: 'activation_group'
state: 'down'
size_hint: (.10,.10)
pos_hint: {'center_x':.25, 'center_y':.53}
on_press:
root.activate_callback(False)
ToggleButton:
id: deactivate_toggle
allow_no_selection: False
text: 'No'
group: 'activation_group'
state: 'normal'
size_hint: (.10,.10)
pos_hint: {'center_x':.35, 'center_y':.53}
on_press:
root.activate_callback(True)
Label:
text: 'Use this question?'
size_hint: (.20,.15)
pos_hint: {'center_x':.3, 'center_y':.63}
# Distribution selection
Spinner:
id: distrib_spinner
text: 'Heterogeneous'
values: ('Heterogeneous', 'Homogeneous')
size_hint: (.20,.10)
pos_hint: {'center_x':.7, 'center_y':.53}
Label:
text: 'Distribution'
size_hint: (.20,.15)
pos_hint: {'center_x':.7, 'center_y':.63}
# Weight slider
Label:
text: 'Priority Level:'
size_hint: (.50,.15)
pos_hint: {'center_x':.5, 'center_y':.32}
Label:
text: 'Low'
size_hint: (.50,.15)
pos_hint: {'center_x':.3, 'center_y':.3}
Label:
text: 'High'
size_hint: (.50,.15)
pos_hint: {'center_x':.7, 'center_y':.3}
Slider:
id: weight_slider
min: 5
max: 25
value: 15
size_hint: (.50,.10)
pos_hint: {'center_x':.5, 'center_y':.25}
# Move to next or previous question
Button:
id: nquestion_button
text: 'Next Question'
size_hint: (.20,.10)
pos_hint: {'center_x':.85, 'center_y':.1}
on_press:
app.root.transition.direction = 'left'
app.root.current = app.root.next()
Button:
id: pquestion_button
text: 'Previous Question'
size_hint: (.20,.10)
pos_hint: {'center_x':.15, 'center_y':.1}
on_press:
app.root.transition.direction = 'right'
app.root.current = app.root.previous()