From 306deb01cb39fae243a24ccb0ed5182d2b0ea7ef Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 14 Oct 2020 16:05:21 +0530 Subject: [PATCH] Page counts should not be deleted when opening controls --- src/pyj/read_book/prefs/head_foot.pyj | 5 ++++- src/pyj/read_book/view.pyj | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/pyj/read_book/prefs/head_foot.pyj b/src/pyj/read_book/prefs/head_foot.pyj index 04a390167b..95c4bfaa37 100644 --- a/src/pyj/read_book/prefs/head_foot.pyj +++ b/src/pyj/read_book/prefs/head_foot.pyj @@ -202,7 +202,10 @@ def render_head_foot(div, which, region, metadata, current_toc_node, current_toc else: text = format_pos(pos.file_progress_frac, pos.chapter_length) elif field is 'pages-progress': - text = f'{pos.page_counts.current + 1} / {pos.page_counts.total}' + if pos.page_counts: + text = f'{pos.page_counts.current + 1} / {pos.page_counts.total}' + else: + text = _('Unknown') if not text: text = '\xa0' if text is not div.textContent: diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index c5583ffa20..67ab61ab6c 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -1143,6 +1143,7 @@ class View: 'file_progress_frac': data.file_progress_frac, 'selected_text': data.selected_text, 'selection_bounds': data.selection_bounds, + 'page_counts': data.page_counts }) v'delete self.report_cfi_callbacks[data.request_id]'