From 325ab4a37f3413f64b6de0c336739dc95615c968 Mon Sep 17 00:00:00 2001 From: Sander Land Date: Sun, 31 May 2020 01:55:55 +0200 Subject: [PATCH] ko translation fixes, stderr fixes --- CONTRIBUTORS | 4 +++- katrain/__main__.py | 3 ++- katrain/core/engine.py | 7 +++++-- katrain/core/game_node.py | 2 +- katrain/i18n/locales/ko/LC_MESSAGES/katrain.po | 5 +++-- spec/KaTrain.spec | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index c693e77..a5a21bb 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -3,10 +3,12 @@ Sander Land Many thanks to these additional authors: Matthew Allred ("Kameone") for design of the v1.1 UI and providing MacOS installation instructions. +"isty2e" for Korean translation. + Additional thanks to: "Dontbtme" for detailed feedback and early testing of v1.0. -"Seventeen" for explanatory youtube videos and help on the Korean translation. +"Seventeen" for explanatory youtube videos. diff --git a/katrain/__main__.py b/katrain/__main__.py index 59d6465..e6a8bf6 100644 --- a/katrain/__main__.py +++ b/katrain/__main__.py @@ -76,7 +76,7 @@ class KaTrainGui(Screen, KaTrainBase): def log(self, message, level=OUTPUT_INFO): super().log(message, level) - if level == OUTPUT_KATAGO_STDERR and "ERROR" not in self.controls.status_label.text: + if level == OUTPUT_KATAGO_STDERR and "ERROR" not in self.controls.status.text: if "starting" in message.lower(): self.controls.set_status(f"KataGo engine starting...") if message.startswith("Tuning"): @@ -189,6 +189,7 @@ class KaTrainGui(Screen, KaTrainBase): traceback.print_exc() def __call__(self, message, *args): + print(self.engine.katago_process, "poll:", self.engine.katago_process.poll()) if self.game: if message.endswith("popup"): # gui code needs to run in main kivy thread. fn = getattr(self, f"_do_{message.replace('-', '_')}") diff --git a/katrain/core/engine.py b/katrain/core/engine.py index 2b83c8d..34c2f2d 100644 --- a/katrain/core/engine.py +++ b/katrain/core/engine.py @@ -64,7 +64,7 @@ class KataGoEngine: self.katrain.log(f"Starting KataGo with {self.command}", OUTPUT_DEBUG) self.katago_process = subprocess.Popen( - self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True + self.command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE ) except (FileNotFoundError, PermissionError, OSError) as e: if not self.config["katago"].strip(): @@ -108,7 +108,10 @@ class KataGoEngine: try: line = self.katago_process.stderr.readline() if line: - self.katrain.log(line.decode().strip(), OUTPUT_KATAGO_STDERR) + try: + self.katrain.log(line.decode().strip(), OUTPUT_KATAGO_STDERR) + except Exception as e: + print("ERROR IN PROCESSING STDERR", e) except: return diff --git a/katrain/core/game_node.py b/katrain/core/game_node.py index edfd1e5..a10b55b 100644 --- a/katrain/core/game_node.py +++ b/katrain/core/game_node.py @@ -158,7 +158,7 @@ class GameNode(SGFNode): if not self.parent or not single_move: # root return "" - text = i18n._("move").format(number=self.depth) + ": {single_move.player} {single_move.gtp()}\n" + text = i18n._("move").format(number=self.depth) + f": {single_move.player} {single_move.gtp()}\n" if self.analysis_ready: score = self.score if sgf: diff --git a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po index f2c00a1..acfbb4f 100644 --- a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po @@ -351,7 +351,7 @@ msgid "engine:katago" msgstr "KataGo 실행 파일 경로" msgid "engine:katago:hint" -msgstr "기본 제공 실행 파일을 사용하려면 비워 두십시오." +msgstr "비워 두면 내장된 실행 파일을 사용합니다." msgid "engine:model" msgstr "KataGo 신경망 파일 경로" @@ -369,7 +369,8 @@ msgid "engine:max_time" msgstr "최대 분석 시간" msgid "engine:wide_root_noise" -msgstr "Wide root noise (더 다양한 수를 고려)" +"Wide root noise\n" +"(더 다양한 수를 고려)" msgid "engine:wide_root_noise:hint" msgstr "" diff --git a/spec/KaTrain.spec b/spec/KaTrain.spec index 7c6a20a..535a287 100644 --- a/spec/KaTrain.spec +++ b/spec/KaTrain.spec @@ -34,7 +34,7 @@ a = Analysis( print("SCRIPTS", len(a.scripts), "BIN", len(a.binaries), "ZIP", len(a.zipfiles), "DATA", len(a.datas)) EXCLUDE_SUFFIX = ["katago"] -EXCLUDE = ["KataGoData", "anim_", "screenshot_", "__pycache__", "locales/haha"] +EXCLUDE = ["KataGoData", "anim_", "screenshot_", "__pycache__"] a.datas = [ (ff, ft, tp) for ff, ft, tp in a.datas