diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py index 8fa615a..12373e9 100644 --- a/katrain/gui/badukpan.py +++ b/katrain/gui/badukpan.py @@ -164,8 +164,9 @@ class BadukPanWidget(Widget): def eval_color(self, points_lost, show_dots_for_class: List[bool] = None) -> Optional[List[float]]: i = evaluation_class(points_lost, self.trainer_config["eval_thresholds"]) + colors = EVAL_COLORS[self.trainer_config["theme"]] if show_dots_for_class is None or show_dots_for_class[i]: - return EVAL_COLORS[i] + return colors[i] def draw_board(self, *_args): if not (self.katrain and self.katrain.game): diff --git a/katrain/gui/popups.py b/katrain/gui/popups.py index ce94bef..f12ebc8 100644 --- a/katrain/gui/popups.py +++ b/katrain/gui/popups.py @@ -19,13 +19,13 @@ from katrain.core.ai import ai_rank_estimation from katrain.core.constants import ( AI_CONFIG_DEFAULT, AI_DEFAULT, + AI_KEY_PROPERTIES, AI_OPTION_VALUES, AI_STRATEGIES_RECOMMENDED_ORDER, OUTPUT_DEBUG, OUTPUT_ERROR, OUTPUT_INFO, STATUS_INFO, - AI_KEY_PROPERTIES, ) from katrain.core.engine import KataGoEngine from katrain.core.lang import i18n, rank_label @@ -269,13 +269,16 @@ class ConfigTeacherPopup(QuickConfigGui): self.options_grid.add_widget(wrap_anchor(widget)) def build_and_set_properties(self, *_args): + theme = self.katrain.config("trainer/theme", "theme:normal") undos = self.katrain.config("trainer/num_undo_prompts") thresholds = self.katrain.config("trainer/eval_thresholds") savesgfs = self.katrain.config("trainer/save_feedback") show_dots = self.katrain.config("trainer/show_dots") + self.themes_spinner.value_refs = list(EVAL_COLORS.keys()) + self.options_grid.clear_widgets() for i, (color, threshold, undo, show_dot, savesgf) in enumerate( - zip(EVAL_COLORS, thresholds, undos, show_dots, savesgfs) + zip(EVAL_COLORS[theme], thresholds, undos, show_dots, savesgfs) ): self.add_option_widgets( [ @@ -288,6 +291,10 @@ class ConfigTeacherPopup(QuickConfigGui): ) super().build_and_set_properties() + def update_config(self, save_to_file=True): + super().update_config(save_to_file=save_to_file) + self.build_and_set_properties() + class DescriptionLabel(Label): pass diff --git a/katrain/gui/style.py b/katrain/gui/style.py index dc4d1e7..dda7081 100644 --- a/katrain/gui/style.py +++ b/katrain/gui/style.py @@ -26,14 +26,26 @@ WINRATE_COLOR = GREEN POINTLOSS_COLOR = YELLOW # eval dots -EVAL_COLORS = [ - [0.447, 0.129, 0.42, 1], - [0.8, 0, 0, 1], - [0.9, 0.4, 0.1, 1], - [0.85, 0.89, 0.3, 1], - [0.67, 0.9, 0.18, 1], - [0.117, 0.588, 0, 1], -] +EVAL_COLORS = { + "theme:normal": [ + [0.447, 0.129, 0.42, 1], + [0.8, 0, 0, 1], + [0.9, 0.4, 0.1, 1], + [0.85, 0.89, 0.3, 1], + [0.67, 0.9, 0.18, 1], + [0.117, 0.588, 0, 1], + ], + "theme:red-green-colourblind": [ + [1, 0, 1, 1], + [1, 0, 0, 1], + [1, 0.5, 0, 1], + [0.85, 0.89, 0.3, 1], + [0, 1, 1, 1], + [0, 0, 1, 1], + ], +} + + EVAL_DOT_MAX_SIZE = 0.5 EVAL_DOT_MIN_SIZE = 0.25 @@ -55,9 +67,9 @@ TOP_MOVE_BORDER_COLOR = [46 / 255, 65 / 255, 88 / 255, 0.9] CHILD_SCALE = 0.95 # ponder light -ENGINE_DOWN_COL = EVAL_COLORS[1] -ENGINE_BUSY_COL = EVAL_COLORS[2] -ENGINE_READY_COL = EVAL_COLORS[-1] +ENGINE_DOWN_COL = EVAL_COLORS["theme:normal"][1] +ENGINE_BUSY_COL = EVAL_COLORS["theme:normal"][2] +ENGINE_READY_COL = EVAL_COLORS["theme:normal"][-1] # info INFO_PV_COLOR = to_hexcol(YELLOW) diff --git a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo index 9037ff3..b28516e 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 b4449d6..167dd66 100644 --- a/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/cn/LC_MESSAGES/katrain.po @@ -595,3 +595,15 @@ msgstr "每步棋计算深度" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/de/LC_MESSAGES/katrain.mo index b72b06c..bfa2353 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 207c54b..0d86476 100644 --- a/katrain/i18n/locales/de/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/de/LC_MESSAGES/katrain.po @@ -639,3 +639,15 @@ msgstr "Anzahl der Visits pro Zug" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/en/LC_MESSAGES/katrain.mo index a95adc8..b68c690 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 0179545..128113e 100644 --- a/katrain/i18n/locales/en/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/en/LC_MESSAGES/katrain.po @@ -643,3 +643,15 @@ msgstr "Number of visits per move" #. on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. theme label +msgid "theme" +msgstr "Colour Theme" + +#. theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" diff --git a/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/es/LC_MESSAGES/katrain.mo index 5a3d86d..df67053 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 e9196c2..f2c5e75 100644 --- a/katrain/i18n/locales/es/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/es/LC_MESSAGES/katrain.po @@ -635,3 +635,15 @@ msgstr "Número de visitas por jugada" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo index 06ccae0..f8bba30 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 944a639..8e9f2e0 100644 --- a/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/fr/LC_MESSAGES/katrain.po @@ -676,3 +676,15 @@ msgstr "" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.mo index 4fa6c21..9d4f359 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 1c2ed38..0fb402a 100644 --- a/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/jp/LC_MESSAGES/katrain.po @@ -622,3 +622,15 @@ msgstr "着手毎の読み手数" #. TODO - on move tree editing msgid "Delete Node" msgstr "この手以降を削除" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.mo index 687d3a2..97259a5 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 77075a4..d92acb2 100644 --- a/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ko/LC_MESSAGES/katrain.po @@ -611,3 +611,15 @@ msgstr "한 수당 visit 수" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.mo index 35d5628..494997e 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 3015cef..b462f10 100644 --- a/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po +++ b/katrain/i18n/locales/ru/LC_MESSAGES/katrain.po @@ -636,3 +636,15 @@ msgstr "Количество посещений на ход" #. TODO - on move tree editing msgid "Delete Node" msgstr "Delete Node" + +#. TODO - theme name +msgid "theme:red-green-colourblind" +msgstr "Red-Green Colourblind" + +#. TODO - theme name +msgid "theme:normal" +msgstr "Default Theme" + +#. TODO - theme label +msgid "theme" +msgstr "Colour Theme" diff --git a/katrain/popups.kv b/katrain/popups.kv index f3205b3..da94c31 100644 --- a/katrain/popups.kv +++ b/katrain/popups.kv @@ -213,6 +213,7 @@ options_grid: options_grid + themes_spinner: themes_spinner GridLayout: cols: 5 rows: 7 @@ -229,22 +230,29 @@ DescriptionLabel: text: i18n._("save dots") AnchorLayout: - size_hint: 1, 2 + size_hint: 1, 3 GridLayout: cols: 2 - rows: 3 + rows: 4 padding: 4 - size_hint: 0.66, 1 + size_hint: 0.8, 1 + DescriptionLabel: + font_size: DESC_FONT_SIZE * 0.8 + text: i18n._("theme") + AnchorLayout: + LabelledSpinner: + size_hint: 0.8,0.8 + input_property: 'trainer/theme' + font_size: DESC_FONT_SIZE * 0.8 + id: themes_spinner DescriptionLabel: font_size: DESC_FONT_SIZE * 0.8 text: i18n._("show last n dots") - size_hint: 2,1 AnchorLayout: LabelledIntInput: - size_hint_x: 0.33 + size_hint_x: 0.15 input_property: "trainer/eval_off_show_last" DescriptionLabel: - size_hint: 2,1 font_size: DESC_FONT_SIZE * 0.8 text: i18n._("show ai dots") AnchorLayout: