This commit is contained in:
Sander Land committed 2020-05-30 17:58:28 +02:00
1 parent d7915401e7
commit 48f6166d48
23 files changed
+713 -926

No files matched your search

+39 -80
View File
@@ -1,20 +1,15 @@
#:kivy 1.11.0
#:import i18n katrain.core.utils.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]
#-- NEW
# TODO: refactor
#:set CP_SPACING 6
#:set CP_SMALL_SPACING 3
#:set CP_PADDING 6
#:import PLAYER_TYPES katrain.core.constants.PLAYER_TYPES
#:import PLAYER_HUMAN katrain.core.constants.PLAYER_HUMAN
#:import PLAYER_AI katrain.core.constants.PLAYER_AI
#:import RED katrain.gui.style.RED
#:import WHITE katrain.gui.style.WHITE
#:import BACKGROUND_COLOR katrain.gui.style.BACKGROUND_COLOR
@@ -147,7 +142,6 @@
width: 1
<I18NSpinner>:
text: self.values[0] if self.values else ''
font_size: self.height * 0.5
sync_height_frac: 1.0
background_color: [*[c*255/88 for c in BACKGROUND_COLOR[:3]], 1] # compensate for texture
@@ -173,59 +167,6 @@
size: image.size
font_size: root.min_size * 1.2 / (1 + 1 * len(self.text))
# -- old widgets TODO: remove
<ToolTipLabel>: # TODO update/remove
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)
<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.height-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
<LightLabel>:
color: TEXT_COLOR
text_size: self.size # don't overflow these
halign: 'center'
valign: 'middle'
<ScaledLightLabel>: # popups
color: TEXT_COLOR
font_size: 0.45*self.height/self.num_lines
<LightHelpLabel>:
font_size: self.height/10
halign: 'center'
valign: 'middle'
multiline: True
<ClickableLabel>:
color: WHITE
halign: 'center'
@@ -327,8 +268,8 @@
<PlayerInfo>:
captures: 0
player: 'B'
player_type: 'Player'
player_subtype: 'Normal game'
player_type: 'player:human'
player_subtype: 'game:normal'
background_color: BOX_BACKGROUND_COLOR if self.active else BACKGROUND_COLOR
outline_color: BOX_BACKGROUND_COLOR
outline_width: 2
@@ -342,11 +283,11 @@
orientation: 'vertical'
spacing: CP_SPACING
Label:
text: root.player_type
text: i18n._(root.player_type)
size_hint: 1,0.55
font_size: 0.8 * self.height
Label:
text: root.player_subtype
text: i18n._(root.player_subtype)
size_hint: 1,0.45
font_size: 0.7 * self.height
@@ -585,7 +526,7 @@
do_scroll_x: False
scroll_type: ['bars']
bar_width: 5
bar_color: BUTTON_COLOR
bar_color: LIGHTGREY
label: label
canvas.before:
Color:
@@ -874,8 +815,8 @@
spacing: CP_SPACING
padding: 0, CP_PADDING
player_type: player_type
player_subtype: player_subtype
player_subtype_label: player_subtype_label
player_subtype_human: player_subtype_human
player_subtype_ai: player_subtype_ai
MDBoxLayout:
size_hint: 0.25, 1
CircleWithText:
@@ -893,19 +834,37 @@
I18NSpinner:
id: player_type
value_refs: PLAYER_TYPES
on_text: root.setup_options(*args)
on_select: root.setup_options(*args)
MDBoxLayout:
size_hint: 0.5, 1
orientation: 'vertical'
spacing: CP_SPACING
Label:
text: 'Player Type'
id: player_subtype_label
font_size: self.height * 0.5
I18NSpinner:
id: player_subtype
value_refs: []
on_text: root.update_global_player_info()
MDBoxLayout:
orientation: 'vertical'
spacing: CP_SPACING
size_hint_x: 1 if root.mode != PLAYER_AI else 0.0001
opacity:1 if root.mode != PLAYER_AI else 0
Label:
text: i18n._("gametype")
font_size: self.height * 0.5
BoxLayout:
I18NSpinner:
id: player_subtype_human
value_refs: []
on_select: if root.mode==PLAYER_HUMAN: root.update_global_player_info()
MDBoxLayout:
orientation: 'vertical'
spacing: CP_SPACING
size_hint_x: 1 if root.mode == PLAYER_AI else 0.0001
opacity: 1 if root.mode == PLAYER_AI else 0
Label:
text: i18n._("aistrategy")
font_size: self.height * 0.5
BoxLayout:
I18NSpinner:
id: player_subtype_ai
value_refs: []
on_select: if root.mode==PLAYER_AI: root.update_global_player_info()
<PlayerSetupBlock>:
orientation: 'vertical'