forgot2committhepixels
This commit is contained in:
1 parent
48e216fc16
commit
44d927abda
7 files changed
+45
-48
No files matched your search
+28
-26
@@ -32,6 +32,8 @@
|
||||
#:set CP_PADDING dp(6)
|
||||
#:set NOTES_FONT_SIZE dp(18)
|
||||
|
||||
#:set EPSILON 1e-9
|
||||
|
||||
# for sizing help
|
||||
#<Label>:
|
||||
# canvas.before:
|
||||
@@ -391,28 +393,30 @@
|
||||
|
||||
|
||||
<StatsLabel>:
|
||||
value : value
|
||||
orientation: 'horizontal'
|
||||
size_hint_y: EPSILON if root.hidden else 1
|
||||
opacity: 0 if root.hidden else 1
|
||||
Label:
|
||||
size_hint: 0.6,1
|
||||
id: desc
|
||||
text: root.label if not root.hidden else ''
|
||||
font_size: self.height * 0.7
|
||||
font_name: root.font_name
|
||||
text_size: self.size
|
||||
valign: 'middle'
|
||||
halign: 'center'
|
||||
text: root.label
|
||||
multiline: False
|
||||
Label:
|
||||
size_hint: 0.4,1
|
||||
text: root.text if not root.hidden else ''
|
||||
color: root.color
|
||||
font_size: desc.font_size
|
||||
font_name: root.font_name
|
||||
text_size: self.size
|
||||
valign: 'middle'
|
||||
halign: 'center'
|
||||
id: value
|
||||
bold: True
|
||||
text: root.text
|
||||
multiline: False
|
||||
|
||||
<StatsBox>
|
||||
orientation: 'vertical'
|
||||
@@ -494,11 +498,12 @@
|
||||
move_tree: move_tree
|
||||
padding: CP_PADDING
|
||||
spacing: CP_SPACING
|
||||
player_box_height: max(50, 0.075 * root.height)
|
||||
timer_box_height: max(50, 0.1 * root.height)
|
||||
graph_height: max(75, 0.2 * root.height - 25)
|
||||
stats_box_height: max(50, 0.15 * root.height)
|
||||
tab_option_height: max(15,root.height / 30)
|
||||
available_height: root.height - (3 * self.tab_option_height + 2*CP_PADDING - 4*CP_SPACING) # minus tabs fixed, spacing etc
|
||||
player_box_height: max(50, 0.075 * root.available_height)
|
||||
timer_box_height: max(50, 0.1 * root.available_height)
|
||||
graph_height: max(75, 0.2 * root.height)
|
||||
stat_height: max(20, 0.04 * root.height)
|
||||
BoxLayout: # -- Players
|
||||
size_hint_y: None
|
||||
height: root.player_box_height
|
||||
@@ -512,14 +517,8 @@
|
||||
id: timer_or_movetree
|
||||
size_hint_y: None
|
||||
height: root.timer_box_height
|
||||
canvas.before:
|
||||
Color:
|
||||
rgba: RED
|
||||
Line:
|
||||
rectangle: (*self.pos,*self.size)
|
||||
width: 1
|
||||
BoxLayout:
|
||||
size_hint_x: 0.0001 if self.parent.mode != MODE_PLAY else 1
|
||||
size_hint_x: EPSILON if self.parent.mode != MODE_PLAY else 1
|
||||
opacity: 0 if self.parent.mode != MODE_PLAY else 1
|
||||
spacing: CP_SPACING
|
||||
Timer:
|
||||
@@ -540,16 +539,16 @@
|
||||
on_left_release: root.katrain("undo","smart")
|
||||
MoveTree:
|
||||
id: move_tree
|
||||
size_hint_x: 0.0001 if self.parent.mode == MODE_PLAY else 1
|
||||
size_hint_x: EPSILON if self.parent.mode == MODE_PLAY else 1
|
||||
opacity: 0 if self.parent.mode == MODE_PLAY else 1
|
||||
CollapsablePanel:
|
||||
id: graph_panel
|
||||
height_open: self.header.height + graph.height + rank_graph.height
|
||||
content_height: graph.height + rank_graph.height
|
||||
options_height: root.tab_option_height
|
||||
closed_label: 'closedlabel:scoregraph'
|
||||
options: ['score','winrate','rank_est']
|
||||
option_colors: [SCORE_COLOR,WINRATE_COLOR,POINTLOSS_COLOR]
|
||||
option_active: [True,False,False]
|
||||
options_height: root.tab_option_height
|
||||
on_option_state:
|
||||
graph.show_graphs(args[1])
|
||||
graph.hidden = not (args[1]['score'] or args[1]['winrate'])
|
||||
@@ -559,21 +558,24 @@
|
||||
id: graph
|
||||
opacity: 0 if self.hidden else 1
|
||||
size_hint_y: None
|
||||
height: 0.0001 if self.hidden else root.graph_height
|
||||
height: EPSILON if self.hidden else root.graph_height
|
||||
RankGraph:
|
||||
id: rank_graph
|
||||
opacity: 0 if self.hidden else 1
|
||||
size_hint_y: None
|
||||
height: 0.0001 if self.hidden else root.graph_height
|
||||
height: EPSILON if self.hidden else root.graph_height
|
||||
CollapsablePanel:
|
||||
id: stats_panel
|
||||
height_open: root.stats_box_height
|
||||
num_active: 3
|
||||
content_height: self.num_active * root.stat_height
|
||||
options_height: root.tab_option_height
|
||||
closed_label: 'closedlabel:movestats'
|
||||
options: ['score','winrate','points']
|
||||
option_colors: [SCORE_COLOR,WINRATE_COLOR,POINTLOSS_COLOR]
|
||||
option_active: [True,True,True]
|
||||
options_height: root.tab_option_height
|
||||
on_option_state: for k, v in args[1].items(): stats.labels[k].hidden = not v
|
||||
on_option_state:
|
||||
for k, v in args[1].items(): stats.labels[k].hidden = not v
|
||||
self.num_active = sum(args[1].values(),0)
|
||||
StatsBox:
|
||||
id: stats
|
||||
CollapsablePanel:
|
||||
@@ -628,7 +630,7 @@
|
||||
Line:
|
||||
points: self.x, self.y+self.height, self.x+self.width, self.y+self.height
|
||||
width: 1
|
||||
Label:
|
||||
Label: # TODO: ??
|
||||
size_hint_y: 1e-9 # takes up remaining space if info is closed
|
||||
|
||||
|
||||
@@ -851,7 +853,7 @@
|
||||
MDBoxLayout:
|
||||
orientation: 'vertical'
|
||||
spacing: CP_SPACING
|
||||
size_hint_x: 1 if root.mode != PLAYER_AI else 0.0001
|
||||
size_hint_x: 1 if root.mode != PLAYER_AI else EPSILON
|
||||
opacity:1 if root.mode != PLAYER_AI else 0
|
||||
Label:
|
||||
text: i18n._("gametype")
|
||||
@@ -864,7 +866,7 @@
|
||||
MDBoxLayout:
|
||||
orientation: 'vertical'
|
||||
spacing: CP_SPACING
|
||||
size_hint_x: 1 if root.mode == PLAYER_AI else 0.0001
|
||||
size_hint_x: 1 if root.mode == PLAYER_AI else EPSILON
|
||||
opacity: 1 if root.mode == PLAYER_AI else 0
|
||||
Label:
|
||||
text: i18n._("aistrategy")
|
||||
|
||||
@@ -8,7 +8,7 @@ from kivy.core.window import Window
|
||||
from kivy.graphics.context_instructions import Color
|
||||
from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle
|
||||
from kivy.metrics import dp
|
||||
from kivy.properties import ListProperty, ObjectProperty, BooleanProperty
|
||||
from kivy.properties import BooleanProperty, ListProperty, ObjectProperty
|
||||
from kivy.uix.dropdown import DropDown
|
||||
from kivy.uix.widget import Widget
|
||||
from kivymd.app import MDApp
|
||||
@@ -19,7 +19,7 @@ from katrain.core.constants import MODE_PLAY, OUTPUT_DEBUG
|
||||
from katrain.core.game import Move
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.core.utils import evaluation_class, var_to_grid
|
||||
from katrain.gui.kivyutils import draw_circle, draw_text, BackgroundMixin
|
||||
from katrain.gui.kivyutils import BackgroundMixin, draw_circle, draw_text
|
||||
from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup
|
||||
from katrain.gui.style import *
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import time
|
||||
|
||||
from kivy.clock import Clock
|
||||
from kivy.core.audio import SoundLoader
|
||||
from kivy.properties import ObjectProperty, OptionProperty
|
||||
from kivy.properties import ObjectProperty, OptionProperty, NumericProperty
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivymd.uix.floatlayout import MDFloatLayout
|
||||
|
||||
@@ -82,10 +82,10 @@ class ControlsPanel(BoxLayout):
|
||||
|
||||
def set_status(self, msg, status_type, at_node=None):
|
||||
at_node = at_node or self.katrain and self.katrain.game and self.katrain.game.current_node
|
||||
if at_node != self.status_state[2] or int(status_type) >= int(self.status_state[1]) or msg=="":
|
||||
if at_node != self.status_state[2] or int(status_type) >= int(self.status_state[1]) or msg == "":
|
||||
self.status_state = (msg, status_type, at_node)
|
||||
self.status.text = msg
|
||||
self.status.error = status_type==STATUS_ERROR
|
||||
self.status.error = status_type == STATUS_ERROR
|
||||
Clock.schedule_once(self.update_evaluation, 0)
|
||||
|
||||
# handles showing completed analysis and score graph
|
||||
|
||||
@@ -22,7 +22,7 @@ from kivymd.uix.boxlayout import MDBoxLayout
|
||||
from kivymd.uix.button import BaseFlatButton, BasePressedButton
|
||||
from kivymd.uix.navigationdrawer import MDNavigationDrawer
|
||||
|
||||
from katrain.core.constants import AI_STRATEGIES_RECOMMENDED_ORDER, GAME_TYPES, PLAYER_AI, MODE_PLAY
|
||||
from katrain.core.constants import AI_STRATEGIES_RECOMMENDED_ORDER, GAME_TYPES, MODE_PLAY, PLAYER_AI
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.gui.style import DEFAULT_FONT, WHITE
|
||||
|
||||
@@ -358,6 +358,8 @@ class CollapsablePanel(MDBoxLayout):
|
||||
|
||||
options = ListProperty([])
|
||||
options_height = NumericProperty(25)
|
||||
content_height = NumericProperty(100)
|
||||
size_hint_y_open = NumericProperty(None) # total height inc tabs, overrides content_height
|
||||
options_spacing = NumericProperty(6)
|
||||
option_labels = ListProperty([])
|
||||
option_active = ListProperty([])
|
||||
@@ -367,9 +369,6 @@ class CollapsablePanel(MDBoxLayout):
|
||||
|
||||
closed_label = StringProperty("Closed Panel")
|
||||
|
||||
size_hint_y_open = NumericProperty(1)
|
||||
height_open = NumericProperty(None)
|
||||
|
||||
state = OptionProperty("open", options=["open", "close"])
|
||||
close_icon = "img/Previous-5.png"
|
||||
open_icon = "img/Next-5.png"
|
||||
@@ -386,7 +385,7 @@ class CollapsablePanel(MDBoxLayout):
|
||||
option_active=self.build_options,
|
||||
options_spacing=self.build_options,
|
||||
)
|
||||
self.bind(state=self._on_state, size_hint_y_open=self._on_size, height_open=self._on_size)
|
||||
self.bind(state=self._on_state, content_height=self._on_size, options_height=self._on_size)
|
||||
MDApp.get_running_app().bind(language=lambda *_: Clock.schedule_once(self.build_options, 0))
|
||||
self.build_options()
|
||||
|
||||
@@ -397,10 +396,10 @@ class CollapsablePanel(MDBoxLayout):
|
||||
def _on_size(self, *_args):
|
||||
height, size_hint_y = 1, None
|
||||
if self.state == "open" and self.contents:
|
||||
if self.height_open:
|
||||
height = self.height_open
|
||||
else:
|
||||
if self.size_hint_y_open is not None:
|
||||
size_hint_y = self.size_hint_y_open
|
||||
else:
|
||||
height = self.content_height + self.options_height
|
||||
else:
|
||||
height = self.header.height
|
||||
self.height, self.size_hint_y = height, size_hint_y
|
||||
|
||||
@@ -4,8 +4,8 @@ import re
|
||||
from typing import Any, Dict, List, Tuple, Union
|
||||
|
||||
from kivy.clock import Clock
|
||||
from kivy.properties import BooleanProperty, NumericProperty, StringProperty, ListProperty, ObjectProperty
|
||||
from kivy.metrics import dp
|
||||
from kivy.properties import BooleanProperty, ListProperty, NumericProperty, ObjectProperty, StringProperty
|
||||
from kivy.uix.anchorlayout import AnchorLayout
|
||||
from kivy.uix.boxlayout import BoxLayout
|
||||
from kivy.uix.label import Label
|
||||
@@ -19,11 +19,11 @@ from katrain.core.ai import ai_rank_estimation
|
||||
from katrain.core.constants import (
|
||||
AI_CONFIG_DEFAULT,
|
||||
AI_DEFAULT,
|
||||
AI_OPTION_VALUES,
|
||||
AI_STRATEGIES_RECOMMENDED_ORDER,
|
||||
OUTPUT_DEBUG,
|
||||
OUTPUT_ERROR,
|
||||
OUTPUT_INFO,
|
||||
AI_OPTION_VALUES,
|
||||
STATUS_INFO,
|
||||
)
|
||||
from katrain.core.engine import KataGoEngine
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
import math
|
||||
import threading
|
||||
|
||||
from kivy.lang import Builder
|
||||
from kivy.metrics import dp
|
||||
from kivy.properties import BooleanProperty, ListProperty, NumericProperty, Clock, StringProperty
|
||||
from kivy.properties import BooleanProperty, Clock, ListProperty, NumericProperty, StringProperty
|
||||
from kivymd.app import MDApp
|
||||
|
||||
from katrain.core.constants import OUTPUT_ERROR
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.gui.kivyutils import BackgroundMixin
|
||||
import threading
|
||||
|
||||
|
||||
class Graph(BackgroundMixin):
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
from kivy.lang import Builder
|
||||
from kivy.properties import BooleanProperty, ListProperty, NumericProperty
|
||||
from kivy.uix.widget import Widget
|
||||
from kivy.properties import (
|
||||
NumericProperty,
|
||||
ListProperty,
|
||||
BooleanProperty,
|
||||
)
|
||||
from kivymd.uix.label import MDLabel
|
||||
from kivymd.uix.selectioncontrol import Thumb
|
||||
|
||||
|
||||
Reference in new issue
Block a user