diff --git a/README.md b/README.md index a18968f3..c88acef1 100644 --- a/README.md +++ b/README.md @@ -183,6 +183,7 @@ In addition to shortcuts mentioned above and those shown in the main menu: * **[~]** or **[ ` ]** or **[F12]**: Cycles through more minimalistic UI modes. * **[k]**: Toggle display of board coordinates. * **[p]**: Pass +* **[m]**: Toggle the move number on the board * **[pause]**: Pause/Resume timer * **[arrow left]** or **[z]**: Undo move. Hold shift for 10 moves at a time, or ctrl to skip to the start. * **[arrow right]** or **[x]**: Redo move. Hold shift for 10 moves at a time, or ctrl to skip to the end. diff --git a/katrain/__main__.py b/katrain/__main__.py index 9cfd21b8..5ad98e28 100644 --- a/katrain/__main__.py +++ b/katrain/__main__.py @@ -124,6 +124,8 @@ def __init__(self, **kwargs): self.contribute_popup = None self.pondering = False + self.show_move_num = False + self.animate_contributing = False self.message_queue = Queue() @@ -173,6 +175,10 @@ def toggle_continuous_analysis(self, quiet=False): self.pondering = not self.pondering self.update_state() + def toggle_move_num(self): + self.show_move_num = not self.show_move_num + self.update_state() + def start(self): if self.engine: return @@ -740,6 +746,8 @@ def _on_keyboard_down(self, _keyboard, keycode, _text, modifiers): if keycode[1] == Theme.KEY_TOGGLE_CONTINUOUS_ANALYSIS: self.toggle_continuous_analysis(quiet=shift_pressed) + elif keycode[1] == Theme.KEY_TOGGLE_MOVENUM: + self.toggle_move_num() elif keycode[1] == Theme.KEY_TOGGLE_COORDINATES: self.board_gui.toggle_coordinates() elif keycode[1] in Theme.KEY_PAUSE_TIMER and not ctrl_pressed: diff --git a/katrain/gui/badukpan.py b/katrain/gui/badukpan.py index ef9730d3..b8833e26 100644 --- a/katrain/gui/badukpan.py +++ b/katrain/gui/badukpan.py @@ -227,7 +227,8 @@ def redraw(self, *_args): self.draw_board_contents() def draw_stone( - self, x, y, player, alpha=1, innercol=None, evalcol=None, evalscale=1.0, scale=1.0, ownership=None, loss=None + self, x, y, player, alpha=1, innercol=None, evalcol=None, evalscale=1.0, scale=1.0, ownership=None, + loss=None, depth=None ): stone_size = self.stone_size * scale if ownership is not None: @@ -297,6 +298,11 @@ def draw_stone( texture=cached_texture(Theme.LAST_MOVE_TEXTURE), ) + if depth: + text = str(depth) + Color(*Theme.NUMBER_COLOR) + draw_text(pos=self.gridpos[y][x], text=text, font_size=self.stone_size * 0.9, font_name="Roboto") + 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 = Theme.EVAL_COLORS[self.trainer_config["theme"]] @@ -663,6 +669,7 @@ def draw_board_contents(self, *_args): if ownership_grid and not loss_grid and not new_move else None, loss=loss_grid[m.coords[1]][m.coords[0]] if loss_grid else None, + depth=node.depth if katrain.show_move_num else None, ) realized_points_lost = node.parent_realized_points_lost diff --git a/katrain/gui/theme.py b/katrain/gui/theme.py index c31c805d..9158d376 100644 --- a/katrain/gui/theme.py +++ b/katrain/gui/theme.py @@ -108,6 +108,8 @@ class Theme: PASS_CIRCLE_TEXT_COLOR = [0.85, 0.85, 0.85] STONE_COLORS = {"B": BLACK, "W": WHITE} + NUMBER_COLOR = [0.85, 0.68, 0.40, 0.8] + NEXT_MOVE_DASH_CONTRAST_COLORS = {"B": LIGHTER_GREY, "W": GREY} OUTLINE_COLORS = {"B": [0.3, 0.3, 0.3, 0.5], "W": [0.7, 0.7, 0.7, 0.5]} PV_TEXT_COLORS = {"W": BLACK, "B": WHITE} # numbers in PV @@ -198,6 +200,7 @@ class Theme: KEY_SELFPLAY_TO_END = "l" KEY_STOP_ANALYSIS = "escape" KEY_TOGGLE_CONTINUOUS_ANALYSIS = "spacebar" + KEY_TOGGLE_MOVENUM = "m" KEY_COPY = "c" KEY_PASTE = "v"