diff --git a/CONTRIBUTIONS.md b/CONTRIBUTIONS.md index ea2c6a4..aff3295 100644 --- a/CONTRIBUTIONS.md +++ b/CONTRIBUTIONS.md @@ -43,7 +43,7 @@ For those who have some python experience as well, you can: Many thanks to these additional authors: * Matthew Allred ("Kameone") for design of the v1.1 UI, MacOS installation instructions, and working on promotion and YouTube videos. -* "bale-go" for development and continued work on the 'calibrated rank' AI. +* "bale-go" for development and continued work on the 'calibrated rank' AI and rank estimation algorithm. * "Dontbtme" for detailed feedback and early testing of v1.0+. * "nowoowoo" for a fix to the parser for SGF files with extra line breaks. * "nimets123" for the timer sound effects. diff --git a/katrain/core/engine.py b/katrain/core/engine.py index 8bb58c1..5f82ade 100644 --- a/katrain/core/engine.py +++ b/katrain/core/engine.py @@ -109,6 +109,8 @@ class KataGoEngine: died_msg = i18n._("Engine died unexpectedly").format(error=os_error) self.katrain.log(died_msg, OUTPUT_ERROR) self.katago_process = None + else: + died_msg = i18n._("Engine died unexpectedly").format(error=os_error) raise EngineDiedException(died_msg) return ok @@ -118,8 +120,8 @@ class KataGoEngine: while self.queries and process.poll() is None: time.sleep(0.1) if process: - process.terminate() self.katago_process = None + process.terminate() if self.stderr_thread: self.stderr_thread.join() if self.analysis_thread: @@ -137,7 +139,7 @@ class KataGoEngine: self.katrain.log(line.decode(errors="ignore").strip(), OUTPUT_KATAGO_STDERR) except Exception as e: print("ERROR in processing KataGo stderr:", line, "Exception", e) - else: + elif self.katago_process: self.check_alive(exception_if_dead=True) except Exception as e: self.katrain.log(f"Exception in reading stdout {e}", OUTPUT_DEBUG) @@ -147,7 +149,7 @@ class KataGoEngine: while self.katago_process is not None: try: line = self.katago_process.stdout.readline() - if not line: + if self.katago_process and not line: self.check_alive(exception_if_dead=True) except OSError as e: self.check_alive(os_error=str(e), exception_if_dead=True) diff --git a/katrain/gui/widgets/graph.py b/katrain/gui/widgets/graph.py index 9f9df67..8b79709 100644 --- a/katrain/gui/widgets/graph.py +++ b/katrain/gui/widgets/graph.py @@ -22,7 +22,6 @@ class Graph(Widget): def __init__(self, **kwargs): super().__init__(**kwargs) self._lock = threading.Lock() - self.redraw_on_highlight_change = True self.bind(pos=self.update_graph, size=self.update_graph) self.redraw_trigger = Clock.create_trigger(self.update_graph, 0.1) @@ -40,17 +39,13 @@ class Graph(Widget): def update_value(self, node): with self._lock: - changed = self.redraw_on_highlight_change and self.highlighted_index != node.depth self.highlighted_index = index = node.depth self.nodes.extend([None] * max(0, index - (len(self.nodes) - 1))) - if self.nodes[index] != node: - changed = True self.nodes[index] = node if index > 1 and node.parent: # sometimes there are gaps backfill, bfnode = index - 1, node.parent while bfnode is not None and self.nodes[backfill] != bfnode: self.nodes[backfill] = bfnode - changed = True backfill -= 1 bfnode = bfnode.parent @@ -58,13 +53,11 @@ class Graph(Widget): node is None or not node.children or self.nodes[index + 1] != node.ordered_children[0] ): self.nodes = self.nodes[: index + 1] # on branch switching, don't show history from other branch - changed = True if index == len(self.nodes) - 1: # possibly just switched branch or the line above triggered while node.children: # add children back node = node.ordered_children[0] self.nodes.append(node) - if changed: - self.redraw_trigger() + self.redraw_trigger() class ScoreGraph(Graph): @@ -185,7 +178,6 @@ class RankGraph(Graph): def __init__(self, **kwargs): super().__init__(**kwargs) - self.redraw_on_highlight_change = False self.calculate_trigger = Clock.create_trigger(lambda *args: self.rank_game(), 0.25) self.rank_by_player = {} diff --git a/katrain/popups.kv b/katrain/popups.kv index 389d550..edd924a 100644 --- a/katrain/popups.kv +++ b/katrain/popups.kv @@ -502,6 +502,6 @@ I18NFileBrowser: id: filesel multiselect: False - filters: ["*.sgf"] + filters: ["*.sgf","*.gib"] path: "." size_hint: 1,7