lighten icons, badukpan controls, etc

This commit is contained in:
Sander Land committed 2020-05-21 23:10:36 +02:00
1 parent 2fc2cca7e1
commit f87380a319
12 files changed
+192 -128

No files matched your search

+179 -117
View File
@@ -36,7 +36,7 @@
<OutlineColor>:
canvas.before:
Color:
rgb: root.outline_color
rgba: root.outline_color
Line:
rectangle: (*self.pos,*self.size)
width: root.outline_width
@@ -44,7 +44,7 @@
<BackgroundColor>:
canvas.before:
Color:
rgb: root.background_color
rgba: root.background_color
Rectangle:
pos: self.pos
size: self.size
@@ -94,6 +94,8 @@
text_color: root.color if self.state=='down' else self.disabled_color
outline_color: root.color if self.state=='down' else self.disabled_color
<BGMDBoxLayout@MDBoxLayout+BackgroundColor>:
background_color: BOX_BACKGROUND_COLOR
# -- old widgets
@@ -193,7 +195,7 @@
color: TEXT_COLOR
text_size: self.size # don't overflow these
halign: 'center'
valign: 'center'
valign: 'middle'
<TimerLabel@Label>
color: GREEN
@@ -211,14 +213,14 @@
<LightHelpLabel>:
font_size: self.size[1]/10
halign: 'center'
valign: 'center'
valign: 'middle'
multiline: True
<ClickableLabel@ButtonBehavior+LightLabel>:
color: WHITE
halign: 'center'
valign: 'center'
valign: 'middle'
size: self.texture_size
<CensorableLabel>:
@@ -239,38 +241,24 @@
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
<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
@@ -281,6 +269,53 @@
<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_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_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_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]
@@ -288,79 +323,114 @@
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: root.nav_drawer.set_state("open")
Label:
size_hint: 0.05, 1
StyledButton:
text: 'Pass'
tooltip_text: '[space]\nPass'
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_release: if not self.last_touch or self.last_touch.button=="left": root.katrain("play",None)
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 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_release: 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:
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'
size_hint: 0.1, 1
on_press: root.katrain('undo',999)
TransparentIconButton:
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
NavIconButton:
icon: 'img/flaticon/previous5.png'
size_hint: 0.1, 1
on_press: root.katrain('undo',5)
TransparentIconButton:
NavIconButton:
icon: 'img/flaticon/previous.png'
size_hint: 0.1, 1
on_press: root.katrain('undo')
FloatLayout:
size_hint: 0.1, 1
id: mid_circles_container
BlackCircleWithText:
id: black_circle
text: ''
pos: (self.parent.pos[0]-self.height/5,self.parent.pos[1]) if self.parent else (0,0)
radius: 0.3
WhiteCircleWithText:
id: white_circle
text: ''
pos: (self.parent.pos[0]+self.height/5,self.parent.pos[1]) if self.parent else (0,0)
radius: 0.3
BoxLayout:
size_hint: 0.3, 1
padding: [0, self.size[1]*0.3]
TransparentIconButton:
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'
size_hint: 0.1, 1
on_press: root.katrain('redo')
TransparentIconButton:
canvas.before:
Color:
rgba: RED
Line:
rectangle: (*self.pos,*self.size)
width: 1
NavIconButton:
icon: 'img/flaticon/next5.png'
size_hint: 0.1, 1
on_press: root.katrain('redo',5)
TransparentIconButton:
NavIconButton:
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]
BoardControlsButton:
id: analysis_button
text: 'Analysis'
icon: 'settings'
on_press: root.open_analysis_menu()
Label:
size_hint: 0.025, 1
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'
@@ -369,25 +439,19 @@
# ---------- components of right pane -------
<ControlPanelSection@BoxLayout+BackgroundColor>:
background_color: BOX_BACKGROUND_COLOR
<PlayerInfo@MDBoxLayout>:
captures: 0
name: 'Player'
player: 'Black'
description: '...'
BlackCircleWithText:
CircleWithText:
player: root.player
text: str(root.captures)
size_hint: 0.2, 1
radius: 0.75
canvas.before:
Color:
rgb: [1,0,0,1]
Line:
rectangle: (*self.pos,*self.size)
width: 1
size_hint: 0.25, 1
MDBoxLayout:
size_hint: 0.8, 1
size_hint: 0.75, 1
orientation: 'vertical'
Label:
text: root.name
@@ -395,7 +459,7 @@
text: root.description
<PonderInfo@ControlPanelSection>:
<PonderInfo@BGMDBoxLayout>:
engine_status_col: [1,1,1,1]
MDBoxLayout:
orientation: 'vertical'
@@ -426,7 +490,7 @@
height: self.width
size_hint: 1, None
<Timer@ControlPanelSection>:
<Timer@BGMDBoxLayout>:
state: (30,5,1)
spacing: CP_SPACING
padding: CP_PADDING * 2
@@ -586,8 +650,10 @@
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
@@ -662,9 +728,6 @@
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
@@ -713,7 +776,7 @@
color: POINTLOSS_COLOR
state: "down"
ButtonBoxHolder:
size_hint_y: INFO_BOX_HEIGHT * 0.25
size_hint_y: INFO_BOX_HEIGHT
ButtonBox:
RHSToggleButton:
id: info
@@ -727,7 +790,7 @@
color: GREEN
group: "text"
ButtonBoxHolder:
size_hint_y: INFO_BOX_HEIGHT * 0.75
size_hint_y: INFO_BOX_HEIGHT * 0.01
ButtonBox:
RHSToggleButton:
id: eval
@@ -762,6 +825,7 @@
on_press: if not self.last_touch or self.last_touch.button=="left": root.katrain("analyze-extra","sweep")
<ContentNavigationDrawer@MDBoxLayout+BackgroundColor>:
orientation: 'vertical'
background_color: BOX_BACKGROUND_COLOR
@@ -776,14 +840,11 @@
text: 'pos'
on_press: print(self.pos,self.parent.pos,self.parent.parent.pos,self.parent.parent.parent.pos,self.parent.parent.parent.parent.pos,self.parent.parent.parent.parent)
<GuiContents@MDBoxLayout+BackgroundColor>
background_color: BACKGROUND_COLOR
<KaTrainGui>:
board_gui: board_gui
controls: controls
board_controls: board_controls
analysis_controls: analysis_controls
button_controls: button_controls
analysis_controls: button_controls
zen: False
@@ -791,17 +852,18 @@
ScreenManager:
Screen:
name: 'gui'
GuiContents:
BGMDBoxLayout:
background_color: BACKGROUND_COLOR
MDBoxLayout:
orientation: 'vertical'
padding: CP_PADDING, 0
padding: CP_PADDING, CP_PADDING, CP_PADDING, 0
BadukPanWidget:
id: board_gui
BadukPanControls:
id: board_controls
nav_drawer: nav_drawer
size_hint_y: None
height: max(dp(75),self.width / 13.5)
height: min(100,self.width / 13.5)
ControlsPanel:
id: controls
size_hint_x: None