881 lines
29 KiB
Plaintext
881 lines
29 KiB
Plaintext
#:kivy 1.11.0
|
|
#:import ew kivy.uix.effectwidget
|
|
|
|
#:set PLAYER_MODES ['Human', 'Teach','AI']
|
|
#:set PLAYER_MODE_VALUES ['human','human+undo','ai']
|
|
#:set PLAYER_TOOLTIPS ['Normal play mode','Undo Mode, asking you to try and improve on bad moves','Automatic play mode']
|
|
#:set BUTTON_COLOR [0.23, 0.30, 0.35, 1]
|
|
#:set TOOLTIP_COLOR [0.43, 0.50, 0.65, 1]
|
|
#:set ICON_BUTTON_COLOR [0.71, 0.78, 0.81, 1]
|
|
#:set ICON_BUTTON_COLOR_DOWN [0.51, 0.58, 0.51, 1]
|
|
#:set BOARD_COLOR [0.85, 0.68, 0.40,1]
|
|
#:set GRAPH_DOT_COLOR [0.85, 0.3, 0.3,1]
|
|
#:set BLACK [0.05,0.05,0.05,1]
|
|
#:set WHITE [0.95,0.95,0.95,1]
|
|
#:set GREY [0.5,0.5,0.5,1]
|
|
|
|
|
|
# mixins
|
|
|
|
<BackgroundColor>:
|
|
canvas.before:
|
|
Color:
|
|
rgb: root.background
|
|
Rectangle:
|
|
pos: self.pos
|
|
size: self.size
|
|
|
|
<ToolTipBehavior>:
|
|
|
|
<ToolTipLabel>:
|
|
size_hint: None, None
|
|
size: self.texture_size
|
|
tooltip_font_size: dp(14)
|
|
padding: (2,2)
|
|
halign: 'center'
|
|
canvas.before:
|
|
Color:
|
|
rgba: TOOLTIP_COLOR
|
|
Rectangle:
|
|
size: self.size
|
|
pos: self.pos
|
|
Color:
|
|
rgba: BUTTON_COLOR
|
|
Line:
|
|
width: 1.1
|
|
rectangle: (*self.pos,*self.size)
|
|
|
|
# widgets
|
|
|
|
<StyledButton>:
|
|
color: WHITE
|
|
font_size: self.size[1] * 0.45
|
|
radius: (self.size[1]/7,)
|
|
button_color: BUTTON_COLOR
|
|
button_color_down: [0.105, 0.14, 0.155, 1]
|
|
button_color_highlight: [(a+b)/2 for a,b in zip(self.button_color,self.button_color_down)]
|
|
background_color: 0,0,0,0
|
|
background_normal: ''
|
|
canvas.before:
|
|
Color:
|
|
rgba: self.button_color if root.state=='normal' else self.button_color_down
|
|
RoundedRectangle:
|
|
size: self.size[0],self.size[1]
|
|
pos: (self.pos[0],self.pos[1])
|
|
radius: root.radius
|
|
|
|
<StyledSpinnerOption@SpinnerOption>:
|
|
background_color: BUTTON_COLOR
|
|
background_normal: ''
|
|
color: WHITE
|
|
canvas.after:
|
|
Color:
|
|
rgba: WHITE
|
|
Line
|
|
points: self.pos[0],self.pos[1],self.pos[0]+self.width,self.pos[1]
|
|
width: 1
|
|
|
|
<StyledSpinner>:
|
|
text: self.values[0] if self.values else ''
|
|
font_size: self.size[1] * 0.33
|
|
sync_height_frac: 0.7
|
|
background_color: [*[c*255/88 for c in BUTTON_COLOR[:3]], 1] # compensate for texture
|
|
option_cls: 'StyledSpinnerOption'
|
|
|
|
<StyledToggleButton>:
|
|
max_lines: 1
|
|
|
|
<StyledTabButton@StyledToggleButton>:
|
|
bold: True
|
|
radius: (self.size[1]/3,self.size[1]/3,0,0)
|
|
|
|
<ToggleButtonContainer>:
|
|
|
|
<LabelledTextInput>:
|
|
padding: 3, 0.27*self.size[1]
|
|
font_size: 0.4*self.size[1]
|
|
|
|
<LabelledIntInput>:
|
|
font_size: 0.5*self.size[1]
|
|
padding: 7, 0.2*self.size[1]
|
|
|
|
<LabelledFloatInput>:
|
|
font_size: 0.5*self.size[1]
|
|
padding: 7, 0.2*self.size[1]
|
|
|
|
<LabelledTextArea>
|
|
font_size: 0.2*self.size[1]
|
|
|
|
<CheckBox>:
|
|
color: BLACK
|
|
|
|
<LabelledCheckBox>:
|
|
color: WHITE
|
|
|
|
|
|
<StyledIconButton@StyledButton>:
|
|
button_color: ICON_BUTTON_COLOR
|
|
button_color_down: ICON_BUTTON_COLOR_DOWN
|
|
icon_margin: 0.15 * self.size[0]
|
|
icon: ''
|
|
icon_size: min(self.size[0]-2*self.icon_margin,self.size[1]-2*self.icon_margin)
|
|
Image:
|
|
size: (root.icon_size or 0,root.icon_size or 0) # square
|
|
pos: [root.pos[i] + (root.size[i] - root.icon_size)/2 for i in [0,1]] if root.icon_size else [0,0]
|
|
source: root.icon
|
|
mipmap: True
|
|
|
|
<StyledIconStyledToggleButton@StyledIconButton+ToggleButtonBehavior>:
|
|
|
|
<TransparentIconButton@Button>:
|
|
background_normal: ''
|
|
background_color: (0,0,0,0)
|
|
icon_size: min(self.size[0],self.size[1])
|
|
icon: ''
|
|
Image:
|
|
size: (root.icon_size or 0,root.icon_size or 0) # square
|
|
pos: [root.pos[i] + (root.size[i] - root.icon_size)/2 for i in [0,1]] if root.icon_size else [0,0]
|
|
source: root.icon
|
|
mipmap: True
|
|
|
|
|
|
<DarkLabel>:
|
|
color: BLACK
|
|
text_size: self.size # don't overflow these
|
|
halign: 'center'
|
|
valign: 'center'
|
|
|
|
<LargeLabel@DarkLabel>:
|
|
bold: True
|
|
|
|
<TimerLabel@Label>
|
|
color: BLACK
|
|
text_size: self.size
|
|
font_size: 0.9*self.size[1]
|
|
halign: 'right'
|
|
valign: 'center'
|
|
font_name: 'img/fonts/digital-7.ttf'
|
|
|
|
<ScaledLightLabel>: # popups
|
|
color: WHITE
|
|
font_size: 0.45*self.size[1]/self.num_lines
|
|
|
|
<LightHelpLabel>:
|
|
font_size: self.size[1]/10
|
|
halign: 'center'
|
|
valign: 'center'
|
|
multiline: True
|
|
|
|
<BoxedDarkLabel@Label>:
|
|
halign: 'left'
|
|
valign: 'top'
|
|
canvas.before:
|
|
Color:
|
|
rgba: BLACK
|
|
Line:
|
|
rectangle: [self.pos[0],self.pos[1]+1,self.width-1,self.height]
|
|
width:1.5
|
|
|
|
<CheckBoxHintLabel@Label+ToolTipBehavior>:
|
|
font_size: 0.4*self.size[1]
|
|
color: BLACK
|
|
halign: 'center'
|
|
valign: 'center'
|
|
size: self.texture_size
|
|
|
|
<ClickableLabel@ButtonBehavior+DarkLabel>:
|
|
color: BLACK
|
|
halign: 'center'
|
|
valign: 'center'
|
|
size: self.texture_size
|
|
|
|
<CensorableLabel>:
|
|
value : value
|
|
orientation: 'horizontal'
|
|
ClickableLabel:
|
|
size_hint: 0.6,1
|
|
id: desc
|
|
text: root.label
|
|
font_size: self.size[1] * 0.8
|
|
on_press: value.opacity = 1 if value.opacity==0 else 0
|
|
DarkLabel:
|
|
size_hint: 0.4,1
|
|
text: root.text
|
|
font_size: desc.font_size
|
|
id: value
|
|
bold: True
|
|
|
|
<BaseCircleWithText>:
|
|
text: ''
|
|
color: WHITE
|
|
font_size: min(self.height,self.width) * 0.6 / (0.5 + 0.5 * len(self.text))
|
|
halign: 'center'
|
|
valign: 'center'
|
|
bold: True
|
|
|
|
<BlackCircleWithText@BaseCircleWithText>:
|
|
canvas.before:
|
|
Color:
|
|
rgba: BLACK
|
|
Ellipse:
|
|
pos: self.pos[0] + self.width/2 - min(self.height,self.width) * root.radius, self.pos[1] + self.height/2 - min(self.height,self.width) * root.radius
|
|
size: min(self.height,self.width) * 2 * root.radius, min(self.height,self.width) * 2* root.radius
|
|
|
|
<WhiteCircleWithText@BaseCircleWithText>:
|
|
color: BLACK
|
|
outline: True
|
|
canvas.before:
|
|
Color:
|
|
rgba: WHITE
|
|
Ellipse:
|
|
pos: self.pos[0] + self.width/2 - min(self.height,self.width) * root.radius, self.pos[1] + self.height/2 - min(self.height,self.width) * root.radius
|
|
size: min(self.height,self.width) * 2 * root.radius, min(self.height,self.width) * 2 * root.radius
|
|
canvas.after:
|
|
Color:
|
|
rgba: BLACK
|
|
Line:
|
|
circle: self.pos[0] + self.width/2, self.pos[1] + self.height/2, min(self.height,self.width) * root.radius - 1
|
|
width: 1.1 if root.outline else 0.0001
|
|
|
|
<GraphMarkerLabel@Label>:
|
|
valign: 'bottom'
|
|
halign: 'left'
|
|
text: '+0'
|
|
color: BUTTON_COLOR
|
|
size: self.texture_size
|
|
|
|
<ScoreGraph>:
|
|
whalf: root.pos[1]+self.height*0.25*(1 + 2 * root.marginy)
|
|
bhalf: root.pos[1]+self.height*0.75*(1 - 2/3 * root.marginy)
|
|
mid: root.pos[1]+self.height*0.5
|
|
right_edge: root.pos[0] + root.width * (1 - root.marginx)
|
|
canvas.before:
|
|
Color:
|
|
rgba: GREY
|
|
Line:
|
|
points: [root.pos[0]+self.width*root.marginx,root.whalf,root.pos[0]+self.width*(1-root.marginx),root.whalf]
|
|
width: 1.0
|
|
dashes: [1,2]
|
|
Line:
|
|
points: [root.pos[0]+self.width*root.marginx,root.mid,root.pos[0]+self.width*(1-root.marginx),root.mid]
|
|
width: 1.0
|
|
dashes: [4,4]
|
|
Line:
|
|
points: [root.pos[0]+self.width*root.marginx,root.bhalf,root.pos[0]+self.width*(1-root.marginx),root.bhalf]
|
|
width: 1.0
|
|
dashes: [1,2]
|
|
Line:
|
|
rectangle: [root.pos[0] + root.marginx * self.width, root.pos[1] + root.marginy*self.height, self.width*(1-2*root.marginx), root.height*(1-2*root.marginy)]
|
|
canvas.after:
|
|
Color:
|
|
rgba: BLACK
|
|
Line:
|
|
points: root.line_points
|
|
width: 1.1
|
|
Color:
|
|
rgba: GRAPH_DOT_COLOR
|
|
Ellipse:
|
|
id: dot
|
|
pos: root.dot_pos
|
|
size: self.highlight_size,self.highlight_size
|
|
GraphMarkerLabel:
|
|
font_size: 0.1 * root.height
|
|
id: range_label_top
|
|
pos: root.right_edge - self.width-1, root.pos[1]+root.height*(1-root.marginy) - self.font_size
|
|
text: 'B+' + str(int(root.y_scale))
|
|
GraphMarkerLabel:
|
|
font_size: 0.1 * root.height
|
|
pos: root.right_edge - self.width-1, root.mid - self.height/2 + 2
|
|
text: 'Jigo'
|
|
GraphMarkerLabel:
|
|
font_size: 0.1 * root.height
|
|
pos: root.right_edge - self.width-1, root.pos[1]
|
|
text: 'W+' + str(int(root.y_scale))
|
|
|
|
# UI components
|
|
|
|
<BadukPanWidget>:
|
|
size: self.parent.height, self.parent.height
|
|
katrain: app.gui
|
|
|
|
<BadukPanControls>:
|
|
katrain: app.gui
|
|
black_prisoners: black_prisoners
|
|
white_prisoners: white_prisoners
|
|
mid_circles_container: mid_circles_container
|
|
pass_btn: pass_btn
|
|
engine_status_col: 0.8,0,0,1
|
|
Label:
|
|
size_hint: 0.05, 1
|
|
BoxLayout:
|
|
size_hint: 0.2, 1
|
|
padding: [0.325*self.size[1],0.2*self.size[1]]
|
|
StyledButton:
|
|
text: 'Pass'
|
|
tooltip_text: '[space]\nPass'
|
|
font_size: 0.6*self.size[1]
|
|
id: pass_btn
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("play",None)
|
|
Label:
|
|
size_hint: 0.05, 1
|
|
BoxLayout:
|
|
size_hint: 0.3, 1
|
|
padding: [0, self.size[1]*0.3]
|
|
spacing: 0
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/previous999.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('undo',999)
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/previous5.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('undo',5)
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/previous.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('undo')
|
|
FloatLayout:
|
|
size_hint: 0.2, 1
|
|
id: mid_circles_container
|
|
BlackCircleWithText:
|
|
id: black_prisoners
|
|
pos: (self.parent.pos[0]-self.height/3,self.parent.pos[1]) if self.parent else (0,0)
|
|
radius: 0.4
|
|
WhiteCircleWithText:
|
|
id: white_prisoners
|
|
pos: (self.parent.pos[0]+self.height/3,self.parent.pos[1]) if self.parent else (0,0)
|
|
radius: 0.4
|
|
BoxLayout:
|
|
size_hint: 0.3, 1
|
|
padding: [0, self.size[1]*0.3]
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/next.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('redo')
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/next5.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('redo',5)
|
|
TransparentIconButton:
|
|
icon: 'img/flaticon/next999.png'
|
|
size_hint: 0.1, 1
|
|
on_press: root.katrain('redo',999)
|
|
Label:
|
|
size_hint: 0.05, 1
|
|
BoxLayout:
|
|
size_hint: 0.2, 1
|
|
padding: 0.2 * self.size[1]
|
|
StyledButton:
|
|
text: 'AI Move'
|
|
tooltip_text: '[enter]\nPlay an AI move\nusing the\nselected strategy.'
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("ai-move",None)
|
|
font_size: 0.6*self.size[1]
|
|
ClickableLabel:
|
|
size_hint: 0.025, 1
|
|
canvas:
|
|
Color:
|
|
rgba: root.engine_status_col
|
|
Ellipse:
|
|
pos: self.pos[0] + self.width/2 - self.height/5, self.pos[1] + self.height/2 - self.height/5
|
|
size: self.height/2.5,self.height/2.5
|
|
Color:
|
|
rgba: BLACK
|
|
Line:
|
|
circle: self.pos[0] + self.width/2, self.pos[1] + self.height/2, self.height/5 - 1
|
|
width: 1.1
|
|
on_press: root.katrain.controls.set_status("This simply indicates the Engine status, going from green (idle) to orange (processing many queries). It turns red when the engine has crashed or fails to start.")
|
|
Label:
|
|
size_hint: 0.025, 1
|
|
|
|
<ScrollableLabel>:
|
|
do_scroll_x: False
|
|
scroll_type: ['bars']
|
|
bar_width: 5
|
|
bar_color: BUTTON_COLOR
|
|
label: label
|
|
canvas.before:
|
|
Color:
|
|
rgba: root.border_color
|
|
Line:
|
|
rectangle: [self.pos[0],self.pos[1]+1,self.width-1,self.height-2]
|
|
width:1
|
|
Color:
|
|
rgba: [*[(c+1)/2 for c in root.border_color[:3]], root.border_color[3]]
|
|
Line:
|
|
rectangle: [self.pos[0]+1,self.pos[1]+2,self.width-3,self.height-3]
|
|
width:1
|
|
Label:
|
|
id: label
|
|
markup: root.markup
|
|
padding: 5, 5
|
|
font_size: dp(18)
|
|
color: BLACK
|
|
size_hint_y: None
|
|
height: self.texture_size[1]
|
|
text_size: self.width, None
|
|
text: root.text
|
|
on_ref_press: root.dispatch('on_ref_press',args[1])
|
|
|
|
<Controls>:
|
|
orientation: 'vertical'
|
|
play_tab_button: play_tab_button
|
|
analyze_tab_button: analyze_tab_button
|
|
info: info
|
|
note: note
|
|
status_label: status_label
|
|
win_rate: win_rate
|
|
score_change: score_change
|
|
score: score
|
|
show_children: show_children
|
|
hints: hints
|
|
ownership: ownership
|
|
policy: policy
|
|
eval: eval
|
|
analyze_extra: analyze_extra
|
|
analyze_equalize: analyze_equalize
|
|
analyze_sweep: analyze_sweep
|
|
player_mode_groups: {'B':B_player_mode,'W':W_player_mode}
|
|
ai_mode_groups: {'B':B_AI_mode,'W':W_AI_mode}
|
|
graph: graph
|
|
katrain: app.gui
|
|
BoxLayout:
|
|
size_hint: 1,0.05
|
|
orientation: 'horizontal'
|
|
padding: 3,1,3,0
|
|
spacing: 2
|
|
StyledTabButton:
|
|
text: 'Play'
|
|
group: 'tabs'
|
|
state: 'down'
|
|
id: play_tab_button
|
|
on_press:
|
|
play_tab.size_hint[0] = 1
|
|
play_tab.opacity = 1
|
|
analyze_tab.size_hint_x = None
|
|
analyze_tab.width = 0
|
|
analyze_tab.opacity = 0
|
|
self.state = 'down'
|
|
StyledTabButton:
|
|
text: 'Analyze'
|
|
id: analyze_tab_button
|
|
group: 'tabs'
|
|
on_press:
|
|
analyze_tab.size_hint[0] = 1
|
|
analyze_tab.opacity = 1
|
|
play_tab.size_hint_x = None
|
|
play_tab.width = 0
|
|
play_tab.opacity = 0
|
|
self.state = 'down'
|
|
BoxLayout:
|
|
size_hint: 1,0.25
|
|
orientation: 'horizontal'
|
|
BoxLayout: # ----------- analyze -----------
|
|
size_hint: 0,1
|
|
id: analyze_tab
|
|
padding: [3,3]
|
|
opacity: 0
|
|
orientation: 'vertical'
|
|
GridLayout:
|
|
cols: 5
|
|
rows: 2
|
|
size_hint: 1, 0.3
|
|
CheckBoxHintLabel:
|
|
text: 'next\nmoves'
|
|
tooltip_text: '[q]\nShow all next moves\nplayed from the current position'
|
|
CheckBoxHintLabel:
|
|
text: 'all\ndots'
|
|
tooltip_text: '[w]\nShow evaluation dots\non stones for all moves'
|
|
CheckBoxHintLabel:
|
|
text: 'top\nmoves'
|
|
tooltip_text: '[e]\nShow top\npredicted moves'
|
|
CheckBoxHintLabel:
|
|
text: 'show\nowner'
|
|
tooltip_text: '[r]\nShow predicted ownership\nof each intersection'
|
|
CheckBoxHintLabel:
|
|
text: 'NN\npolicy'
|
|
tooltip_text: "[t]\nShow Policy top moves\n(i.e. with no 'reading')"
|
|
CheckBox:
|
|
id: show_children
|
|
active: True
|
|
on_active: root.katrain.update_state()
|
|
CheckBox:
|
|
id: eval
|
|
on_active: root.katrain.update_state()
|
|
CheckBox:
|
|
id: hints
|
|
on_active: root.katrain.update_state()
|
|
CheckBox:
|
|
id: ownership
|
|
on_active: root.katrain.update_state()
|
|
CheckBox:
|
|
id: policy
|
|
on_active: root.katrain.update_state()
|
|
BoxLayout:
|
|
spacing:1
|
|
padding: 1,2,1,2
|
|
size_hint: 1,0.2
|
|
DarkLabel:
|
|
text: 'Analysis'
|
|
size_hint: 1, 1
|
|
multiline: False
|
|
font_size: 0.45*self.size[1]
|
|
StyledButton:
|
|
id: analyze_extra
|
|
text: 'Extra'
|
|
tooltip_text: '[a]\nExtra analysis\nto increase accuracy\nof top move predictions\nand score difference'
|
|
size_hint: 1, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","extra")
|
|
StyledButton:
|
|
id: analyze_equalize
|
|
text: 'Equalize'
|
|
tooltip_text: '[s]\nAnalysis of all\npredicted top moves\nwith the same accuracy'
|
|
size_hint: 1, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","equalize")
|
|
StyledButton:
|
|
id: analyze_sweep
|
|
text: 'Sweep'
|
|
tooltip_text: '[d]\nFast analysis\nof all legal moves'
|
|
size_hint: 1, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","sweep")
|
|
ScoreGraph:
|
|
id: graph
|
|
size_hint: 1,0.7
|
|
BoxLayout:
|
|
orientation: 'vertical'
|
|
size_hint: 1,0.3
|
|
spacing: 3
|
|
CensorableLabel:
|
|
id: win_rate
|
|
size_hint: 1, 0.5
|
|
label: 'Win rate'
|
|
text: ''
|
|
CensorableLabel:
|
|
id: score
|
|
size_hint: 1, 0.5
|
|
label: 'Score Estimate'
|
|
text: ''
|
|
BoxLayout: # ----------- play -----------
|
|
orientation: 'vertical'
|
|
size_hint: 1,1
|
|
opacity: 1
|
|
id: play_tab
|
|
Label:
|
|
size_hint: 1,0.02
|
|
GridLayout:
|
|
cols: 4
|
|
rows: 2
|
|
spacing: 1
|
|
padding: 1
|
|
size_hint: 1,0.125
|
|
BlackCircleWithText:
|
|
text: 'B'
|
|
size_hint: 0.1, 1
|
|
ToggleButtonContainer:
|
|
size_hint: 0.6, 1
|
|
id: B_player_mode
|
|
options: PLAYER_MODE_VALUES
|
|
labels: PLAYER_MODES
|
|
tooltips: PLAYER_TOOLTIPS
|
|
on_selection: root.katrain.update_state()
|
|
StyledSpinner:
|
|
id: B_AI_mode
|
|
values: ['Default']
|
|
size_hint: 0.3, 1
|
|
on_text: if B_player_mode.children: B_player_mode.children[0].trigger_action(duration=0)
|
|
Label:
|
|
size_hint: None,1
|
|
width: 3
|
|
WhiteCircleWithText:
|
|
text: 'W'
|
|
size_hint: 0.1, 1
|
|
ToggleButtonContainer:
|
|
size_hint: 0.6, 1
|
|
id: W_player_mode
|
|
options: PLAYER_MODE_VALUES
|
|
labels: PLAYER_MODES
|
|
tooltips: PLAYER_TOOLTIPS
|
|
on_selection: root.katrain.update_state()
|
|
StyledSpinner:
|
|
id: W_AI_mode
|
|
size_hint: 0.3, 1
|
|
values: ['Default']
|
|
on_text: if W_player_mode.children: W_player_mode.children[0].trigger_action(duration=0)
|
|
BoxLayout:
|
|
size_hint: 1,0.05
|
|
padding: 5,0
|
|
spacing: 1
|
|
StyledButton:
|
|
text: 'Configure Teacher'
|
|
tooltip_text: "Undos, dots, and\nSGF output settings"
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.configure_teacher()
|
|
size_hint: 1.425, 1
|
|
StyledButton:
|
|
text: 'Configure AIs'
|
|
tooltip_text: "Strength Settings per AI"
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.configure_ais()
|
|
BoxLayout:
|
|
size_hint: 1,0.10
|
|
padding: 5,5
|
|
spacing: 3
|
|
BoxLayout:
|
|
orientation: 'vertical'
|
|
size_hint: 0.15,1
|
|
Label:
|
|
StyledIconButton:
|
|
height: self.width
|
|
size_hint: 1, None
|
|
icon: 'img/flaticon/cogwheel.png'
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.configure_timer()
|
|
tooltip_text: "Configure timer"
|
|
Label:
|
|
Label:
|
|
size_hint: 0.025, 1
|
|
TimerLabel:
|
|
size_hint: 0.45,1
|
|
id: timer
|
|
text: '00:30'
|
|
DarkLabel:
|
|
size_hint: 0.1,1
|
|
id: periods
|
|
text: 'x5'
|
|
font_size: self.width*0.75
|
|
valign: 'top'
|
|
halign: 'left'
|
|
Label:
|
|
size_hint: 0.025, 1
|
|
BoxLayout:
|
|
orientation: 'vertical'
|
|
size_hint: 0.15,1
|
|
Label:
|
|
StyledIconStyledToggleButton:
|
|
height: self.width
|
|
size_hint: 1, None
|
|
icon_margin: 0.2 * self.size[0]
|
|
icon: 'img/flaticon/pause.png'
|
|
state: 'down'
|
|
Label:
|
|
Label:
|
|
size_hint: 1,0.1
|
|
CensorableLabel:
|
|
id: score_change
|
|
size_hint: 1, 0.024
|
|
label: 'Points Lost'
|
|
text: '-'
|
|
BoxLayout:
|
|
size_hint: 1,0.2
|
|
orientation: 'vertical'
|
|
ScrollableLabel:
|
|
id: status_label
|
|
border_color: 0.5,0.1,0.1,1
|
|
opacity: 1 if self.text else 0
|
|
text: ''
|
|
size_hint_y: None
|
|
height: 0.00001 if not self.text else min(0.66*self.parent.height,self.label.texture_size[1])
|
|
ScrollableLabel:
|
|
id: info
|
|
markup: True
|
|
on_ref_press: root.katrain.board_gui.show_pv_from_comments(args[1])
|
|
size_hint: 1, None
|
|
height: self.parent.height - status_label.height - note.height - 1
|
|
TextInput:
|
|
id: note
|
|
size_hint: 1, None
|
|
on_text: root.katrain.set_note(self.text)
|
|
hint_text: 'Your SGF notes for this position here.'
|
|
height: min( (len(self._lines)+0.7) * self.line_height, self.parent.height - status_label.height - 2.7*self.line_height)
|
|
BoxLayout:
|
|
orientation: 'horizontal'
|
|
size_hint: 1, None
|
|
spacing: 2
|
|
padding: 2
|
|
height: self.width * 0.25
|
|
StyledIconButton:
|
|
icon: 'img/flaticon/go-game.png'
|
|
tooltip_text: '[Ctrl-N]\nNew Game'
|
|
size_hint: 0.25, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("new-game-popup")
|
|
StyledIconButton:
|
|
icon: 'img/flaticon/open-folder.png'
|
|
tooltip_text: '[Ctrl-L]\nLoad Game'
|
|
size_hint: 0.25, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-sgf-popup")
|
|
StyledIconButton:
|
|
icon: 'img/flaticon/bar.png'
|
|
tooltip_text: '[Ctrl-S]\nSave Game'
|
|
size_hint: 0.25, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain('output-sgf')
|
|
StyledIconButton:
|
|
icon: 'img/flaticon/gears.png'
|
|
tooltip_text: 'General Settings'
|
|
size_hint: 0.25, 1
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain('config-popup')
|
|
|
|
<KaTrainGui>:
|
|
board_gui: board_gui
|
|
controls_box: controls_box
|
|
controls: controls
|
|
board_controls: board_controls
|
|
board_aspect_ratio: 1.075
|
|
BoxLayout:
|
|
size_hint: 1,1
|
|
canvas.before:
|
|
Color:
|
|
rgb: BOARD_COLOR
|
|
Rectangle:
|
|
pos: self.pos
|
|
size: self.size
|
|
orientation: 'vertical'
|
|
BadukPanWidget:
|
|
id: board_gui
|
|
BadukPanControls:
|
|
id: board_controls
|
|
size_hint_y: None
|
|
height: min(100,self.width / 13.5)
|
|
BoxLayout: # avoids a weird syntax error in builder .. somehow
|
|
size_hint_x: None
|
|
size_hint_y: 1
|
|
hidden: False
|
|
width: 0 if self.hidden else self.height * 0.4
|
|
opacity: 0 if self.hidden else 1
|
|
id: controls_box
|
|
canvas.before:
|
|
Color:
|
|
rgba: 0.95, 0.95, 0.95, 1
|
|
Rectangle:
|
|
pos: self.pos
|
|
size: self.size
|
|
Controls:
|
|
id: controls
|
|
|
|
<LoadSGFPopup>:
|
|
fast: fast
|
|
rewind: rewind
|
|
filesel: filesel
|
|
orientation: 'vertical'
|
|
Label:
|
|
text: root.filesel.path
|
|
size_hint: 1,0.05
|
|
halign: 'left'
|
|
FileChooserListView:
|
|
id: filesel
|
|
multiselect: False
|
|
filters: ["*.sgf"]
|
|
path: "."
|
|
size_hint: 1,0.88
|
|
BoxLayout:
|
|
orientation: 'horizontal'
|
|
size_hint: 1,0.07
|
|
canvas.before:
|
|
Color:
|
|
rgb: 0.4, 0.4, 0.4
|
|
Rectangle:
|
|
pos: self.pos
|
|
size: self.size
|
|
Label:
|
|
text: "Analyze Extra Fast"
|
|
size_hint: 0.45,1
|
|
halign: 'right'
|
|
CheckBox:
|
|
id: fast
|
|
color: (0.95, 0.95, 0.95)
|
|
size_hint: 0.05,1
|
|
Label:
|
|
text: "Rewind to Start"
|
|
halign: 'right'
|
|
size_hint: 0.45,1
|
|
CheckBox:
|
|
id: rewind
|
|
active: True
|
|
color: (0.95, 0.95, 0.95)
|
|
size_hint: 0.05,1
|
|
|
|
<QuickInputButton@StyledButton>
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": self.parent.parent.children[self.parent.parent.children.index(self.parent)+1].text = self.text # why +1 instead of -1?
|
|
|
|
<NewGamePopup>:
|
|
orientation: 'vertical'
|
|
rules_spinner: rules_spinner
|
|
info: info
|
|
restart: restart
|
|
GridLayout:
|
|
size_hint: 1, 0.8
|
|
rows: 6
|
|
cols: 3
|
|
spacing: 2
|
|
padding: 2
|
|
ScaledLightLabel:
|
|
text: "Size"
|
|
LabelledTextInput:
|
|
text: '19'
|
|
font_size: 0.5*self.size[1]
|
|
padding: 7, 0.2*self.size[1]
|
|
input_property: 'SZ'
|
|
BoxLayout:
|
|
spacing: 1
|
|
QuickInputButton:
|
|
text: '9'
|
|
QuickInputButton:
|
|
text: '13'
|
|
QuickInputButton:
|
|
text: '19'
|
|
ScaledLightLabel:
|
|
text: "Handicap"
|
|
LabelledIntInput:
|
|
text: '0'
|
|
input_property: 'HA'
|
|
BoxLayout:
|
|
spacing: 1
|
|
QuickInputButton:
|
|
text: '0'
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": km.text='6.5'
|
|
QuickInputButton:
|
|
text: '2'
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": km.text='0.5'
|
|
QuickInputButton:
|
|
text: '9'
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": km.text='0.5'
|
|
ScaledLightLabel:
|
|
text: "Komi"
|
|
LabelledFloatInput:
|
|
text: '6.5'
|
|
id: km
|
|
input_property: 'KM'
|
|
BoxLayout:
|
|
spacing: 1
|
|
QuickInputButton:
|
|
text: '0.5'
|
|
QuickInputButton:
|
|
text: '5.5'
|
|
QuickInputButton:
|
|
text: '6.5'
|
|
ScaledLightLabel:
|
|
text: "Ruleset"
|
|
LabelledSpinner:
|
|
input_property: 'RU'
|
|
id: rules_spinner
|
|
Label:
|
|
ScaledLightLabel:
|
|
text: 'Clear cache'
|
|
CheckBox:
|
|
color: WHITE
|
|
id: restart
|
|
ScaledLightLabel:
|
|
font_size: 0.35*self.size[1]
|
|
text: 'avoids replaying\nidentical games'
|
|
LightHelpLabel:
|
|
text: "Use x:y (e.g. 19:9) to play on a non-square board."
|
|
size_hint: 1,2
|
|
text_size: self.width-6, None
|
|
font_size: self.size[1]/6
|
|
id: info
|
|
LightHelpLabel:
|
|
text: "Note that handicaps above 9 are not supported on non-square boards."
|
|
font_size: self.size[1]/6
|
|
text_size: self.width-6, None
|
|
id: info
|
|
StyledButton:
|
|
halign: 'center'
|
|
text: 'Start\nGame'
|
|
font_size: 0.3 * self.size[1]
|
|
on_press: if not self.last_touch or self.last_touch.button=="left": root.new_game()
|