fix shift-arrow to alt-arrow, fix bug where old top move not in any new analysis causes two moves with order=1

This commit is contained in:
Sander Land committed 2020-09-12 22:58:21 +02:00
1 parent 78fa8d9305
commit 12bf5368c4
3 files changed
+9 -5

No files matched your search

+2 -2
View File
@@ -177,8 +177,8 @@ In addition to shortcuts mentioned above and those shown in the main menu:
* **[~]** or **[ ` ]** or **[m]**: Cycles through more minimalistic UI modes.
* **[p]**: Pass
* **[b]**: Pause/Resume timer
* **[arrow left]** or **[z]**: Undo move. Hold shift for 10 moves at a time, or ctrl to skip to the start.
* **[arrow right]** or **[x]**: Redo move. Hold shift for 10 moves at a time, or ctrl to skip to the start.
* **[arrow left]** or **[z]**: Undo move. Hold alt for 10 moves at a time, or ctrl to skip to the start.
* **[arrow right]** or **[x]**: Redo move. Hold alt for 10 moves at a time, or ctrl to skip to the start.
* **[arrow up/down]** Switch branch, as would be expected from the move tree.
* **[scroll up]**: Undo move. Only works when hovering the cursor over the board.
* **[scroll down]**: Redo move. Only works when hovering the cursor over the board.
+2 -2
View File
@@ -480,9 +480,9 @@ class KaTrainGui(Screen, KaTrainBase):
elif keycode[1] in ["`", "~", "m"] and "ctrl" not in modifiers:
self.zen = (self.zen + 1) % 3
elif keycode[1] in ["left", "z"]:
self("undo", 1 + ("shift" in modifiers) * 9 + ("ctrl" in modifiers) * 999)
self("undo", 1 + ("alt" in modifiers) * 9 + ("ctrl" in modifiers) * 999)
elif keycode[1] in ["right", "x"]:
self("redo", 1 + ("shift" in modifiers) * 9 + ("ctrl" in modifiers) * 999)
self("redo", 1 + ("alt" in modifiers) * 9 + ("ctrl" in modifiers) * 999)
elif keycode[1] == "n" and "ctrl" in modifiers:
self("new-game-popup")
elif keycode[1] == "l" and "ctrl" in modifiers:
+5 -1
View File
@@ -100,7 +100,7 @@ class GameNode(SGFNode):
elif cur["visits"] < move_analysis["visits"]:
cur.update(move_analysis)
def set_analysis(self, analysis_json, refine_move, alternatives_mode):
def set_analysis(self, analysis_json: Dict, refine_move: Optional[Move], alternatives_mode: bool):
if refine_move:
pvtail = analysis_json["moveInfos"][0]["pv"] if analysis_json["moveInfos"] else []
self.update_move_analysis(
@@ -110,6 +110,10 @@ class GameNode(SGFNode):
if alternatives_mode:
for m in analysis_json["moveInfos"]:
m["order"] += 10 # offset for not making this top
if refine_move is None and not alternatives_mode:
for move_dict in self.analysis["moves"].values():
move_dict["order"] = 999 # old moves to end
print("overwriting blah blah")
for move_analysis in analysis_json["moveInfos"]:
self.update_move_analysis(move_analysis, move_analysis["move"])
self.ownership = analysis_json.get("ownership")