Files
katrain-qt/katrain/popups.kv
T
2020-11-25 22:15:08 +01:00

619 lines
19 KiB
Plaintext

#:kivy 1.11.0
#:import i18n katrain.core.lang.i18n
#:import expanduser os.path.expanduser
#:import abspath os.path.abspath
#:import kivy_version kivy.__version__
#:set CP_SPACING 6
#:set CP_SMALL_SPACING 3
#:set CP_PADDING 6
#:set INPUT_FONT_SIZE sp(25)
#:set DESC_FONT_SIZE sp(20)
#:set LIGHTGREY [0.7,0.7,0.7,1]
#:import BACKGROUND_COLOR katrain.gui.style.BACKGROUND_COLOR
#:import LIGHTGREY katrain.gui.style.LIGHTGREY
#:import TEXT_COLOR katrain.gui.style.TEXT_COLOR
#:import TOP_MOVE_OPTIONS katrain.core.constants.TOP_MOVE_OPTIONS
# MDTextField:
# hint_text: "Helper text on focus"
# helper_text: "This will disappear when you click off"
# helper_text_mode: "on_focus"
# font_size: INPUT_FONT_SIZE
<LabelledTextInput>:
font_size: INPUT_FONT_SIZE
helper_text_mode: "none"
hint_text: ""
helper_text: ""
color_mode: 'custom'
line_color_focus: TEXT_COLOR
<LabelledPathInput>:
font_size: sp(16)
multiline: False
helper_text_mode: "on_error"
helper_text: i18n._("file not found")
<LabelledIntInput>:
font_size: INPUT_FONT_SIZE
size_hint: 0.5, None
<LabelledFloatInput>:
font_size: INPUT_FONT_SIZE
size_hint: 0.5, None
<LabelledCheckBox>:
size: DESC_FONT_SIZE*2,DESC_FONT_SIZE*2
size_hint: None,None
<QuickInputButton@SizedRectangleButton>
on_left_press: if self.target: self.target.text = self.text
size: DESC_FONT_SIZE * 2, DESC_FONT_SIZE * 2
font_size: DESC_FONT_SIZE
<I18NPopup>:
background_color: BACKGROUND_COLOR
background: self.background if kivy_version < '2.0' else ''
title: i18n._(self.title_key)
title_size: DESC_FONT_SIZE
title_font: self.font_name
size_hint: None, None
<QuickConfigGui>:
orientation: 'vertical'
spacing: CP_SPACING
padding: 4*CP_PADDING,CP_PADDING, 4*CP_PADDING, CP_PADDING
<DescriptionLabel>:
font_size: DESC_FONT_SIZE
multiline: True
text_size: self.width, None
halign: 'center'
valign: 'center'
<SmallDescriptionLabel@DescriptionLabel>
font_size: DESC_FONT_SIZE * 0.66
<ConfigPopup>:
configfile: configfile
model_path: model_path
katago_path: katago_path
model_files: model_files
katago_files: katago_files
download_progress_box: download_progress_box
katago_download_progress_box: katago_download_progress_box
DescriptionLabel:
text: i18n._('katago settings')
font_size: DESC_FONT_SIZE * 1.5
GridLayout:
cols: 2
rows: 6
size_hint: 1,6
spacing: CP_SPACING
DescriptionLabel:
text: i18n._("engine:katago")
size_hint: 0.33, 1
AnchorLayout:
LabelledPathInput:
id: katago_path
input_property: "engine/katago"
hint_text: i18n._("engine:katago:hint")
on_text: root.check_katas()
AnchorLayout:
size_hint: 0.33, 1
AutoSizedRoundedRectangleButton:
text: i18n._("download katago button")
on_press: root.download_katas()
size_hint_y: 0.7
AnchorLayout:
KeyValueSpinner:
id: katago_files
text: ''
text_autoupdate: True
-text_size: self.width, None
-halign: 'center'
-shorten: True
-shorten_from: 'right'
on_select:
if self.selected_index != 0: katago_path.text = self.value_keys[self.selected_index]
size_hint_y: 0.7
sync_height_frac: 1.0
-font_size: self.height * 0.5
-background_color: [*[c*255/88 for c in BOX_BACKGROUND_COLOR[:3]], 1] # compensate for texture
DescriptionLabel:
text: i18n._("engine:config")
size_hint: 0.33, 1
AnchorLayout:
LabelledPathInput:
input_property: "engine/config"
DescriptionLabel:
text: i18n._("engine:model")
size_hint: 0.33, 1
AnchorLayout:
LabelledPathInput:
id: model_path
input_property: "engine/model"
on_text: root.check_models()
AnchorLayout:
size_hint: 0.33, 1
AutoSizedRoundedRectangleButton:
text: i18n._("download models button")
on_press: root.download_models()
size_hint_y: 0.7
AnchorLayout:
KeyValueSpinner:
id: model_files
text: ''
text_autoupdate: True
-text_size: self.width, None
-halign: 'center'
-shorten: True
-shorten_from: 'right'
on_select:
if self.selected_index != 0: model_path.text = self.value_keys[self.selected_index]
size_hint_y: 0.7
sync_height_frac: 1.0
-font_size: self.height * 0.5
-background_color: [*[c*255/88 for c in BOX_BACKGROUND_COLOR[:3]], 1] # compensate for texture
DescriptionLabel:
text: i18n._("engine:altcommand")
size_hint: 0.33, 1
AnchorLayout:
LabelledPathInput:
input_property: "engine/altcommand"
hint_text: i18n._("engine:altcommand:hint")
BoxLayout:
size_hint: 1,1
orientation: 'horizontal'
DescriptionLabel:
text: i18n._('general settings')
font_size: DESC_FONT_SIZE * 1.5
DescriptionLabel:
font_size: DESC_FONT_SIZE * 1.5
text: i18n._('engine settings')
BoxLayout:
size_hint: 1,5
orientation: 'horizontal'
GridLayout:
cols: 2
rows: 5
spacing: CP_SPACING
DescriptionLabel:
text: i18n._("general:sgf_save")
AnchorLayout:
LabelledPathInput:
input_property: "general/sgf_save"
DescriptionLabel:
text: i18n._('count down sound')
AnchorLayout:
LabelledCheckBox:
input_property: "timer/sound"
DescriptionLabel:
text: i18n._("general:anim_pv_time")
AnchorLayout:
LabelledFloatInput:
input_property: "general/anim_pv_time"
hint_text: i18n._("engine:time:hint")
DescriptionLabel:
text: i18n._("general:debug_level")
AnchorLayout:
LabelledIntInput:
input_property: "general/debug_level"
helper_text: i18n._("general:debug_level:hint")
helper_text_mode: "on_focus"
SmallDescriptionLabel:
text: i18n._('config file path')
SmallDescriptionLabel:
id: configfile
text: app.gui.config_file
BackgroundMixin:
background_color: LIGHTGREY
size_hint: None, 1
width: 2
GridLayout:
cols: 2
rows: 4
spacing: CP_SPACING
padding: CP_PADDING*2,0,0,0
DescriptionLabel:
text: i18n._("engine:max_visits")
AnchorLayout:
LabelledIntInput:
input_property: "engine/max_visits"
DescriptionLabel:
text: i18n._("engine:fast_visits")
AnchorLayout:
LabelledIntInput:
input_property: "engine/fast_visits"
DescriptionLabel:
text: i18n._("engine:max_time")
AnchorLayout:
LabelledFloatInput:
input_property: "engine/max_time"
hint_text: i18n._("engine:time:hint")
DescriptionLabel:
text: i18n._("engine:wide_root_noise")
AnchorLayout:
LabelledFloatInput:
input_property: "engine/wide_root_noise"
hint_text: i18n._("engine:wide_root_noise:hint")
MDBoxLayout:
orientation: 'horizontal'
size_hint: 1,2
MDBoxLayout:
size_hint_x: 3.5 if self.children else 0.0001
orientation: 'vertical'
id: download_progress_box
MDBoxLayout:
size_hint_x: 3.5 if self.children else 0.0001
orientation: 'vertical'
id: katago_download_progress_box
AnchorLayout:
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,None
height: sp(40)
text: i18n._("update settings")
on_press: root.update_config(True)
<ConfigTeacherPopup>
options_grid: options_grid
themes_spinner: themes_spinner
GridLayout:
cols: 5
rows: 7
size_hint: 1, 7
id: options_grid
DescriptionLabel:
text: i18n._("dot color")
DescriptionLabel:
text: i18n._("point loss threshold")
DescriptionLabel:
text: i18n._("num undos")
DescriptionLabel:
text: i18n._("show dots")
DescriptionLabel:
text: i18n._("save dots")
AnchorLayout:
size_hint: 1, 3
GridLayout:
cols: 2
rows: 4
padding: 4
size_hint: 0.95, 1
DescriptionLabel:
font_size: DESC_FONT_SIZE * 0.8
text: i18n._("theme")
AnchorLayout:
LabelledSpinner:
size_hint: 0.95,0.8
input_property: 'trainer/theme'
font_size: DESC_FONT_SIZE * 0.8
id: themes_spinner
DescriptionLabel:
font_size: DESC_FONT_SIZE * 0.8
text: i18n._("stats on top move")
BoxLayout:
orientation: 'horizontal'
size_hint: 1.5,1
LabelledSpinner:
id: top_moves_show
value_refs: TOP_MOVE_OPTIONS
input_property: "trainer/top_moves_show"
Label:
size_hint: 0.1, 1
text: '&'
LabelledSpinner:
id: top_moves_show_secondary
value_refs: TOP_MOVE_OPTIONS
input_property: "trainer/top_moves_show_secondary"
DescriptionLabel:
font_size: DESC_FONT_SIZE * 0.8
text: i18n._("show stats if")
BoxLayout:
Label:
text: '>'
size_hint: 0.1, 1
AnchorLayout:
LabelledIntInput:
input_property: "trainer/low_visits"
Label:
size_hint: 0.1, 1
text: i18n._('visits')
Label:
DescriptionLabel:
font_size: DESC_FONT_SIZE * 0.8
text: i18n._("show ai dots")
AnchorLayout:
LabelledCheckBox:
input_property: "trainer/eval_show_ai"
AnchorLayout:
size_hint: 1,1.5
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.5
text: i18n._("update teacher")
on_press: root.update_config(True)
<ConfigTimerPopup>:
MDGridLayout:
cols: 2
rows: 4
spacing: 1.5 * CP_SPACING
size_hint: 1,2.5
DescriptionLabel:
text: i18n._('main time')
AnchorLayout:
LabelledIntInput:
text: "10"
input_property: "timer/main_time"
DescriptionLabel:
text: i18n._('byoyomi length')
AnchorLayout:
LabelledIntInput:
text: "30"
input_property: "timer/byo_length"
DescriptionLabel:
text: i18n._('byoyomi periods')
AnchorLayout:
LabelledIntInput:
text: "5"
input_property: "timer/byo_periods"
DescriptionLabel:
text: i18n._('minimal time use')
AnchorLayout:
LabelledIntInput:
text: "0"
input_property: "timer/minimal_use"
AnchorLayout:
size_hint: 1,1
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.5
text: i18n._("update timer")
on_press: root.update_config(True)
<NewGamePopup>:
restart: restart
rules_spinner: rules_spinner
player_setup: player_setup
player_name: {"W": white_player_name, "B": black_player_name}
PlayerSetupBlock:
size_hint: 1, 2
id: player_setup
GridLayout:
rows: 7
cols: 3
size_hint: 1, 3
spacing: CP_SPACING
padding: CP_PADDING
DescriptionLabel:
text: i18n._("names")
AnchorLayout:
LabelledTextInput:
text: ''
id: black_player_name
size_hint: 0.75, None
AnchorLayout:
LabelledTextInput:
text: ''
id: white_player_name
size_hint: 0.75, None
DescriptionLabel:
text: i18n._("board size")
AnchorLayout:
LabelledTextInput:
text: '19'
id: boardsize
input_property: 'game/size'
size_hint: 0.5, None
hint_text: i18n._("non square board hint")
AnchorLayout:
MDBoxLayout:
adaptive_size: True
spacing: CP_SPACING
QuickInputButton:
text: '9'
target: boardsize
QuickInputButton:
text: '13'
target: boardsize
QuickInputButton:
text: '19'
target: boardsize
DescriptionLabel:
text: i18n._("handicap")
AnchorLayout:
LabelledIntInput:
text: '0'
input_property: 'game/handicap'
id: handicap
AnchorLayout:
MDBoxLayout:
adaptive_size: True
spacing: CP_SPACING
QuickInputButton:
text: '0'
on_left_press: km.text='6.5'
target: handicap
QuickInputButton:
text: '2'
on_left_press: km.text='0.5'
target: handicap
QuickInputButton:
text: '9'
on_left_press: km.text='0.5'
target: handicap
DescriptionLabel:
text: i18n._("komi")
AnchorLayout:
LabelledFloatInput:
text: '6.5'
id: km
input_property: 'game/komi'
AnchorLayout:
MDBoxLayout:
adaptive_size: True
spacing: CP_SPACING
QuickInputButton:
text: '0.5'
on_left_press: km.text=self.text
QuickInputButton:
text: '6.5'
on_left_press: km.text=self.text
QuickInputButton:
text: '7.5'
on_left_press: km.text=self.text
DescriptionLabel:
text: i18n._("ruleset")
AnchorLayout:
LabelledSpinner:
size_hint: 0.8,0.8
input_property: 'game/rules'
font_size: DESC_FONT_SIZE
id: rules_spinner
Label:
DescriptionLabel:
text: i18n._('clear cache')
AnchorLayout:
LabelledCheckBox:
id: restart
input_property: 'game/clear_cache'
SmallDescriptionLabel:
text: i18n._('avoids replaying')
BoxLayout:
size_hint: 1,0.75
AnchorLayout:
size_hint: 0.5, 1
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.5
_font_size: self.height*0.35
text: i18n._("change current game")
on_press: root.update_game()
AnchorLayout:
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.66
text: i18n._("new game")
on_press: root.update_config(True)
<LabelledSelectionSlider>:
slider: slider
textbox: textbox
SelectionSlider:
id: slider
size_hint: 2.25,1
values: root.values
on_change: textbox.text = str(slider.value)
track_color: LIGHTGREY
thumb_color: (0.6, 0.7, 0.9, 1) if root.key_option else (0.3, 0.4, 0.6, 1)
LabelledFloatInput:
id: textbox
<ConfigAIPopup>:
options_grid: options_grid
help_label: help_label
estimated_rank_label: estimated_rank_label
ai_select: ai_select
BoxLayout:
size_hint: 1,1
DescriptionLabel:
font_size: DESC_FONT_SIZE
text: i18n._('Select AI')
AnchorLayout:
I18NSpinner:
size_hint: 0.8, 0.5
id: ai_select
BoxLayout:
size_hint: 1,1
DescriptionLabel:
font_size: DESC_FONT_SIZE
size_hint: 1, 1
text: i18n._('estimated strength')
DescriptionLabel:
size_hint: 0.8, 1
font_size: DESC_FONT_SIZE
id: estimated_rank_label
text: '?' + i18n._('strength:kyu')
SmallDescriptionLabel:
id: help_label
size_hint: 1,1.25
text: i18n._('')
GridLayout:
size_hint: 1, 4
id: options_grid
rows: root.max_options
cols: 2
AnchorLayout:
size_hint: 1, 1.5
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.5
text: i18n._("update ai settings")
on_press: root.update_config(True)
<ReAnalyzeGamePopup>:
visits: visits
orientation: 'vertical'
BoxLayout:
size_hint: 1, 1.5
orientation: 'horizontal'
DescriptionLabel:
text: i18n._('reanalyze max visits')
AnchorLayout:
LabelledIntInput:
id: visits
text: '2500'
AnchorLayout:
size_hint: 1, 1
AutoSizedRoundedRectangleButton:
padding_x: 15
size_hint: None,0.5
text: i18n._("analysis:game") # re-use string
on_press:
root.katrain("analyze-extra", "game", visits=visits.input_value)
root.popup.dismiss()
<LoadSGFPopup>:
fast: fast
rewind: rewind
filesel: filesel
orientation: 'vertical'
AnchorLayout:
size_hint: 1,1
BoxLayout:
size_hint: 0.5,1
orientation: 'horizontal'
DescriptionLabel:
text: i18n._("load sgf fast analysis")
size_hint: 0.45,1
halign: 'right'
LabelledCheckBox:
id: fast
size_hint: 0.05,1
DescriptionLabel:
text: i18n._("load sgf rewind")
halign: 'right'
size_hint: 0.45,1
LabelledCheckBox:
id: rewind
active: True
size_hint: 0.05,1
I18NFileBrowser:
id: filesel
multiselect: False
filters: ["*.sgf","*.gib","*.ngf"]
path: "."
size_hint: 1,7