Files
katrain-qt/katrain/gui.kv
T
2020-05-24 00:16:27 +02:00

1107 lines
32 KiB
Plaintext

#:kivy 1.11.0
#:import i18n __main__.i18n
#: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 GRAPH_DOT_COLOR [0.85, 0.3, 0.3,1]
#-- NEW
#: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]
#:set GREEN [0.1,0.8,0.1,1]
#:set RED [0.8,0.1,0.1,1]
#:set LIGHTBLUE [0.3,0.7,0.9,1]
#:set YELLOW [0.8,0.8,0.1,1]
#:set SCORE_COLOR LIGHTBLUE
#:set POINTLOSS_COLOR YELLOW
#:set WINRATE_COLOR GREEN
#:set BUTTON_INACTIVE_COLOR GREY
#:set BACKGROUND_COLOR [36/255,48/255,62/255,1]
#:set BOX_BACKGROUND_COLOR [46/255,65/255,88/255,1]
#:set TEXT_COLOR WHITE
# mixins
<OutlineColor>:
canvas.before:
Color:
rgba: root.outline_color
Line:
rectangle: (*self.pos,*self.size)
width: root.outline_width
<BackgroundColor>:
canvas.before:
Color:
rgba: root.background_color
Rectangle:
size: self.size
pos: self.pos
<ToolTipLabel>: # TODO
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)
# new widgets
<SizedMDBaseButton>:
text_color: WHITE
label: label
Label:
id: label
text: root.text
size_hint_x: None
color: root.text_color
font_size: root.font_size
font_name: root.font_name or self.font_name
halign: root.halign
<SizedMDFlatButton>:
ripple_duration_in_slow: 0.6
<SizedMDFlatRectangleButton>:
outline_color: root.color
text_color: root.color
<SizedMDFlatRectangleToggleButton>:
inactive_color: BUTTON_INACTIVE_COLOR
text_color: root.color if self.state=='down' else self.inactive_color
outline_color: root.color if self.state=='down' else self.inactive_color
<AutoSizedMDFlatRectangleToggleButton>: # only wants height
width: self.label.texture_size[0] + self.hor_padding * 2
font_size: self.height * 0.8
<BGMDBoxLayout@MDBoxLayout+BackgroundColor>:
background_color: BOX_BACKGROUND_COLOR
# -- old 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
<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
<LightLabel>:
color: TEXT_COLOR
text_size: self.size # don't overflow these
halign: 'center'
valign: 'middle'
<TimerLabel@Label>
color: GREEN
font_size: 0.85*self.size[1]
halign: 'right'
valign: 'middle'
markup: True
multiline: False
font_name: 'img/fonts/digital-7.ttf'
<ScaledLightLabel>: # popups
color: TEXT_COLOR
font_size: 0.45*self.size[1]/self.num_lines
<LightHelpLabel>:
font_size: self.size[1]/10
halign: 'center'
valign: 'middle'
multiline: True
<ClickableLabel>:
color: WHITE
halign: 'center'
valign: 'middle'
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
MDLabel:
size_hint: 0.4,1
text: root.text
theme_text_color: 'Custom'
text_color: root.color
font_size: desc.font_size
id: value
bold: True
<CircleWithText>:
min_size: min(self.height,self.width)
Image:
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size: (root.min_size,root.min_size)
source: 'img/white.png' if root.player=='White' else 'img/black.png'
mipmap: True
MDLabel:
text: root.text
bold: True
color: BLACK if root.player=='White' else WHITE
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
size: (root.min_size,root.min_size)
halign: 'center'
valign: 'middle'
font_size: root.min_size * 1.2 / (1 + 1 * len(self.text)) # TODO: easier?
# UI components
<BadukPanWidget>:
size: self.parent.height, self.parent.height
katrain: app.gui
<BoardControlsButton@MDFillRoundFlatIconButton>:
md_bg_color: BOX_BACKGROUND_COLOR
<Menu@BoxLayout>:
eval: eval
policy: policy
hints: hints
ownership: ownership
analyze_extra: analyze_extra
analyze_equalize: analyze_equalize
analyze_sweep: analyze_sweep
ButtonBoxHolder:
size_hint_y: INFO_BOX_HEIGHT * 0.75
ButtonBox:
RHSToggleButton:
id: eval
text: 'Dots'
color: WHITE
RHSToggleButton:
id: ownership
text: 'Territory'
color: WHITE
RHSToggleButton:
id: policy
text: 'Policy'
color: WHITE
RHSToggleButton:
id: hints
text: 'Top Moves'
color: WHITE
RHSButton:
id: analyze_extra
text: 'Extra'
tooltip_text: '[a]\nExtra analysis\nto increase accuracy\nof top move predictions\nand score difference'
on_left_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","extra")
RHSButton:
id: analyze_equalize
text: 'Equalize'
tooltip_text: '[s]\nAnalysis of all\npredicted top moves\nwith the same accuracy'
on_left_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","equalize")
RHSButton:
id: analyze_sweep
text: 'Sweep'
tooltip_text: '[d]\nFast analysis\nof all legal moves'
on_left_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","sweep")
<NavIconButton@TransparentIconButton>:
size_hint: 0.06, 0.5
pos_hint: {'center_y': 0.5}
<BadukPanControls>:
katrain: app.gui
circles: [black_circle,white_circle]
mid_circles_container: mid_circles_container
pass_btn: pass_btn
hamburger: hamburger
analysis_button: analysis_button
adaptive_height: True
HamburgerButton:
id: hamburger
size_hint: None, 1
width: self.height
pos_hint: {'x': 0}
on_press: app.gui.nav_drawer.set_state("open")
StyledButton:
text: i18n._('pass-button-text')
tooltip_text: i18n._('pass-button-tooltip')
id: pass_btn
size_hint: None, 0.5
pos_hint: {'x': 0.1,'center_y':0.5}
width: self.height * 2
font_size: 0.6*self.size[1]
on_left_release: root.katrain("play",None)
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
BoxLayout:
size_hint: None, 1
width: 8 * self.height
pos_hint: {'center_x': 0.5,'center_y':0.5}
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
Label:
size_hint: 0.06, 0.5
NavIconButton:
icon: 'img/flaticon/previous999.png'
on_press: root.katrain('undo',999)
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
NavIconButton:
icon: 'img/flaticon/previous5.png'
on_press: root.katrain('undo',5)
NavIconButton:
icon: 'img/flaticon/previous.png'
on_press: root.katrain('undo')
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
MDFloatLayout:
size_hint: 0.075, 1
id: mid_circles_container
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
CircleWithText:
size_hint: 5/8, 1
pos_hint: {'center_x': 0.5-3/16}
id: black_circle
player: 'Black'
text: ''
CircleWithText:
size_hint: 5/8, 1
pos_hint: {'center_x': 0.5+3/16}
id: white_circle
player: 'White'
text: ''
NavIconButton:
icon: 'img/flaticon/next.png'
on_press: root.katrain('redo')
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
NavIconButton:
icon: 'img/flaticon/next5.png'
on_press: root.katrain('redo',5)
NavIconButton:
icon: 'img/flaticon/next999.png'
on_press: root.katrain('redo',999)
NavIconButton:
icon: 'img/flaticon/route.png'
StyledButton:
size_hint: None, 0.5
pos_hint: {'right': 1,'center_y':0.5}
width: self.height * 4
font_size: 0.6*self.size[1]
id: analysis_button
text: 'Analysis Settings'
icon: 'settings'
on_press: root.open_analysis_menu()
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
<HamburgerButton@MDFloatingActionButton>:
icon: 'menu'
size_hint: None, 1
width: self.height
# ---------- components of right pane -------
<PlayerInfo@MDBoxLayout>:
captures: 0
name: 'Player'
player: 'Black'
description: '...'
CircleWithText:
player: root.player
text: str(root.captures)
size_hint: 0.25, 1
MDBoxLayout:
size_hint: 0.75, 1
orientation: 'vertical'
Label:
text: root.name
Label:
text: root.description
<PonderInfo@BGMDBoxLayout>:
engine_status_col: [1,1,1,1]
MDBoxLayout:
orientation: 'vertical'
LightLabel:
size_hint: 1, 0.5
text: 'AI\nStatus'
font_size: self.height/3
halign: 'center'
valign: 'middle'
ClickableLabel:
size_hint: 1, 0.5
canvas:
Color:
rgba: root.engine_status_col
Ellipse:
pos: self.pos[0] + self.width/2 - self.width/6, self.pos[1] + self.height/2 - self.width/6
size: self.width/3, self.width/3
Color:
rgba: BLACK
Line:
circle: self.pos[0] + self.width/2, self.pos[1] + self.height/2, self.width/6
width: 1
on_press: app.gui.controls.set_status("This simply indicates the Engine status, going from green (idle) to orange (processing queries). It turns red when the engine has crashed or fails to start.")
<PauseButton@MDFloatingActionButton+ToggleButtonBehavior>:
icon: 'img/flaticon/pause.png'
height: self.width
size_hint: 1, None
<Timer@BGMDBoxLayout>:
state: (30,5,1)
spacing: CP_SPACING
padding: CP_PADDING * 2
paused: True
TimerLabel:
size_hint: 0.5,1
id: timer
text: f"{root.state[0]//60}:{int(root.state[0] % 60):02d}"
LightLabel:
size_hint: 0.1,1
id: periods
markup: True
text: f"x{root.state[1]}"
font_size: self.width*0.75
multiline: False
valign: 'top'
halign: 'left'
MDBoxLayout:
size_hint: 0.2,1
PauseButton:
pos_hint: {'center_y':0.5}
id: pause
state: 'down' if root.paused else 'normal'
on_press: root.paused = not root.paused
#:set GRAPH_CENTER_COLOR GREY
<GraphMarkerLabel@Label>:
valign: 'bottom'
halign: 'left'
text: '+0'
color: SCORE_COLOR
size: self.texture_size
<ScoreGraph>:
background_color: BOX_BACKGROUND_COLOR
whalf: root.pos[1]+self.height*0.25
bhalf: root.pos[1]+self.height*0.75
mid: root.pos[1]+self.height*0.5
right_edge: root.pos[0] + root.width
canvas:
Color:
rgba: GRAPH_CENTER_COLOR
Line:
points: [root.pos[0],root.whalf,root.pos[0]+root.width,root.whalf]
width: 1
dashes: [2,2]
Line:
points: [root.pos[0],root.mid,root.pos[0]+root.width,root.mid]
width: 1
dashes: [4,4]
Line:
points: [root.pos[0],root.bhalf,root.pos[0]+root.width,root.bhalf]
width: 1
dashes: [2,2]
canvas.after:
Color:
rgba: SCORE_COLOR
Line:
points: root.score_points
width: 1.1
Color:
rgba: WINRATE_COLOR
Line:
points: root.winrate_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 - 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))
<StatsBox@BoxLayout+BackgroundColor>
orientation: 'vertical'
background_color: BOX_BACKGROUND_COLOR
score: score
win_rate: win_rate
score_change: score_change
CensorableLabel:
id: win_rate
label: 'Win rate'
text: ''
color: WINRATE_COLOR
CensorableLabel:
id: score
label: 'Score'
text: ''
color: SCORE_COLOR
CensorableLabel:
id: score_change
label: 'Points Lost'
text: ''
color: POINTLOSS_COLOR
<ScrollableLabel>:
background_color: BOX_BACKGROUND_COLOR
outline_color: [0,0,0,0]
do_scroll_x: False
scroll_type: ['bars']
bar_width: 5
bar_color: BUTTON_COLOR
label: label
Label:
id: label
markup: root.markup
padding: 5, 5
font_size: dp(18)
color: WHITE
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])
#:set PLAYER_BOX_HEIGHT 0.15
#:set TIMER_BOX_HEIGHT 0.3
#:set GRAPH_BOX_HEIGHT 0.37
#:set STATS_BOX_HEIGHT 0.27
#:set INFO_BOX_HEIGHT 1
#:set CP_SPACING 6
#:set CP_SMALL_SPACING 3
#:set CP_PADDING 4
<ControlsPanel>:
katrain: app.gui
button_controls: app.gui and app.gui.button_controls
orientation: 'vertical'
players: {'B':B_player,'W':W_player}
engine_status_col: [1,1,1,1]
timer:timer
graph: graph
stats: stats
info: info
note: note
status: status
padding: CP_PADDING
spacing: CP_SPACING
tab_option_height: 20
BoxLayout: # -- Players
size_hint_y: PLAYER_BOX_HEIGHT
PlayerInfo:
id: B_player
player: 'Black'
PlayerInfo:
id: W_player
player: 'White'
BoxLayout:
size_hint_y: TIMER_BOX_HEIGHT
spacing: CP_SPACING
PonderInfo:
id: ponder
engine_status_col: root.engine_status_col
size_hint_x: 0.2
Timer:
id: timer
size_hint_x: 0.7
CollapsablePanel:
size_hint_y: GRAPH_BOX_HEIGHT
options: ['Score','Win Rate','Points Lost']
option_colors: [SCORE_COLOR,WINRATE_COLOR,POINTLOSS_COLOR]
option_active: [True,False,False]
options_height: root.tab_option_height
ScoreGraph:
id: graph
BoxLayout:
size_hint_y: STATS_BOX_HEIGHT
StatsBox:
id: stats
BoxLayout:
size_hint_y: INFO_BOX_HEIGHT
orientation: 'vertical'
ScrollableLabel:
id: status
size_hint: 1, None
height: min(self.parent.height*0.66,self.label.texture_size[1])
outline_color: RED
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.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.height - 2.7*self.line_height)
<RHSButton@SizedMDFlatRectangleButton>:
md_bg_color: BOX_BACKGROUND_COLOR
size: self.parent.button_size
font_size: self.height * 0.7
<RHSToggleButton@SizedMDFlatRectangleToggleButton>:
md_bg_color: BOX_BACKGROUND_COLOR
size: self.parent.button_size
font_size: self.height * 0.7
on_press: app.gui.controls.check_hide_show()
<ButtonBox@MDBoxLayout>
orientation: 'vertical'
button_size: self.parent.button_size
adaptive_size: True
pos_hint: {'center_y':0.5,'x':0}
spacing: CP_SMALL_SPACING
<ButtonBoxHolder@MDBoxLayout>:
button_size: self.parent.button_size
adaptive_width: True
<RightButtonControls>:
katrain: app.gui
orientation: 'vertical'
button_size: (self.size[1] * 0.08 , self.size[1] * 0.04)
size_hint_x: None
width: self.minimum_width # if not self.parent.zen else 1
padding: CP_PADDING, CP_PADDING
spacing: CP_SPACING
info: info
note: note
eval: eval
policy: policy
hints: hints
ownership: ownership
analyze_extra: analyze_extra
analyze_equalize: analyze_equalize
analyze_sweep: analyze_sweep
graph: {'winrate': winrate_graph,'score':score_graph,'points':points_graph}
ButtonBoxHolder:
size_hint_y: PLAYER_BOX_HEIGHT
ButtonBox:
RHSButton:
text: 'Pass'
on_left_press: print('pass?')
ButtonBoxHolder:
size_hint_y: TIMER_BOX_HEIGHT
ButtonBox:
RHSToggleButton:
text: 'MAN'
RHSToggleButton:
text: 'BYO'
ButtonBoxHolder:
size_hint_y: GRAPH_BOX_HEIGHT
ButtonBox:
RHSToggleButton:
text: 'Win %'
group: 'graph'
color: WINRATE_COLOR
id: winrate_graph
RHSToggleButton:
text: 'Score'
color: SCORE_COLOR
state: "down"
group: 'graph'
id: score_graph
RHSToggleButton:
text: 'Loss'
group: 'graph'
color: POINTLOSS_COLOR
id: points_graph
ButtonBoxHolder:
size_hint_y: STATS_BOX_HEIGHT
ButtonBox:
RHSToggleButton:
text: 'Win %'
color: WINRATE_COLOR
state: "down"
RHSToggleButton:
text: 'Score'
color: SCORE_COLOR
state: "down"
RHSToggleButton:
text: 'Loss'
color: POINTLOSS_COLOR
state: "down"
ButtonBoxHolder:
size_hint_y: INFO_BOX_HEIGHT
ButtonBox:
RHSToggleButton:
id: info
text: 'Info'
color: RED
state: "down"
group: "text"
RHSToggleButton:
id: note
text: 'Note'
color: GREEN
group: "text"
ButtonBoxHolder:
size_hint_y: INFO_BOX_HEIGHT * 0.01
ButtonBox:
RHSToggleButton:
id: eval
text: 'Dots'
color: WHITE
RHSToggleButton:
id: ownership
text: 'Territory'
color: WHITE
RHSToggleButton:
id: policy
text: 'Policy'
color: WHITE
RHSToggleButton:
id: hints
text: 'Top Moves'
color: WHITE
RHSButton:
id: analyze_extra
text: 'Extra'
tooltip_text: '[a]\nExtra analysis\nto increase accuracy\nof top move predictions\nand score difference'
on_left_press: root.katrain("analyze-extra","extra")
RHSButton:
id: analyze_equalize
text: 'Equalize'
tooltip_text: '[s]\nAnalysis of all\npredicted top moves\nwith the same accuracy'
on_left_press: root.katrain("analyze-extra","equalize")
RHSButton:
id: analyze_sweep
text: 'Sweep'
tooltip_text: '[d]\nFast analysis\nof all legal moves'
on_left_press: root.katrain("analyze-extra","sweep")
<MainMenuItem>
on_press: print(self.size, root.size, image.size, root.parent.parent, root.parent)
font_size: self.height * 0.5
MDFloatLayout:
size_hint: None, 1
width: self.height
Image:
id:image
source: root.icon
mipmap: True
size_hint: 0.7,0.7
pos_hint: {'center_y': 0.5,'center_x': 0.5}
Label:
text: root.text
text_size: self.size
size_hint_x: 1
halign: 'left'
valign: 'middle'
font_size: root.font_size
color: WHITE
Label:
text: root.shortcut
halign: 'left'
valign: 'middle'
size_hint_x: 1/3
font_size: root.font_size
color: GREY
<ContentNavigationDrawer@MDBoxLayout+BackgroundColor>:
katrain: app.gui
background_color: BOX_BACKGROUND_COLOR
orientation: 'vertical'
canvas.after:
Color:
rgba: YELLOW
Line:
rectangle: (*self.pos,*self.size)
width: 1
MDBoxLayout:
size_hint: 1, 1/10
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
SizedMDFlatButton:
text: i18n._('Dutch')
on_press: app.language = 'nl'
size_hint: 1/3,1
SizedMDFlatButton:
text: i18n._('English')
on_press: app.language = 'en'
size_hint: 1/3,1
SizedMDFlatButton:
text: i18n._('Ko')
on_press: app.language = 'ko'
size_hint: 1/3,1
Label:
MDBoxLayout:
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
orientation: 'vertical'
size_hint: 1, 1/3
MainMenuItem:
text: 'General Settings'
icon: 'img/flaticon/settings.png'
on_action: root.katrain('config-popup')
MainMenuItem:
text: 'Save Game'
icon: 'img/flaticon/savegame.png'
shortcut: 'Ctrl-S'
on_action: root.katrain("analyze-sgf-popup")
MainMenuItem:
text: 'Load Game'
icon: 'img/flaticon/loadgame.png'
shortcut: 'Ctrl-L'
on_action: root.katrain("analyze-sgf-popup")
MainMenuItem:
text: 'New Game'
icon: 'img/flaticon/newgame.png'
size_hint_x: 1
shortcut: 'Ctrl-N'
on_action: root.katrain("new-game-popup")
<KaTrainGui>:
board_gui: board_gui
controls: controls
board_controls: board_controls
button_controls: button_controls
analysis_controls: button_controls
nav_drawer: nav_drawer
zen: False
NavigationLayout:
ScreenManager:
Screen:
name: 'gui'
BGMDBoxLayout:
background_color: BACKGROUND_COLOR
MDBoxLayout:
orientation: 'vertical'
padding: CP_PADDING, CP_PADDING, CP_PADDING, 0
BadukPanWidget:
id: board_gui
BadukPanControls:
id: board_controls
size_hint_y: None
height: min(100,self.width / 13.5)
ControlsPanel:
id: controls
size_hint_x: None
width: 0 if root.zen else self.height * 0.35
opacity: 0 if root.zen else 1
RightButtonControls:
id: button_controls
MyNavigationDrawer:
id: nav_drawer
state: "close"
y: board_gui.pos[1]+CP_SPACING
size_hint_y: None
width: self.height * 0.4
height: root.height - self.y
swipe_edge_width: 0
ContentNavigationDrawer:
<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_left_press: 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_left_press: if not self.last_touch or self.last_touch.button=="left": km.text='6.5'
QuickInputButton:
text: '2'
on_left_press: if not self.last_touch or self.last_touch.button=="left": km.text='0.5'
QuickInputButton:
text: '9'
on_left_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_left_press: if not self.last_touch or self.last_touch.button=="left": root.new_game()