fixes from contrib
This commit is contained in:
1 parent
d13b49deea
commit
906294b91f
3 files changed
+10
-3
No files matched your search
+3
-3
@@ -190,11 +190,11 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
# update engine status dot
|
||||
if not self.engine or not self.engine.katago_process or self.engine.katago_process.poll() is not None:
|
||||
self.board_controls.engine_status_col = Theme.ENGINE_DOWN_COLOR
|
||||
elif len(self.engine.queries) == 0:
|
||||
elif self.engine.is_idle():
|
||||
self.board_controls.engine_status_col = Theme.ENGINE_READY_COLOR
|
||||
else:
|
||||
self.board_controls.engine_status_col = Theme.ENGINE_BUSY_COLOR
|
||||
self.board_controls.queries_remaining = len(self.engine.queries)
|
||||
self.board_controls.queries_remaining = self.engine.queries_remaining()
|
||||
|
||||
# redraw board/stones
|
||||
if redraw_board:
|
||||
@@ -629,7 +629,7 @@ class KaTrainGui(Screen, KaTrainBase):
|
||||
self.controls.note.focus
|
||||
or self.popup_open
|
||||
or keycode != self.last_key_down
|
||||
or time.time() - self.last_focus_event < 0.2 # this is here to prevent alt-tab from firing alt or tab
|
||||
or time.time() - self.last_focus_event < 0.2 # this is here to prevent alt-tab from firing alt or tab
|
||||
):
|
||||
return
|
||||
if keycode[1] == "alt":
|
||||
|
||||
@@ -159,6 +159,9 @@ class KataGoEngine:
|
||||
def is_idle(self):
|
||||
return not self.queries and self.write_queue.empty()
|
||||
|
||||
def queries_remaining(self):
|
||||
return len(self.queries) + int(not self.write_queue.empty())
|
||||
|
||||
def _read_stderr_thread(self):
|
||||
while self.katago_process is not None:
|
||||
try:
|
||||
|
||||
@@ -57,10 +57,14 @@ def find_package_resource(path, silent_errors=False):
|
||||
|
||||
|
||||
def pack_floats(float_list):
|
||||
if float_list is None:
|
||||
return b""
|
||||
return struct.pack(f"{len(float_list)}e", *float_list)
|
||||
|
||||
|
||||
def unpack_floats(str, num):
|
||||
if not str:
|
||||
return None
|
||||
return struct.unpack(f"{num}e", str)
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user