This commit is contained in:
Sander Land committed 2020-05-27 17:09:47 +02:00
1 parent b062d78dba
commit 01f0663ac1
22 files changed
+584 -166

No files matched your search

+105 -62
View File
@@ -32,6 +32,11 @@
#:set NOTES_FONT_SIZE dp(18)
#<DefaultLabel@Label>:
# font_name: 'Roboto'
#<Label>:
# font_name: i18n._('LANG_FONT')
<I18NLabel>:
font_name: i18n._('LANG_FONT')
canvas.before:
@@ -45,16 +50,7 @@
font_name: i18n._('LANG_FONT')
# mixins
<OutlineColor>:
canvas.before:
Color:
rgba: root.outline_color
Line:
rectangle: (*self.pos,*self.size)
rounded_rectangle: (*self.pos,*self.size,root.background_radius,root.background_radius,root.background_radius,root.background_radius,self.height)
width: root.outline_width
<BackgroundColor>:
<BackgroundMixin>:
canvas.before:
Color:
rgba: root.background_color
@@ -62,6 +58,11 @@
size: self.size
pos: self.pos
radius: [root.background_radius, ]
Color:
rgba: root.outline_color
Line:
rounded_rectangle: (*self.pos,self.width,self.height,root.background_radius)
width: root.outline_width or 1
<ToolTipLabel>: # TODO
@@ -84,45 +85,55 @@
# new widgets
<SizedMDButton>:
<SizedButton>:
ripple_duration_in_slow: 0.6
text_color: WHITE
background_color: BOX_BACKGROUND_COLOR
label: label
text_size: root.size
I18NLabel:
id: label
text: root.text
size: self.texture_size
size_hint_x: None
padding: [root.padding_x,root.padding_y]
color: root.text_color
font_size: root.font_size
font_size: 0.6 * self.height / len(self.text.split('\\n')) if root._font_size is None else root._font_size
halign: root.halign
text: root.text
<SizedMDToggleButton>
<AutoSizedButton>:
width: root.label.texture_size[0]
<ToggleButtonMixin>:
inactive_background_color: BACKGROUND_COLOR
active_background_color: BOX_BACKGROUND_COLOR
background_color: self.active_background_color if self.state=='down' else self.inactive_background_color
outline_color: self.active_outline_color if self.state=='down' else self.inactive_outline_color
<SizedMDRectangleButton>:
<SizedRectangleButton>:
outline_color: WHITE
text_color: self.outline_color
<SizedMDRectangleToggleButton>:
<AutoSizedRectangleButton>:
outline_color: WHITE
text_color: self.outline_color
<SizedRectangleToggleButton>:
inactive_outline_color: BUTTON_INACTIVE_COLOR
active_outline_color: WHITE
text_color: self.outline_color
<AutoSizedMDRectangleButton>: # only wants height
width: self.label.texture_size[0] + self.hor_padding * 2
font_size: 0.7 * self.height / len(self.label.text.split('\n'))
<AutoSizedRectangleToggleButton>:
inactive_outline_color: BUTTON_INACTIVE_COLOR
active_outline_color: WHITE
text_color: self.outline_color
<AutoSizedMDRectangleToggleButton>: # only wants height
width: self.label.texture_size[0] + self.hor_padding * 2
font_size: 0.7 * self.height / len(self.label.text.split('\n'))
<SizedRoundedRectangleButton@SizedRectangleButton>:
background_radius: self.height/3.5
<AutoSizedRoundedRectangleButton@AutoSizedRectangleButton>:
background_radius: self.height/3.5
<BGMDBoxLayout@MDBoxLayout+BackgroundColor>:
<BGMDBoxLayout@MDBoxLayout+BackgroundMixin>:
background_color: BOX_BACKGROUND_COLOR
<TransparentIconButton>:
@@ -251,7 +262,9 @@
Label:
id: lbl
text: root.text
text_size: None, root.min_size
bold: True
valign: 'center'
color: BLACK if root.player=='White' else WHITE
pos: (image.x, image.y)
size: image.size
@@ -275,10 +288,9 @@
mid_circles_container: mid_circles_container
pass_btn: pass_btn
adaptive_height: True
AutoSizedMDRectangleButton:
AutoSizedRoundedRectangleButton:
id: pass_btn
text: i18n._('pass-button-text')
background_radius: 10
size_hint: None, 0.5
pos_hint: {'center_x': 0.15,'center_y':0.5}
on_left_release: root.katrain("play",None)
@@ -298,7 +310,7 @@
icon: 'img/flaticon/previous.png'
on_press: root.katrain('undo')
MDFloatLayout:
size_hint: 0.065, 1
size_hint: 0.05, 1
id: mid_circles_container
CircleWithText:
size_hint: 5/8, 1
@@ -323,6 +335,7 @@
on_press: root.katrain('redo',999)
NavIconButton:
icon: 'img/flaticon/route.png'
on_press: root.katrain('switch-branch',1)
ClickableLabel:
pos_hint: {'center_x': 0.85,'center_y':0.5}
size_hint: None, 1
@@ -389,22 +402,34 @@
<Timer@BGMDBoxLayout>:
state: (30,5,1)
spacing: CP_SPACING
padding: CP_PADDING * 2
padding: CP_PADDING * 4, CP_PADDING * 2
paused: True
TimerLabel:
size_hint: 0.5,1
id: timer
halign: 'right'
valign: 'middle'
font_size: 0.85*self.size[1]
text: f"{root.state[0]//60}:{int(root.state[0] % 60):02d}"
TimerLabel:
size_hint: 0.2,1
id: periods
text: f"x{root.state[1]}"
font_size: self.width*0.45
multiline: False
valign: 'top'
MDBoxLayout:
size_hint: 0.7,1
TimerLabel:
size_hint: 0.4,1
id: timer
text_size: self.size
halign: 'right'
valign: 'middle'
font_size: 0.85*self.size[1]
text: f"{root.state[0]//60}:{int(root.state[0] % 60):02d}"
TimerLabel:
size_hint: 0.05,1
text: "x"
font_size: self.height * 0.3
text_size: self.width, self.height * 0.95
halign: 'right'
valign: 'top'
TimerLabel:
size_hint: 0.1,1
font_size: self.height * 0.35
text_size: self.size
halign: 'left'
valign: 'top'
id: periods
text: str(root.state[1])
multiline: False
MDBoxLayout:
size_hint: 0.2,1
PauseButton:
@@ -504,12 +529,18 @@
size_hint: 0.6,1
id: desc
text: root.label if not root.hidden else ''
font_size: self.size[1] * 0.8
font_size: self.size[1] * 0.7
text_size: self.size
valign: 'middle'
halign: 'center'
I18NLabel:
size_hint: 0.4,1
text: root.text if not root.hidden else ''
color: root.color
font_size: desc.font_size
text_size: self.size
valign: 'middle'
halign: 'center'
id: value
bold: True
@@ -569,6 +600,7 @@
#:set CP_SMALL_SPACING 3
#:set CP_PADDING 6
<CollapsablePanelHeader>:
canvas.after:
Color:
@@ -593,7 +625,7 @@
player_box_height: max(50, 0.075 * root.height)
timer_box_height: max(50, 0.1 * root.height)
graph_box_height: max(100, 0.2 * root.height)
stats_box_height: max(50, 0.125 * root.height)
stats_box_height: max(50, 0.15 * root.height)
tab_option_height: max(15,root.height / 30)
BoxLayout: # -- Players
size_hint_y: None
@@ -611,10 +643,19 @@
Timer:
id: timer
size_hint_x: 0.7
BoxLayout:
MDBoxLayout:
orientation: 'vertical'
padding: 2*CP_PADDING,CP_PADDING
spacing: CP_SPACING
size_hint_x: 0.3
Label:
text: '??'
SizedRoundedRectangleButton:
text: i18n._('pass-button-text')
size_hint: 1, 0.5
on_left_release: root.katrain("play",None)
SizedRoundedRectangleButton:
text: i18n._('undo-button-text')
size_hint: 1, 0.5
on_left_release: root.katrain("undo","smart")
CollapsablePanel:
height_open: root.graph_box_height
closed_label: 'closedlabel:scoregraph'
@@ -670,11 +711,12 @@
size_hint_y: 1e-9 # takes up remaining space if info is closed
<AnalysisToggle@MDBoxLayout>:
<AnalysisToggle>:
adaptive_width: True
spacing: CP_SPACING
size_hint: None, 0.7
pos_hint: {'center_y':0.5}
checkbox: checkbox
I18NLabel:
id: label
text: root.text
@@ -688,7 +730,7 @@
size_hint: None,0.5
pos_hint: {'center_y': 0.5}
width: self.height
active: root.active
active: root.default_active
selected_color: WHITE
unselected_color: LIGHTGREY
on_active: if app.gui: app.gui.update_state()
@@ -733,20 +775,20 @@
AnalysisToggle:
id: show_children
text: i18n._("analysis:nextmoves")
active: True
default_active: True
AnalysisToggle:
id: eval
text: i18n._("analysis:dots")
AnalysisToggle:
id: ownership
text: i18n._('analysis:territory')
id: hints
text: i18n._("analysis:topmoves")
AnalysisToggle:
id: policy
text: i18n._("analysis:policy")
AnalysisToggle:
id: hints
text: 'Top\nMoves'
AutoSizedMDRectangleButton:
id: ownership
text: i18n._('analysis:territory')
AutoSizedRoundedRectangleButton:
background_color: BOX_BACKGROUND_COLOR
size_hint_y: 0.5
id: analysis_button
@@ -789,13 +831,13 @@
size_hint: 1,1
icon_size: self.height * 0.9, self.height * 0.9
<MenuLabel@I18NLabel+BackgroundColor>:
<MenuLabel@I18NLabel+BackgroundMixin>:
background_color: BACKGROUND_COLOR
font_size: self.height * 0.5
height: self.parent.item_height or 50
size_hint: 1,None
<ContentNavigationDrawer@MDBoxLayout+BackgroundColor>:
<ContentNavigationDrawer@MDBoxLayout+BackgroundMixin>:
katrain: app.gui
background_color: BOX_BACKGROUND_COLOR
orientation: 'vertical'
@@ -831,7 +873,6 @@
on_action: root.katrain('config-popup')
MenuLabel:
text: i18n._('menu:lang')
size_hint_y: None
MDBoxLayout:
size_hint: 1, None
height: 1.5 * root.item_height
@@ -844,17 +885,19 @@
LangButton:
icon: 'img/flaticon/flag-ko.png'
on_press: app.language = 'ko'
MenuLabel:
text: i18n._('menu:support')
<OutlineBox@MDBoxLayout+OutlineColor>:
<OutlineBox@MDBoxLayout+BackgroundMixin>:
<PlayAnalyzeButton@SizedMDToggleButton>:
<PlayAnalyzeButton@SizedToggleButton>:
inactive_background_color: BOX_BACKGROUND_COLOR
active_background_color: YELLOW
ripple_color: BACKGROUND_COLOR
text_color: self.inactive_background_color if self.state=='down' else self.active_background_color
size_hint: 0.5,1
font_size: self.height * 0.5
_font_size: self.height * 0.5
group: 'play_analyze'
allow_no_selection: False