diff --git a/CONTRIBUTIONS.md b/CONTRIBUTIONS.md index ee68c50..5e48e29 100644 --- a/CONTRIBUTIONS.md +++ b/CONTRIBUTIONS.md @@ -49,7 +49,8 @@ Many thanks to these additional authors: * "ajkenny84" for the red-green colourblind theme. * Lukasz Wierzbowski for the ability to paste urls for sgfs and helping fix alt-gr issues. * Carton He for contributions to sgf parsing and handling. -* "blamarche" for adding the board coordinates toggle +* "blamarche" for adding the board coordinates toggle. +* "pdeblanc" for adding the ancient chinese scoring option. ## Translators diff --git a/katrain/core/engine.py b/katrain/core/engine.py index 30d2c96..6db9412 100644 --- a/katrain/core/engine.py +++ b/katrain/core/engine.py @@ -26,7 +26,13 @@ class KataGoEngine: """Starts and communicates with the KataGO analysis engine""" # TODO: we don't support suicide in game.py, so no "tt": "tromp-taylor", "nz": "new-zealand" - RULESETS_ABBR = [("jp", "japanese"), ("cn", "chinese"), ("ko", "korean"), ("aga", "aga")] + RULESETS_ABBR = [ + ("jp", "japanese"), + ("cn", "chinese"), + ("ko", "korean"), + ("aga", "aga"), + ("stone_scoring", "stone_scoring"), + ] RULESETS = {fromkey: name for abbr, name in RULESETS_ABBR for fromkey in [abbr, name]} @staticmethod @@ -103,7 +109,8 @@ class KataGoEngine: ) except (FileNotFoundError, PermissionError, OSError) as e: self.katrain.log( - i18n._("Starting Kata failed").format(command=self.command, error=e), OUTPUT_ERROR, + i18n._("Starting Kata failed").format(command=self.command, error=e), + OUTPUT_ERROR, ) return # don't start self.analysis_thread = threading.Thread(target=self._analysis_read_thread, daemon=True) diff --git a/katrain/core/game.py b/katrain/core/game.py index dc37a24..603d78d 100644 --- a/katrain/core/game.py +++ b/katrain/core/game.py @@ -434,9 +434,7 @@ class Game: base_game_name = f"{PROGRAM_NAME}_{player_names['B']} vs {player_names['W']}" return f"{base_game_name} {self.game_id}.sgf" - def write_sgf( - self, filename: str, trainer_config: Optional[Dict] = None, - ): + def write_sgf(self, filename: str, trainer_config: Optional[Dict] = None): if trainer_config is None: trainer_config = self.katrain.config("trainer", {}) save_feedback = trainer_config.get("save_feedback", False) @@ -583,7 +581,7 @@ class Game: analyze_and_play_policy(new_node) self.engines[node.next_player].request_analysis( - new_node, callback=set_analysis, priority=-1000, analyze_fast=True, + new_node, callback=set_analysis, priority=-1000, analyze_fast=True ) analyze_and_play_policy(cn) diff --git a/katrain/core/game_node.py b/katrain/core/game_node.py index 9d02be6..f82cb10 100644 --- a/katrain/core/game_node.py +++ b/katrain/core/game_node.py @@ -8,10 +8,10 @@ from typing import Dict, List, Optional, Tuple from katrain.core.constants import ( ANALYSIS_FORMAT_VERSION, PROGRAM_NAME, + REPORT_DT, SGF_INTERNAL_COMMENTS_MARKER, SGF_SEPARATOR_MARKER, - VERSION, - REPORT_DT, + VERSION ) from katrain.core.lang import i18n from katrain.core.sgf_parser import Move, SGFNode @@ -319,7 +319,7 @@ class GameNode(SGFNode): text += i18n._("Info:point loss").format(points_lost=points_lost) + "\n" top_move = previous_top_move["move"] score = self.format_score(previous_top_move["scoreLead"]) - text += i18n._("Info:top move").format(top_move=top_move, score=score,) + "\n" + text += i18n._("Info:top move").format(top_move=top_move, score=score) + "\n" else: text += i18n._("Info:best move") + "\n" if previous_top_move.get("pv") and (sgf or details): diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py index 5b37945..1ca6a7b 100644 --- a/katrain/gui/badukpan.py +++ b/katrain/gui/badukpan.py @@ -471,9 +471,7 @@ class BadukPanWidget(Widget): ) if move_policy == best_move_policy: Color(*Theme.TOP_MOVE_BORDER_COLOR[:3], Theme.POLICY_ALPHA) - Line( - circle=(self.gridpos_x[x], self.gridpos_y[y], self.stone_size - dp(1.2),), width=dp(2), - ) + Line(circle=(self.gridpos_x[x], self.gridpos_y[y], self.stone_size - dp(1.2)), width=dp(2)) with pass_btn.canvas.after: move_policy = policy[-1] diff --git a/katrain/gui/kivyutils.py b/katrain/gui/kivyutils.py index 291dc16..ead2374 100644 --- a/katrain/gui/kivyutils.py +++ b/katrain/gui/kivyutils.py @@ -663,9 +663,7 @@ def cached_text_texture(text, font_name, markup, _cache={}, **kwargs): def draw_text(pos, text, font_name=None, markup=False, **kwargs): texture = cached_text_texture(text, font_name, markup, **kwargs) - Rectangle( - texture=texture, pos=(pos[0] - texture.size[0] / 2, pos[1] - texture.size[1] / 2), size=texture.size, - ) + Rectangle(texture=texture, pos=(pos[0] - texture.size[0] / 2, pos[1] - texture.size[1] / 2), size=texture.size) def draw_circle(pos, r, col): diff --git a/katrain/gui/widgets/filebrowser.py b/katrain/gui/widgets/filebrowser.py index b89e5e7..467f4a7 100644 --- a/katrain/gui/widgets/filebrowser.py +++ b/katrain/gui/widgets/filebrowser.py @@ -315,8 +315,7 @@ class LinkTree(TreeView): class I18NFileBrowser(BoxLayout): - """I18NFileBrowser class, see module documentation for more information. - """ + """I18NFileBrowser class, see module documentation for more information.""" __events__ = ("on_success", "on_submit") diff --git a/katrain/gui/widgets/progress_loader.py b/katrain/gui/widgets/progress_loader.py index d2c3aae..c7f4b14 100644 --- a/katrain/gui/widgets/progress_loader.py +++ b/katrain/gui/widgets/progress_loader.py @@ -71,7 +71,7 @@ class ProgressLoader(BoxLayout): Clock.schedule_once(self.animation_show, 1) def animation_show(self, _dt): - animation = Animation(opacity=1, d=0.2, t="out_quad",) + animation = Animation(opacity=1, d=0.2, t="out_quad") animation.start(self) def request_download_file(self, url, path): diff --git a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo index 0fd991b..72b89fe 100644 Binary files a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po index 7efcc10..81bb71a 100644 --- a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po @@ -276,6 +276,10 @@ msgstr "韩国规则" msgid "aga" msgstr "AGA规则" +#. TODO check +msgid "stone_scoring" +msgstr "古代中国规则" + msgid "clear cache" msgstr "清除缓存" diff --git a/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo index 7f49482..3a49e67 100644 Binary files a/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/de/LC_MESSAGES/katrain.po b/katrain/i18n/locales/de/LC_MESSAGES/katrain.po index a5f6760..76d22f4 100644 --- a/katrain/i18n/locales/de/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/de/LC_MESSAGES/katrain.po @@ -283,6 +283,10 @@ msgstr "Koreanisch" msgid "aga" msgstr "AGA" +#. TODO check +msgid "stone_scoring" +msgstr "Alte Chinesisch" + msgid "clear cache" msgstr "Cache leeren" diff --git a/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo index fd345d0..2e29a93 100644 Binary files a/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/en/LC_MESSAGES/katrain.po b/katrain/i18n/locales/en/LC_MESSAGES/katrain.po index a6fccfa..14178a8 100644 --- a/katrain/i18n/locales/en/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/en/LC_MESSAGES/katrain.po @@ -394,6 +394,9 @@ msgstr "Korean" msgid "aga" msgstr "AGA" +msgid "stone_scoring" +msgstr "Ancient Chinese" + msgid "clear cache" msgstr "Clear cache" diff --git a/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo index 5d316cc..b92c936 100644 Binary files a/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/es/LC_MESSAGES/katrain.po b/katrain/i18n/locales/es/LC_MESSAGES/katrain.po index c158402..cb88853 100644 --- a/katrain/i18n/locales/es/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/es/LC_MESSAGES/katrain.po @@ -287,6 +287,10 @@ msgstr "Koreanas" msgid "aga" msgstr "AGA" +#. TODO check +msgid "stone_scoring" +msgstr "Antiguas Chinas" + msgid "clear cache" msgstr "Vaciar Cache" diff --git a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo index 88e84e7..0f0aa32 100644 Binary files a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po index 48e7751..f1d7497 100644 --- a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po @@ -302,6 +302,10 @@ msgstr "Coréennes" msgid "aga" msgstr "AGA" +#. TODO check +msgid "stone_scoring" +msgstr "Chinoises anciennes" + msgid "clear cache" msgstr "Vider le cache" diff --git a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo index fb0bd4a..3511d38 100644 Binary files a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po index 3cfeee1..fcf96b7 100644 --- a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po @@ -308,6 +308,9 @@ msgstr "韓国" msgid "aga" msgstr "AGA" +msgid "stone_scoring" +msgstr "古代中国" + msgid "clear cache" msgstr "思考記録をクリア" diff --git a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo index 57ad9e8..5290e24 100644 Binary files a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po index ee5e3ab..c44af39 100644 --- a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po @@ -280,6 +280,10 @@ msgstr "한국" msgid "aga" msgstr "AGA" +#. TODO check +msgid "stone_scoring" +msgstr "고대 중국" + msgid "clear cache" msgstr "캐시 지우기" diff --git a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo index 1aebf6f..49f48cc 100644 Binary files a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po index 7cae85e..489a683 100644 --- a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po @@ -306,6 +306,10 @@ msgstr "Корейские" msgid "aga" msgstr "AGA" +#. TODO check +msgid "stone_scoring" +msgstr "Древние китайские" + msgid "clear cache" msgstr "Очистить кэш" diff --git a/katrain/i18n/locales/tw/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/tw/LC_MESSAGES/katrain.mo index 8ef53ec..bde68db 100644 Binary files a/katrain/i18n/locales/tw/LC_MESSAGES/katrain.mo and b/katrain/i18n/locales/tw/LC_MESSAGES/katrain.mo differ diff --git a/katrain/i18n/locales/tw/LC_MESSAGES/katrain.po b/katrain/i18n/locales/tw/LC_MESSAGES/katrain.po index 3dd156e..9e8b922 100644 --- a/katrain/i18n/locales/tw/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/tw/LC_MESSAGES/katrain.po @@ -779,3 +779,7 @@ msgstr "插入完畢,複製 {num_copied} 手棋。" #. mode msgid "finish inserting before navigating" msgstr "此功能在插入模式無法使用,按 i 結束插入。" + +#. TODO +msgid "stone_scoring" +msgstr "Ancient Chinese" diff --git a/katrain/popups.kv b/katrain/popups.kv index 21fbc27..8d5e420 100644 --- a/katrain/popups.kv +++ b/katrain/popups.kv @@ -472,7 +472,7 @@ text: i18n._("ruleset") AnchorLayout: LabelledSpinner: - size_hint: 0.8,0.8 + size_hint: 0.95,0.8 input_property: 'game/rules' font_size: sp(Theme.DESC_FONT_SIZE) id: rules_spinner