diff --git a/katrain/__main__.py b/katrain/__main__.py index c3d5754..5936343 100644 --- a/katrain/__main__.py +++ b/katrain/__main__.py @@ -2,8 +2,6 @@ # first, logging level lower and force audio framework import os -from katrain.core.contribute_engine import KataGoContributeEngine - os.environ["KCFG_KIVY_LOG_LEVEL"] = os.environ.get("KCFG_KIVY_LOG_LEVEL", "warning") if "KIVY_AUDIO" not in os.environ: os.environ["KIVY_AUDIO"] = "sdl2" # some backends hard crash / this seems to be most stable @@ -70,6 +68,7 @@ from katrain.core.constants import ( from katrain.gui.popups import ConfigTeacherPopup, ConfigTimerPopup, I18NPopup, SaveSGFPopup, ContributePopup from katrain.core.base_katrain import KaTrainBase from katrain.core.engine import KataGoEngine +from katrain.core.contribute_engine import KataGoContributeEngine from katrain.core.game import Game, IllegalMoveException, KaTrainSGF, BaseGame from katrain.core.sgf_parser import Move, ParseError from katrain.gui.popups import ConfigPopup, LoadSGFPopup, NewGamePopup, ConfigAIPopup @@ -279,7 +278,7 @@ class KaTrainGui(Screen, KaTrainBase): "save_game", "find_mistake", ]: - self.log(i18n._("gui-locked").format(action=msg), OUTPUT_ERROR) + self.controls.set_status(i18n._("gui-locked").format(action=msg), STATUS_INFO, check_level=False) continue fn = getattr(self, f"_do_{msg}") fn(*args, **kwargs) @@ -293,7 +292,7 @@ class KaTrainGui(Screen, KaTrainBase): if self.game: if message.endswith("popup"): # gui code needs to run in main kivy thread. if self.contributing and "save" not in message and message != "contribute-popup": - self.log(i18n._("gui-locked").format(action=message), OUTPUT_ERROR) + self.controls.set_status(i18n._("gui-locked").format(action=message), STATUS_INFO, check_level=False) return fn = getattr(self, f"_do_{message.replace('-', '_')}") Clock.schedule_once(lambda _dt: fn(*args, **kwargs), -1) diff --git a/katrain/core/constants.py b/katrain/core/constants.py index fc2b76a..a668648 100644 --- a/katrain/core/constants.py +++ b/katrain/core/constants.py @@ -1,5 +1,5 @@ PROGRAM_NAME = "KaTrain" -VERSION = "1.8.0" +VERSION = "1.8.1" HOMEPAGE = "https://github.com/sanderland/katrain" CONFIG_MIN_VERSION = "1.8.0" # keep config files from this version ANALYSIS_FORMAT_VERSION = "1.0" diff --git a/katrain/core/contribute_engine.py b/katrain/core/contribute_engine.py index c0ff158..a0f8b83 100644 --- a/katrain/core/contribute_engine.py +++ b/katrain/core/contribute_engine.py @@ -8,7 +8,7 @@ import time import traceback from collections import defaultdict -from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_INFO, OUTPUT_KATAGO_STDERR +from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_INFO, OUTPUT_KATAGO_STDERR, DATA_FOLDER from katrain.core.engine import EngineDiedException, BaseEngine from katrain.core.game import BaseGame from katrain.core.lang import i18n @@ -56,6 +56,7 @@ class KataGoContributeEngine(BaseEngine): "maxSimultaneousGames": self.config.get("maxgames") or self.DEFAULT_MAX_GAMES, "includeOwnership": self.config.get("ownership") or False, "logGamesAsJson": True, + "homeDataDir": os.path.expanduser(DATA_FOLDER) } self.max_buffer_games = 2 * settings_dict["maxSimultaneousGames"] settings = {f"{k}={v}" for k, v in settings_dict.items()} diff --git a/katrain/core/engine.py b/katrain/core/engine.py index a194dcd..f38c4d4 100644 --- a/katrain/core/engine.py +++ b/katrain/core/engine.py @@ -13,7 +13,7 @@ from typing import Callable, Dict, List, Optional from kivy.utils import platform as kivy_platform -from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDERR +from katrain.core.constants import OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_EXTRA_DEBUG, OUTPUT_KATAGO_STDERR, DATA_FOLDER from katrain.core.game_node import GameNode from katrain.core.lang import i18n from katrain.core.sgf_parser import Move @@ -119,7 +119,7 @@ class KataGoEngine(BaseEngine): self.katrain.log(i18n._("Kata config not found").format(config=cfg), OUTPUT_ERROR) return # don't start self.command = shlex.split( - f'"{exe}" analysis -model "{model}" -config "{cfg}" -analysis-threads {config["threads"]}' + f'"{exe}" analysis -model "{model}" -config "{cfg}" -analysis-threads {config["threads"]} -override-config "homeDataDir={os.path.expanduser(DATA_FOLDER)}"' ) self.start()