1.9 dev (#411)
* refactor priorities * performance report doodling * shutup pycharm * more doodling * doodle tricol * tweak report, fix bug in insert * reorder colors * another metric * sorting engines, trying to catch exc * restructure engine err * restructure engine err * test stuff * test report * test report * test and readme * test and readme * layout * engine recov * pixelfix and exes * readme * keyboard shortcut override * oops * mistakes only deeper * black and readme * readme * fix #421, scale repor * Add shortcut variables (#420) * Add shortcut variables * Address comments and missed shortcuts * fix shortcuts * rename, design report, fix report * make translators work more * relative mid/opening/endgame bounds * win size dbg * more errros * entry * jeff mode * fix * readme * edit THEMES.md * edit katrain/core/ai.py, edit katrain/gui/kivyutils.py * jp (#423) * edit THEMES.md * edit katrain/__main__.py, edit katrain/gui/kivyutils.py and 1 other changes * Update katrain.po (#425) 1.9 first French .po * edit katrain/i18n/locales/fr/LC_MESSAGES/katrain.mo * edit katrain/core/ai.py, edit katrain/gui/popups.py * bluedabadee * fix sgf and black * edit katrain/i18n/locales/fr/LC_MESSAGES/katrain.po * ko * Update zh-TW translation (#426) * cn * cn * Some corrections to Chinese translations (#427) * some corrections in cn and tw * better trans * edit CONTRIBUTIONS.md, edit katrain/i18n/locales/cn/LC_MESSAGES/katrain.mo and 1 other changes * de * tw * player what only * add green background to better value (#428) * edit katrain/gui/popups.py, edit katrain/gui/theme.py * Russian for 1.9 (#432) * edit katrain/i18n/locales/ru/LC_MESSAGES/katrain.po, edit katrain/gui.kv and 1 other changes * sound fix * sound fix * fmt * fix sound * edit THEMES.md, edit CONTRIBUTIONS.md and 1 other changes * sound fix * Do not use ffpyplayer on Windows (#434) * edit katrain/gui/sound.py * no pr * jeff theme * stopsound * sound and theme fix * font fix and more errs * French po corrections (#441) Former translations were misleading. It should be accurate now. * add mouse scroll to browser through node variations. (#442) * add mouse scroll to browser through node variations. * add mouse scroll to browser through node variations. * add mouse scroll to browser through node variations. * edit katrain/popups.kv, edit katrain/__main__.py and 2 other changes * windows binary, black * linux binary * edit INSTALL.md * edit .github/workflows/osxbuild.yaml * edit .github/workflows/osxbuild.yaml * edit .github/workflows/osxbuild.yaml Co-authored-by: Sander Land <sander.land@cognite.com> Co-authored-by: roux g. buciu <11182210+electricRGB@users.noreply.github.com> Co-authored-by: kaorahi <38910552+kaorahi@users.noreply.github.com> Co-authored-by: Dontbtme <66470440+Dontbtme@users.noreply.github.com> Co-authored-by: Liou, Guan-Cheng <Tony-Liou@users.noreply.github.com> Co-authored-by: Ching-yu Lin <60384727+chingyulin@users.noreply.github.com> Co-authored-by: xiaoyifang <105986+xiaoyifang@users.noreply.github.com> Co-authored-by: Alexander Kiselev <satoshi.yoda.register.264@gmail.com> Co-authored-by: Sander Land <Sander@bioeng219-lap.isd.kcl.ac.uk> Co-authored-by: Carton He <cartonhe@gmail.com> Co-authored-by: Sander Land <sander.land@aroni.fritz.box> Co-authored-by: Sander Land <sander.land@futurefacts.nl>
This commit is contained in:
50 files changed
+1657
-284
No files matched your search
+32
-12
@@ -4,7 +4,6 @@ import time
|
||||
from typing import List, Optional
|
||||
|
||||
from kivy.clock import Clock
|
||||
from kivy.core.audio import SoundLoader
|
||||
from kivy.core.window import Window
|
||||
from kivy.graphics.context_instructions import Color
|
||||
from kivy.graphics.vertex_instructions import Ellipse, Line, Rectangle
|
||||
@@ -15,6 +14,7 @@ from kivy.uix.widget import Widget
|
||||
from kivymd.app import MDApp
|
||||
from kivymd.uix.boxlayout import MDBoxLayout
|
||||
from kivymd.uix.floatlayout import MDFloatLayout
|
||||
from katrain.gui.sound import play_sound
|
||||
|
||||
from katrain.core.constants import (
|
||||
MODE_PLAY,
|
||||
@@ -33,7 +33,7 @@ from katrain.core.game import Move
|
||||
from katrain.core.lang import i18n
|
||||
from katrain.core.utils import evaluation_class, format_visits, var_to_grid, json_truncate_arrays
|
||||
from katrain.gui.kivyutils import draw_circle, draw_text, cached_texture
|
||||
from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup
|
||||
from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup, GameReportPopup
|
||||
from katrain.gui.theme import Theme
|
||||
|
||||
|
||||
@@ -53,6 +53,7 @@ class BadukPanWidget(Widget):
|
||||
|
||||
self.active_pv_moves = []
|
||||
self.animating_pv = None
|
||||
self.animating_pv_index = None
|
||||
self.last_mouse_pos = (0, 0)
|
||||
Window.bind(mouse_pos=self.on_mouse_pos)
|
||||
self.redraw_board_contents_trigger = Clock.create_trigger(self.draw_board_contents, 0.05)
|
||||
@@ -70,12 +71,7 @@ class BadukPanWidget(Widget):
|
||||
return self.draw_coords_enabled
|
||||
|
||||
def play_stone_sound(self, *_args):
|
||||
if self.katrain.config("timer/sound"):
|
||||
if not self.stones_sounds:
|
||||
self.stones_sounds = [SoundLoader.load(file) for file in Theme.STONE_SOUNDS]
|
||||
sound = random.choice(self.stones_sounds)
|
||||
if sound:
|
||||
sound.play()
|
||||
play_sound(random.choice(Theme.STONE_SOUNDS))
|
||||
|
||||
# stone placement functions
|
||||
def _find_closest(self, pos, gridpos):
|
||||
@@ -107,7 +103,8 @@ class BadukPanWidget(Widget):
|
||||
self.redraw_hover_contents_trigger()
|
||||
|
||||
def on_touch_down(self, touch):
|
||||
self.set_animating_pv(None, None) # any click kills PV from label/move
|
||||
if touch.button not in ["scrollup", "scrolldown"]:
|
||||
self.set_animating_pv(None, None) # any click kills PV from label/move
|
||||
if "button" in touch.profile and touch.button != "left":
|
||||
return
|
||||
if self.selecting_region_of_interest:
|
||||
@@ -685,8 +682,7 @@ class BadukPanWidget(Widget):
|
||||
animating_pv = self.animating_pv
|
||||
if animating_pv:
|
||||
pv, node, start_time, _ = animating_pv
|
||||
delay = self.katrain.config("general/anim_pv_time", 0.5)
|
||||
up_to_move = (time.time() - start_time) / delay
|
||||
up_to_move = self.get_animate_pv_index()
|
||||
self.draw_pv(pv, node, up_to_move)
|
||||
|
||||
if getattr(self.katrain.game, "region_of_interest", None):
|
||||
@@ -749,6 +745,7 @@ class BadukPanWidget(Widget):
|
||||
draw_text(pos=board_coords, text=str(i + 1), font_size=self.grid_size * sizefac / 1.45, font_name="Roboto")
|
||||
|
||||
def set_animating_pv(self, pv, node):
|
||||
self.animating_pv_index = None
|
||||
if pv is None:
|
||||
self.animating_pv = None
|
||||
elif node is not None and (
|
||||
@@ -757,17 +754,40 @@ class BadukPanWidget(Widget):
|
||||
self.animating_pv = (pv, node, time.time(), self.last_mouse_pos)
|
||||
self.redraw_hover_contents_trigger()
|
||||
|
||||
def adjust_animate_pv_index(self, delta=1):
|
||||
self.animating_pv_index = max(0, self.get_animate_pv_index() + delta)
|
||||
|
||||
def get_animate_pv_index(self):
|
||||
if self.animating_pv_index is None:
|
||||
if self.animating_pv:
|
||||
pv, node, start_time, _ = self.animating_pv
|
||||
delay = self.katrain.config("general/anim_pv_time", 0.5)
|
||||
return (time.time() - start_time) / delay
|
||||
else:
|
||||
return 0
|
||||
|
||||
return self.animating_pv_index
|
||||
|
||||
def show_pv_from_comments(self, pv_str):
|
||||
self.set_animating_pv(pv_str[1:].split(" "), self.katrain.controls.active_comment_node.parent)
|
||||
|
||||
|
||||
class AnalysisDropDown(DropDown):
|
||||
def open_game_analysis_popup(self, *_args):
|
||||
analysis_popup = I18NPopup(title_key="analysis:game", size=[dp(500), dp(300)], content=ReAnalyzeGamePopup())
|
||||
analysis_popup = I18NPopup(title_key="analysis:game", size=[dp(500), dp(350)], content=ReAnalyzeGamePopup())
|
||||
analysis_popup.content.popup = analysis_popup
|
||||
analysis_popup.content.katrain = MDApp.get_running_app().gui
|
||||
analysis_popup.open()
|
||||
|
||||
def open_report_popup(self, *_args):
|
||||
report_popup = I18NPopup(
|
||||
title_key="analysis:report",
|
||||
size=[dp(750), dp(750)],
|
||||
content=GameReportPopup(katrain=MDApp.get_running_app().gui),
|
||||
)
|
||||
report_popup.content.popup = report_popup
|
||||
report_popup.open()
|
||||
|
||||
|
||||
class AnalysisControls(MDBoxLayout):
|
||||
dropdown = ObjectProperty(None)
|
||||
|
||||
Reference in new issue
Block a user