beter graph and i18n
This commit is contained in:
1 parent
738578ee5a
commit
c424541b35
15 files changed
+330
-179
No files matched your search
+99
-138
@@ -67,6 +67,7 @@
|
||||
|
||||
<SizedMDBaseButton>:
|
||||
text_color: WHITE
|
||||
md_bg_color: BOX_BACKGROUND_COLOR
|
||||
label: label
|
||||
Label:
|
||||
id: label
|
||||
@@ -74,7 +75,6 @@
|
||||
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>:
|
||||
@@ -91,14 +91,25 @@
|
||||
|
||||
<AutoSizedMDFlatRectangleButton>: # only wants height
|
||||
width: self.label.texture_size[0] + self.hor_padding * 2
|
||||
font_size: 0.75 * self.height / len(self.label.text.split('\n'))
|
||||
|
||||
<AutoSizedMDFlatRectangleToggleButton>: # only wants height
|
||||
width: self.label.texture_size[0] + self.hor_padding * 2
|
||||
|
||||
font_size: 0.75 * self.height / len(self.label.text.split('\n'))
|
||||
|
||||
<BGMDBoxLayout@MDBoxLayout+BackgroundColor>:
|
||||
background_color: BOX_BACKGROUND_COLOR
|
||||
|
||||
<TransparentIconButton>:
|
||||
background_normal: ''
|
||||
background_color: (0,0,0,0)
|
||||
icon_size: self.icon_size or [min(self.size[0],self.size[1]),min(self.size[0],self.size[1])]
|
||||
Image:
|
||||
size: root.icon_size
|
||||
pos: [root.pos[i] + (root.size[i] - root.icon_size[i])/2 for i in [0,1]]
|
||||
source: root.icon
|
||||
mipmap: True
|
||||
|
||||
|
||||
# -- old widgets
|
||||
|
||||
@@ -142,10 +153,6 @@
|
||||
<StyledToggleButton>:
|
||||
max_lines: 1
|
||||
|
||||
<StyledTabButton@StyledToggleButton>:
|
||||
bold: True
|
||||
radius: (self.size[1]/3,self.size[1]/3,0,0)
|
||||
|
||||
<ToggleButtonContainer>:
|
||||
|
||||
<LabelledTextInput>:
|
||||
@@ -183,17 +190,6 @@
|
||||
mipmap: True
|
||||
|
||||
|
||||
<TransparentIconButton>:
|
||||
background_normal: ''
|
||||
background_color: (0,0,0,0)
|
||||
icon_size: self.icon_size or [min(self.size[0],self.size[1]),min(self.size[0],self.size[1])]
|
||||
image: image
|
||||
Image:
|
||||
id: image
|
||||
size: root.icon_size
|
||||
pos: [root.pos[i] + (root.size[i] - root.icon_size[i])/2 for i in [0,1]]
|
||||
source: root.icon
|
||||
mipmap: True
|
||||
|
||||
<LightLabel>:
|
||||
color: TEXT_COLOR
|
||||
@@ -269,63 +265,18 @@
|
||||
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
|
||||
@@ -333,14 +284,13 @@
|
||||
width: self.height
|
||||
pos_hint: {'x': 0}
|
||||
on_press: app.gui.nav_drawer.set_state("open")
|
||||
StyledButton:
|
||||
SizedMDFlatRectangleButton:
|
||||
id: pass_btn
|
||||
text: i18n._('pass-button-text')
|
||||
tooltip_text: i18n._('pass-button-tooltip')
|
||||
id: pass_btn
|
||||
size_hint: None, 0.5
|
||||
width: 2*self.height
|
||||
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:
|
||||
@@ -419,26 +369,12 @@
|
||||
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'
|
||||
<HamburgerButton@TransparentIconButton>:
|
||||
icon: 'img/hamburger.png'
|
||||
size_hint: None, 1
|
||||
width: self.height
|
||||
icon_size: [self.height * 0.8, self.height * 0.8]
|
||||
|
||||
# ---------- components of right pane -------
|
||||
|
||||
@@ -527,7 +463,6 @@
|
||||
valign: 'bottom'
|
||||
halign: 'left'
|
||||
text: '+0'
|
||||
color: SCORE_COLOR
|
||||
size: self.texture_size
|
||||
|
||||
<ScoreGraph>:
|
||||
@@ -536,60 +471,82 @@
|
||||
bhalf: root.pos[1]+self.height*0.75
|
||||
mid: root.pos[1]+self.height*0.5
|
||||
right_edge: root.pos[0] + root.width
|
||||
marker_font_size: 0.1 * root.height
|
||||
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]
|
||||
# dashes: [2,2]
|
||||
Line:
|
||||
points: [root.pos[0],root.mid,root.pos[0]+root.width,root.mid]
|
||||
width: 1
|
||||
dashes: [4,4]
|
||||
# dashes: [4,4]
|
||||
Line:
|
||||
points: [root.pos[0],root.bhalf,root.pos[0]+root.width,root.bhalf]
|
||||
width: 1
|
||||
dashes: [2,2]
|
||||
# dashes: [2,2]
|
||||
canvas.after:
|
||||
Color:
|
||||
rgba: SCORE_COLOR
|
||||
Line:
|
||||
points: root.score_points
|
||||
points: root.score_points if root.show_score else []
|
||||
width: 1.1
|
||||
Color:
|
||||
rgba: WINRATE_COLOR
|
||||
Line:
|
||||
points: root.winrate_points
|
||||
points: root.winrate_points if root.show_winrate else []
|
||||
width: 1.1
|
||||
|
||||
Color:
|
||||
rgba: GRAPH_DOT_COLOR
|
||||
Ellipse:
|
||||
id: dot
|
||||
pos: root.dot_pos
|
||||
size: self.highlight_size,self.highlight_size
|
||||
# score ticks
|
||||
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))
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - self.width-1, root.pos[1]+root.height - self.font_size - 1
|
||||
text: 'B+{}'.format(root.score_scale)
|
||||
opacity: int(root.show_score)
|
||||
GraphMarkerLabel:
|
||||
font_size: 0.1 * root.height
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - self.width-1, root.mid - self.height/2 + 2
|
||||
text: 'Jigo'
|
||||
opacity: int(root.show_score)
|
||||
GraphMarkerLabel:
|
||||
font_size: 0.1 * root.height
|
||||
font_size: root.marker_font_size
|
||||
color: SCORE_COLOR
|
||||
pos: root.right_edge - self.width-1, root.pos[1]
|
||||
text: 'W+' + str(int(root.y_scale))
|
||||
text: 'W+' + str(int(root.score_scale))
|
||||
opacity: int(root.show_score)
|
||||
# wr ticks
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: WINRATE_COLOR
|
||||
pos: root.pos[0]+1, root.pos[1]+root.height - self.font_size - 1
|
||||
text: "{}%".format(50 + root.winrate_scale)
|
||||
opacity: int(root.show_winrate)
|
||||
GraphMarkerLabel:
|
||||
font_size: root.marker_font_size
|
||||
color: WINRATE_COLOR
|
||||
pos:root.pos[0]+1, root.pos[1]
|
||||
text: "{}%".format(50 - root.winrate_scale)
|
||||
opacity: int(root.show_winrate)
|
||||
|
||||
|
||||
<StatsBox@BoxLayout+BackgroundColor>
|
||||
orientation: 'vertical'
|
||||
background_color: BOX_BACKGROUND_COLOR
|
||||
score: score
|
||||
win_rate: win_rate
|
||||
winrate: winrate
|
||||
score_change: score_change
|
||||
CensorableLabel:
|
||||
id: win_rate
|
||||
id: winrate
|
||||
label: 'Win rate'
|
||||
text: ''
|
||||
color: WINRATE_COLOR
|
||||
@@ -625,15 +582,15 @@
|
||||
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 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
|
||||
#:set CP_PADDING 6
|
||||
|
||||
<ControlsPanel>:
|
||||
katrain: app.gui
|
||||
@@ -648,9 +605,14 @@
|
||||
status: status
|
||||
padding: CP_PADDING
|
||||
spacing: CP_SPACING
|
||||
tab_option_height: 20
|
||||
player_box_height: max(50, 0.1 * root.height)
|
||||
timer_box_height: max(50, 0.125 * root.height)
|
||||
graph_box_height: max(100, 0.2 * root.height)
|
||||
stats_box_height: max(50, 0.125 * root.height)
|
||||
tab_option_height: max(15,root.height / 30)
|
||||
BoxLayout: # -- Players
|
||||
size_hint_y: PLAYER_BOX_HEIGHT
|
||||
size_hint_y: None
|
||||
height: root.player_box_height
|
||||
PlayerInfo:
|
||||
id: B_player
|
||||
player: 'Black'
|
||||
@@ -658,7 +620,8 @@
|
||||
id: W_player
|
||||
player: 'White'
|
||||
BoxLayout:
|
||||
size_hint_y: TIMER_BOX_HEIGHT
|
||||
size_hint_y: None
|
||||
height: root.timer_box_height
|
||||
spacing: CP_SPACING
|
||||
PonderInfo:
|
||||
id: ponder
|
||||
@@ -668,27 +631,28 @@
|
||||
id: timer
|
||||
size_hint_x: 0.7
|
||||
CollapsablePanel:
|
||||
size_hint_y_open: GRAPH_BOX_HEIGHT
|
||||
closed_label: 'Score Graph'
|
||||
options: ['Score','Win Rate','PtLoss']
|
||||
height_open: root.graph_box_height
|
||||
closed_label: 'closedlabel:scoregraph'
|
||||
options: ['score','winrate','points']
|
||||
option_colors: [SCORE_COLOR,WINRATE_COLOR,POINTLOSS_COLOR]
|
||||
option_default_active: [True,False,False]
|
||||
options_height: root.tab_option_height
|
||||
on_option_state: graph.show_graphs(args[1])
|
||||
ScoreGraph:
|
||||
id: graph
|
||||
CollapsablePanel:
|
||||
size_hint_y_open: STATS_BOX_HEIGHT
|
||||
closed_label: 'Move Stats'
|
||||
options: ['Score','Win Rate','PtLoss']
|
||||
height_open: root.stats_box_height
|
||||
closed_label: 'closedlabel:movestats'
|
||||
options: ['score','winrate','points']
|
||||
option_colors: [SCORE_COLOR,WINRATE_COLOR,POINTLOSS_COLOR]
|
||||
option_default_active: [True,True,True]
|
||||
options_height: root.tab_option_height
|
||||
StatsBox:
|
||||
id: stats
|
||||
CollapsablePanel:
|
||||
size_hint_y: INFO_BOX_HEIGHT
|
||||
closed_label: 'Move Info & Notes'
|
||||
options: ['Info','Notes']
|
||||
size_hint_y_open: 1
|
||||
closed_label: 'closedlabel:info¬es'
|
||||
options: ['info','notes']
|
||||
option_colors: [RED,GREEN]
|
||||
option_default_active: [True,False]
|
||||
options_height: root.tab_option_height
|
||||
@@ -711,7 +675,8 @@
|
||||
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)
|
||||
|
||||
Label:
|
||||
size_hint_y: 1e-9 # takes up remaining space if info is closed
|
||||
|
||||
<RHSButton@AutoSizedMDFlatRectangleButton>:
|
||||
md_bg_color: BOX_BACKGROUND_COLOR
|
||||
@@ -722,7 +687,7 @@
|
||||
on_press: app.gui.update_state()
|
||||
size_hint_y: 1
|
||||
|
||||
<AnalysisControls@MDBoxLayout>:
|
||||
<AnalysisControls>:
|
||||
katrain: app.gui
|
||||
orientation: 'horizontal'
|
||||
padding: CP_PADDING, CP_PADDING
|
||||
@@ -732,9 +697,8 @@
|
||||
policy: policy
|
||||
hints: hints
|
||||
ownership: ownership
|
||||
analyze_extra: analyze_extra
|
||||
analyze_equalize: analyze_equalize
|
||||
analyze_sweep: analyze_sweep
|
||||
analysis_button: analysis_button
|
||||
Label:
|
||||
RHSToggleButton:
|
||||
id: show_children
|
||||
text: 'Next\nMoves'
|
||||
@@ -757,21 +721,10 @@
|
||||
text: 'Top\nMoves'
|
||||
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")
|
||||
|
||||
id: analysis_button
|
||||
on_press: root.open_analysis_menu()
|
||||
text: 'Analysis'
|
||||
Label:
|
||||
|
||||
|
||||
<MainMenuItem>
|
||||
@@ -884,18 +837,26 @@
|
||||
AnalysisControls:
|
||||
id: analysis_controls
|
||||
size_hint_y: None
|
||||
height: min(100,self.width / 13.5) if not root.zen else 1
|
||||
height: min(100,self.width / 13.5) if not root.zen else 0
|
||||
opacity: 0 if root.zen else 1
|
||||
BadukPanWidget:
|
||||
id: board_gui
|
||||
BadukPanControls:
|
||||
id: board_controls
|
||||
size_hint_y: None
|
||||
height: min(100,self.width / 13.5)
|
||||
ControlsPanel:
|
||||
id: controls
|
||||
MDBoxLayout:
|
||||
size_hint_x: None
|
||||
width: 0 if root.zen else self.height * 0.35
|
||||
width: 0 if root.zen else self.height * 0.4
|
||||
opacity: 0 if root.zen else 1
|
||||
orientation: 'vertical'
|
||||
MDBoxLayout:
|
||||
size_hint_y: None
|
||||
height: analysis_controls.height
|
||||
Label:
|
||||
text: 'BlaBla'
|
||||
ControlsPanel:
|
||||
id: controls
|
||||
MyNavigationDrawer:
|
||||
id: nav_drawer
|
||||
state: "close"
|
||||
|
||||
Reference in new issue
Block a user