Skip to content

Commit 70e072d

Browse files
Copilotfsmosca
andcommitted
Split review move list into move list and book moves side-by-side panels
Agent-Logs-Url: https://github.com/fsmosca/Python-Easy-Chess-GUI/sessions/1757ddc9-afe1-4daa-a6d1-499d674d8e9d Co-authored-by: fsmosca <22366935+fsmosca@users.noreply.github.com>
1 parent 26ca728 commit 70e072d

File tree

1 file changed

+26
-9
lines changed

1 file changed

+26
-9
lines changed

python_easy_chess_gui.py

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2895,12 +2895,24 @@ def update_review_window(self, window):
28952895
window['review_header_k'].Update(header_text)
28962896
window['review_nav_k'].Update(
28972897
f'Position {self.review_move_index}/{len(self.review_boards) - 1}')
2898-
window['review_move_list_k'].Update(
2899-
values=self.review_move_labels,
2900-
set_to_index=[self.review_move_index],
2901-
scroll_to_index=self.review_move_index)
2902-
2903-
self.set_board_from_board_state(
2898+
window['review_move_list_k'].Update(
2899+
values=self.review_move_labels,
2900+
set_to_index=[self.review_move_index],
2901+
scroll_to_index=self.review_move_index)
2902+
2903+
# Update book moves for the current position.
2904+
board = self.review_boards[self.review_move_index]
2905+
book_text = ''
2906+
for book_file in [self.computer_book_file, self.human_book_file]:
2907+
if os.path.isfile(book_file):
2908+
ref_book = GuiBook(book_file, board, self.is_random_book)
2909+
all_moves, is_found = ref_book.get_all_moves()
2910+
if is_found:
2911+
book_text = all_moves
2912+
break
2913+
window['review_book_k'].Update(book_text if book_text else 'no book moves')
2914+
2915+
self.set_board_from_board_state(
29042916
window, self.review_boards[self.review_move_index])
29052917
self.update_review_analysis_panel(window)
29062918

@@ -2920,10 +2932,15 @@ def build_review_layout(self, is_user_white=True):
29202932
[sg.Multiline('', do_not_clear=True, autoscroll=False, size=(52, 4),
29212933
font=('Consolas', 10), key='review_header_k',
29222934
disabled=True)],
2923-
[sg.Text('Move list', size=(16, 1), font=('Consolas', 10))],
2924-
[sg.Listbox(values=['Start position'], size=(52, REVIEW_MOVE_LIST_HEIGHT),
2935+
[sg.Text('Move list', size=(26, 1), font=('Consolas', 10)),
2936+
sg.Text('Book moves', size=(24, 1), font=('Consolas', 10))],
2937+
[sg.Listbox(values=['Start position'], size=(26, REVIEW_MOVE_LIST_HEIGHT),
29252938
font=('Consolas', 10), key='review_move_list_k',
2926-
enable_events=True, expand_y=True)],
2939+
enable_events=True, expand_y=True),
2940+
sg.Multiline('', do_not_clear=True, autoscroll=False,
2941+
size=(24, REVIEW_MOVE_LIST_HEIGHT),
2942+
font=('Consolas', 10), key='review_book_k',
2943+
disabled=True, expand_y=True)],
29272944
[sg.Text('Position 0/0', size=(20, 1), font=('Consolas', 10),
29282945
key='review_nav_k', relief='sunken')],
29292946
[sg.Text('Analysis stopped', size=(52, 1), font=('Consolas', 10),

0 commit comments

Comments
 (0)