black/cache
This commit is contained in:
1 parent
d2c8ea91ad
commit
a51e9c3acc
3 files changed
+10
-11
No files matched your search
+5
-3
@@ -584,14 +584,16 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self(*shortcut)
|
||||
elif keycode[1] == "f9" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
|
||||
import yappi
|
||||
|
||||
yappi.set_clock_type("cpu")
|
||||
yappi.start()
|
||||
self.log("starting profiler",OUTPUT_ERROR)
|
||||
self.log("starting profiler", OUTPUT_ERROR)
|
||||
elif keycode[1] == "f10" and self.debug_level >= OUTPUT_EXTRA_DEBUG:
|
||||
import yappi, time
|
||||
|
||||
stats = yappi.get_func_stats()
|
||||
filename =f"callgrind.{int(time.time())}.prof"
|
||||
stats.save(filename, type='callgrind')
|
||||
filename = f"callgrind.{int(time.time())}.prof"
|
||||
stats.save(filename, type="callgrind")
|
||||
self.log(f"wrote profiling results to {filename}", OUTPUT_ERROR)
|
||||
return True
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ from katrain.gui.popups import I18NPopup, ReAnalyzeGamePopup
|
||||
from katrain.gui.style import *
|
||||
|
||||
|
||||
|
||||
class BadukPanWidget(Widget):
|
||||
def __init__(self, **kwargs):
|
||||
super(BadukPanWidget, self).__init__(**kwargs)
|
||||
@@ -56,9 +55,9 @@ class BadukPanWidget(Widget):
|
||||
self.animating_pv = 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)
|
||||
self.redraw_trigger = Clock.create_trigger(self.redraw,0.05)
|
||||
self.redraw_hover_contents_trigger = Clock.create_trigger(self.draw_hover_contents,0.01)
|
||||
self.redraw_board_contents_trigger = Clock.create_trigger(self.draw_board_contents, 0.05)
|
||||
self.redraw_trigger = Clock.create_trigger(self.redraw, 0.05)
|
||||
self.redraw_hover_contents_trigger = Clock.create_trigger(self.draw_hover_contents, 0.01)
|
||||
self.bind(size=self.redraw_trigger, pos=self.redraw_trigger)
|
||||
Clock.schedule_interval(self.animate_pv, 0.1)
|
||||
|
||||
@@ -551,7 +550,7 @@ class BadukPanWidget(Widget):
|
||||
size=(2 * evalsize, 2 * evalsize),
|
||||
source=cached_resource_find("img/topmove.png"),
|
||||
)
|
||||
if text_on and top_moves_show: # TODO: faster if not sized?
|
||||
if text_on and top_moves_show: # TODO: faster if not sized?
|
||||
keys = {"size": self.grid_size / 3, "smallsize": self.grid_size / 3.33}
|
||||
player_sign = current_node.player_sign(current_node.next_player)
|
||||
if len(top_moves_show) == 1:
|
||||
|
||||
@@ -628,10 +628,8 @@ def draw_circle(pos, r, col):
|
||||
Ellipse(pos=(pos[0] - r, pos[1] - r), size=(2 * r, 2 * r))
|
||||
|
||||
|
||||
def cached_resource_find(path,force_reload=False,_cache={}):
|
||||
return path
|
||||
def cached_resource_find(path, force_reload=False, _cache={}):
|
||||
result = _cache.get(path)
|
||||
if force_reload or not result:
|
||||
result = _cache[path] = resource_find(path)
|
||||
return result
|
||||
|
||||
Reference in new issue
Block a user