diff --git a/katrain/core/engine.py b/katrain/core/engine.py index d3c1a9e..3934539 100644 --- a/katrain/core/engine.py +++ b/katrain/core/engine.py @@ -228,13 +228,13 @@ class KataGoEngine: if "id" not in query: query["id"] = f"QUERY:{str(self.query_counter)}" self.queries[query["id"]] = (callback, error_callback, time.time(), next_move) - if self.katago_process: - self.katrain.log(f"Sending query {query['id']}: {json.dumps(query)}", OUTPUT_DEBUG) - try: - self.katago_process.stdin.write((json.dumps(query) + "\n").encode()) - self.katago_process.stdin.flush() - except OSError as e: - self.check_alive(os_error=str(e), exception_if_dead=True) + if self.katago_process: + self.katrain.log(f"Sending query {query['id']}: {json.dumps(query)}", OUTPUT_DEBUG) + try: + self.katago_process.stdin.write((json.dumps(query) + "\n").encode()) + self.katago_process.stdin.flush() + except OSError as e: + self.check_alive(os_error=str(e), exception_if_dead=True) def terminate_query(self, query_id): if query_id is not None: diff --git a/katrain/core/game.py b/katrain/core/game.py index ceab62f..078c7a3 100644 --- a/katrain/core/game.py +++ b/katrain/core/game.py @@ -550,7 +550,6 @@ class Game: if move.is_pass: if self.current_node == cn: self.set_current_node(node) - self.katrain.controls.set_status("", STATUS_INFO, cn) return count += 1 new_node = GameNode(parent=node, move=move) @@ -559,8 +558,6 @@ class Game: cn.add_shortcut(new_node) self.katrain.controls.move_tree.redraw_tree_trigger() - self.katrain.controls.set_status(i18n._("playtoend:status").format(num_moves=count), STATUS_INFO, cn) - def set_analysis(result, _partial): new_node.set_analysis(result) analyze_and_play_policy(new_node) @@ -569,7 +566,7 @@ class Game: new_node, callback=set_analysis, priority=-1000, analyze_fast=True, ) - threading.Thread(target=analyze_and_play_policy, args=(cn,), daemon=True).start() + analyze_and_play_policy(cn) def analyze_undo(self, node): train_config = self.katrain.config("trainer") diff --git a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po index 842ae99..03e3ce5 100644 --- a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po @@ -762,8 +762,3 @@ msgstr "Expand/Collapse" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing game to the end with policy strategy, please wait ... {num_moves} " -"moves played." diff --git a/katrain/i18n/locales/de/LC_MESSAGES/katrain.po b/katrain/i18n/locales/de/LC_MESSAGES/katrain.po index 1f56f40..1b83019 100644 --- a/katrain/i18n/locales/de/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/de/LC_MESSAGES/katrain.po @@ -814,8 +814,3 @@ msgstr "Expand/Collapse" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played." diff --git a/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo index b13f739..b21422b 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 935d239..40971e8 100644 --- a/katrain/i18n/locales/en/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/en/LC_MESSAGES/katrain.po @@ -122,12 +122,6 @@ msgstr "" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played." - #. Keep improving current position analysis when there is nothing else to do msgid "analysis:continuous" msgstr "Toggle continuous analysis" diff --git a/katrain/i18n/locales/es/LC_MESSAGES/katrain.po b/katrain/i18n/locales/es/LC_MESSAGES/katrain.po index c3bc833..c7fdd84 100644 --- a/katrain/i18n/locales/es/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/es/LC_MESSAGES/katrain.po @@ -821,8 +821,3 @@ msgstr "Expand/Collapse" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played." diff --git a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po index e65855d..d0f5097 100644 --- a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po @@ -847,9 +847,3 @@ msgstr "Expand/Collapse" #. TODO - Menu option msgid "analysis:playtoend" msgstr "Fast playout to game end" - -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played." diff --git a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po index b0e571a..bc164b3 100644 --- a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po @@ -804,9 +804,3 @@ msgstr "Expand/Collapse" #. TODO - Menu option msgid "analysis:playtoend" msgstr "Fast playout to game end" - -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moved " -"played.moves played." diff --git a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po index e309685..b96207c 100644 --- a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po @@ -775,8 +775,3 @@ msgstr "Expand/Collapse" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played." diff --git a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po index 4d6d839..41d000d 100644 --- a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po @@ -811,8 +811,3 @@ msgstr "Expand/Collapse" msgid "analysis:playtoend" msgstr "Fast playout to game end" -#. TODO - Status message -msgid "playtoend:status" -msgstr "" -"Playing the game quickly to the end, please wait ... {num_moves} moves " -"played."