CORE: separate Kivy from core services
This commit is contained in:
1 parent
e1bd8a1cff
commit
9b5881412c
19 files changed
+263
-132
No files matched your search
@@ -18,7 +18,6 @@ from katrain.core.constants import (
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.core.sgf_parser import Move, SGFNode
|
||||
from katrain.core.utils import evaluation_class, pack_floats, unpack_floats, var_to_grid
|
||||
from katrain.gui.theme import Theme
|
||||
|
||||
|
||||
def analysis_dumps(analysis):
|
||||
@@ -318,13 +317,11 @@ class GameNode(SGFNode):
|
||||
return ix + 1, p, policy_ranking
|
||||
return None, 0.0, []
|
||||
|
||||
def make_pv(self, player, pv, interactive):
|
||||
def make_pv(self, player, pv, interactive=False):
|
||||
pvtext = f"{player}{' '.join(pv)}"
|
||||
if interactive:
|
||||
pvtext = f"[u][ref={pvtext}][color={Theme.INFO_PV_COLOR}]{pvtext}[/color][/ref][/u]"
|
||||
return pvtext
|
||||
|
||||
def comment(self, sgf=False, teach=False, details=False, interactive=True):
|
||||
def comment(self, sgf=False, teach=False, details=False, interactive=True, pv_formatter=None):
|
||||
single_move = self.move
|
||||
if not self.parent or not single_move: # root
|
||||
if self.root:
|
||||
@@ -359,7 +356,9 @@ class GameNode(SGFNode):
|
||||
else:
|
||||
text += i18n._("Info:best move") + "\n"
|
||||
if previous_top_move.get("pv") and (sgf or details):
|
||||
pv = self.make_pv(single_move.player, previous_top_move["pv"], interactive)
|
||||
pv = self.make_pv(single_move.player, previous_top_move["pv"])
|
||||
if interactive and pv_formatter:
|
||||
pv = pv_formatter(pv)
|
||||
text += i18n._("Info:PV").format(pv=pv) + "\n"
|
||||
if sgf or details or teach:
|
||||
currmove_pol_rank, currmove_pol_prob, policy_ranking = self.move_policy_stats()
|
||||
|
||||
Reference in new issue
Block a user