Skip to content

Commit

Permalink
Change tint of the board when in territory estimate mode and style is…
Browse files Browse the repository at this point in the history
… "blended".
  • Loading branch information
rzcp66 committed Oct 12, 2022
1 parent efb6512 commit d5b46c8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
7 changes: 7 additions & 0 deletions katrain/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def __init__(self, **kwargs):
self.last_key_down = None
self.last_focus_event = 0

self.territory_estimate = self.analysis_controls.ownership.active

def log(self, message, level=OUTPUT_INFO):
super().log(message, level)
if level == OUTPUT_KATAGO_STDERR and "ERROR" not in self.controls.status.text:
Expand Down Expand Up @@ -240,6 +242,11 @@ def _do_update_state(
self, redraw_board=False
): # is called after every message and on receiving analyses and config changes
# AI and Trainer/auto-undo handlers
ownership = self.analysis_controls.ownership.active
if self.territory_estimate != ownership:
self.territory_estimate = ownership
redraw_board = True

if not self.game or not self.game.current_node:
return
cn = self.game.current_node
Expand Down
6 changes: 5 additions & 1 deletion katrain/gui/badukpan.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,11 @@ def draw_board_background(
if katrain.game.insert_mode:
Color(*Theme.INSERT_BOARD_COLOR_TINT) # dreamy
else:
Color(*Theme.BOARD_COLOR_TINT) # image is a bit too light
ownership = MDApp.get_running_app().gui.analysis_controls.ownership.active
if Theme.TERRITORY_DISPLAY == "blended" and ownership:
Color(*Theme.TERRITORY_COLOR_TINT) # image is a bit too light
else:
Color(*Theme.BOARD_COLOR_TINT) # image is a bit too light
Rectangle(
pos=(
gridpos_x[0] - self.grid_size * grid_spaces_margin_x[0],
Expand Down
1 change: 1 addition & 0 deletions katrain/gui/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ class Theme:
STONE_MIN_ALPHA = 0.7 # the minimal alpha for dead/weak stones

TERRITORY_DISPLAY = "blended" # other possibilities are "marks" and "blocks"
TERRITORY_COLOR_TINT = [1*0.9, 0.95*0.9, 0.8*0.9, 1] # multiplied by texture
BLOCKS_THRESHOLD = 0.3 # in "blocks" mode, territory which is this likely to be
# a certain player's gets his color
STONE_MARKS = "all" # all: always display marks on stones
Expand Down

0 comments on commit d5b46c8

Please sign in to comment.