-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsettings.kv
402 lines (348 loc) · 12 KB
/
settings.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
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
#:kivy 2.0.0
#:import utils kivy.utils
#:import stt speech.stt.stt
<OptLabel@FontScalingLabel>:
default_background: 0,0,0,0
max_font_size: sp(20)
<OptCheckBox@CheckBox>:
# Force checkbox look for radio behavior
background_radio_normal: 'atlas://data/images/defaulttheme/checkbox_off'
background_radio_down: 'atlas://data/images/defaulttheme/checkbox_on'
<OptGrid@GridLayout>:
canvas.before:
Color:
rgb: [47 / 255., 167 / 255., 212 / 255., 1.]
Rectangle:
pos: self.pos
size: self.size
Color:
rgb: .15,.15,.15
Rectangle:
pos: self.pos[0]+2, self.pos[1]+2
size: self.size[0]-4, self.size[1]-4
cols: 2
padding: dp(4)
<OptSlider@Slider>:
cursor_size: dp(22), dp(22)
padding: dp(16)
<AppSettings>:
cols: 1
spacing: 20
size_hint: 1, 1
GridLayout:
cols: 2
cols_minimum: { 0: self.parent.width * .3 }
OptLabel:
text: 'Algebraic Notation'
Switch:
active: app.engine.notation=='san'
on_active: app.engine.set_notation('san' if self.active else 'uci')
# Turn the engine on / off. With the engine off the app acts as PGN viewer.
OptLabel:
text: 'Engine'
Switch:
active: not app.study_mode
on_active: app.set_study_mode(not app.study_mode, [difficulty, cores])
# Turn use of opening book on / off
OptLabel:
text:'Opening Book'
Switch:
id: book_switch
active: app.engine.book != None
on_active: app.engine.use_opening_book(self.active)
# With this setting ON, the app selects a random move from the opening
# book (if it finds more than one match). With the setting OFF, it plays
# the first match.
OptLabel:
text: 'Variable Opening'
disabled: not book_switch.active
Switch:
active: app.engine.variable_strategy
on_active: app.engine.variable_strategy = self.active
disabled: not book_switch.active
OptGrid:
size_hint_y: 0.8
OptLabel:
text: 'Time / move: ' + app.time_limit_str(limit.value)
OptSlider:
id: limit
min: 0
max: app.max_limit
step: 1
value: app.limit
on_touch_up: app.limit = int(self.value)
#
# AI Strength (Difficulty Level)
#
OptLabel:
text: 'Engine Strength: {level:2d}'.format(level=int(difficulty.value))
OptSlider:
id: difficulty
min: 1
max: app.MAX_DIFFICULTY
step: 1
value: app.difficulty_level
on_touch_up: app.set_difficulty_level(self.value, cores)
# changing difficulty during search may crash
disabled: app.engine_busy
# Use multiple cores on highest difficulty level only.
OptLabel:
text: 'CPU Cores: {cores:2d}'.format(cores=int(cores.value))
OptSlider:
id: cores
min: 1
max: app.cpu_cores_max
step: 1
value: app.cpu_cores
on_touch_up: app.cpu_cores = self.value
# changing active cores during search may crash
disabled: app.engine_busy or app.difficulty_level != app.MAX_DIFFICULTY
OptLabel:
text: 'Analysis Time: ' + str(int(analysis_time.value)) + ' sec'
Slider:
id: analysis_time
disabled: not app.use_voice
min: 3
max: 60
step: 1
value: app.analysis_time
on_touch_up: app.analysis_time = int(self.value)
cursor_size: dp(22), dp(22)
padding: dp(16)
# "Advanced >>" button:
RelativeLayout:
size_hint: 1, None
height: dp(32)
AwesomeActionButton:
markup: True
text: '[font=Roboto]Advanced [/font]\uF101'
on_release: app.advanced_settings()
pos_hint: { 'right': 1, 'center_y': 0.5 }
<AdvancedSettings>:
cols: 1
spacing: 20
size_hint: 1, 1
GridLayout:
cols: 2
cols_minimum: { 0: self.parent.width * .3 }
# Developer flag: clear the hashtable after making a move.
# For troubleshooting transposition table aging mechanism.
# OptLabel:
# text: 'Clear Hash / Move'
# Switch:
# active: app.engine.clear_hash_on_move
# on_active: app.engine.clear_hash_on_move = self.active
# The user can paste a PGN into the app (long press, Paste).
# The PGN may contain commentaries, this option controls
# if they are displayed or not (in a text bubble).
# Pasting a game into the app turns off the chess engine
# and the app acts as a PGN viewer.
OptLabel:
text: 'Comments'
Switch:
id: comments
active: app.comments
on_active: app.comments = self.active
# Control which opening book (.bin) file to use.
# User can select built-in or navigate outside the app's
# private area.
OptLabel:
text: 'Opening Book File'
RelativeLayout:
Button:
text: 'Browse'
size_hint: None, None
size: sp(88), sp(32)
pos_hint: { 'center_x': 0.5, 'center_y': 0.5 }
on_release: app.select_opening_book()
# Developer option: display usage of hash table (percent)
# and engine speed in nodes per second.
OptLabel:
text: 'Show Metrics'
Switch:
active: app.show_hash and app.show_nps
on_active: app.show_hash = app.show_nps = self.active
# Voice-related settings
OptLabel:
text: 'Voice User Interface'
Switch:
id: use_voice
active: app.use_voice
on_active: app.use_voice = self.active
disabled: not app.tts_supported
OptLabel:
text: 'Online Speech Recognition'
disabled: not use_voice.active
opacity: 1 if stt.is_offline_supported() else 0
Switch:
active: not stt.prefer_offline
on_active: stt.prefer_offline = not self.active
disabled: not use_voice.active
opacity: 1 if stt.is_offline_supported() else 0
OptGrid:
size_hint_y: 0.6
FontScalingLabel:
text: 'Search Algorithm'
background: 0,0,0,0
color: [47 / 255., 167 / 255., 212 / 255., 1.]
Widget: # placeholder
OptLabel:
text: 'MTD(f)'
OptCheckBox:
id: mtdf
group: 'algo'
active: app.engine.algorithm == app.engine.Algorithm.MTDF
allow_no_selection: False
on_active: app.engine.algorithm = app.engine.Algorithm.MTDF
OptLabel:
text: f'Negamax'
OptCheckBox:
id: negamax
group: 'algo'
active: app.engine.algorithm == app.engine.Algorithm.NEGAMAX
allow_no_selection: False
on_active: app.engine.algorithm = app.engine.Algorithm.NEGAMAX
OptLabel:
text: f'Negascout'
OptCheckBox:
id: negascout
group: 'algo'
active: app.engine.algorithm == app.engine.Algorithm.NEGASCOUT
allow_no_selection: False
on_active: app.engine.algorithm = app.engine.Algorithm.NEGASCOUT
RelativeLayout:
size_hint: 1, None
height: dp(32)
AwesomeActionButton:
markup: True
text: '[font=Roboto]Voice Assistant [/font]\uF101'
on_release: app.assistant_settings()
pos_hint: { 'right': 1, 'center_y': 0.5 }
disabled: not use_voice.active
<ExtraSettings>:
cols: 1
spacing: 20
size_hint: 1,1
BoxLayout:
orientation: 'horizontal'
padding: 0, dp(10)
size_hint_y: None
height: dp(54)
GridLayout:
cols: 3
OptLabel:
text: 'OpenAI Key'
AwesomeActionButton:
text: ' \uF070 '
on_release: app.toggle_key_visible(self, api_key)
TextInput:
id: api_key
size_hint: 1,1
multiline: False
password: True
text: app.assistant.temp_key
on_text: app.assistant.temp_key = self.text
OptGrid:
OptLabel:
text: 'Local Assistant'
disabled: not app.assistant.can_use_local()
Switch:
active: app.use_intent_recognizer
on_active: app.use_intent_recognizer = self.active
disabled: not app.assistant.can_use_local()
OptLabel:
text: 'Remote Assistant'
Switch:
active: app.assistant.enabled
on_active: app.assistant.enabled = self.active
id: enabled
OptLabel:
text: 'Model'
disabled: not enabled.active
BoxLayout:
padding: [0, dp(10), 0, dp(10)]
TextInput:
disabled: not enabled.active
height: dp(34)
pos_hint: { 'center_x': 0.5, 'center_y': 0.5 }
size_hint_y: None
multiline: False
text: app.assistant.model
on_text: app.assistant.model = self.text
OptLabel:
text: 'Endpoint URL'
disabled: not enabled.active
BoxLayout:
padding: [0, dp(10), 0, dp(10)]
TextInput:
disabled: not enabled.active
height: dp(34)
pos_hint: { 'center_x': 0.5, 'center_y': 0.5 }
size_hint_y: None
multiline: False
text: app.assistant.endpoint
on_text: app.assistant.endpoint = self.text
OptLabel:
text: 'Max Retry Count: {}'.format(int(retry_count.value))
disabled: not enabled.active
OptSlider:
disabled: not enabled.active
id: retry_count
min: 1
max: 10
step: 1
value: app.assistant.retry_count
on_touch_up: app.assistant.retry_count = int(self.value)
OptLabel:
text: 'Temperature: {:.3f}'.format(init_temp.value)
disabled: not enabled.active
OptSlider:
disabled: not enabled.active
id: init_temp
min: 0
max: 1
step: 0.001
value: app.assistant.temperature
on_touch_up: app.assistant.temperature = self.value
OptLabel:
text: 'Initial Timeout: {:.2f}'.format(int(req_timeout.value))
disabled: not enabled.active
OptSlider:
disabled: not enabled.active
id: req_timeout
min: 0
max: 10
step: 0.01
value: app.assistant.requests_timeout
on_touch_up: app.assistant.requests_timeout = self.value
<PolyglotChooser>:
_filechooser: filechooser
_selected: selected
cols: 1
spacing: 5
BoxLayout:
size_hint_y: None
height: dp(22)
OptLabel:
id: selected
text:
max_font_size: dp(18)
OptGrid:
FileChooserIconView:
anchor_y: 'top'
id: filechooser
rootpath: '.'
filters: ['*.bin']
filter_dirs: True
on_selection: root._on_selection(*args), app.set_opening_book(*args)
selection: [root.selection]
RelativeLayout:
size_hint: 1, 0.15
AwesomeActionButton:
_app: '[font=Roboto]Application Files [/font]\uF064'
_sys: '\uF3E5[font=Roboto] System Files[/font]'
markup: True
text: self._sys
size_hint: None, None
size: sp(88), sp(34)
on_release: root.switch_data_dir(self)