mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Show current page number in goto printed page
This commit is contained in:
parent
65a640bee2
commit
1c26a6ce17
@ -197,11 +197,11 @@ def pagelist_anchor_map(page_list):
|
|||||||
ans = defaultdict(list)
|
ans = defaultdict(list)
|
||||||
seen_map = defaultdict(set)
|
seen_map = defaultdict(set)
|
||||||
for i, x in enumerate(page_list):
|
for i, x in enumerate(page_list):
|
||||||
x['id'] = i
|
x['id'] = i + 1
|
||||||
name = x['dest']
|
name = x['dest']
|
||||||
frag = x['frag']
|
frag = x['frag']
|
||||||
if name and frag not in seen_map[name]:
|
if name and frag not in seen_map[name]:
|
||||||
ans[name].append({'id': i, 'pagenum': x['pagenum'], 'frag':frag})
|
ans[name].append({'id': x['id'], 'pagenum': x['pagenum'], 'frag':frag})
|
||||||
seen_map[name].add(frag)
|
seen_map[name].add(frag)
|
||||||
return dict(ans)
|
return dict(ans)
|
||||||
|
|
||||||
|
@ -63,6 +63,15 @@ def create_goto_panel(current_position_data, book, container, onclick):
|
|||||||
|
|
||||||
|
|
||||||
def create_page_list_overlay(book, overlay, container):
|
def create_page_list_overlay(book, overlay, container):
|
||||||
|
list_container = E.div()
|
||||||
|
pl = overlay.view.current_pagelist_items
|
||||||
|
if pl and pl.length > 0:
|
||||||
|
if pl.length is 1:
|
||||||
|
text = _('Currently on page: {}').format(pl[0].pagenum)
|
||||||
|
else:
|
||||||
|
text = _('Currently on pages: {}').format(pl[0].pagenum + ' - ' + pl[1].pagenum)
|
||||||
|
container.appendChild(E.div(style='margin: 1em', text))
|
||||||
|
container.appendChild(list_container)
|
||||||
page_list = book.manifest.page_list or v'[]'
|
page_list = book.manifest.page_list or v'[]'
|
||||||
items = v'[]'
|
items = v'[]'
|
||||||
|
|
||||||
@ -73,7 +82,7 @@ def create_page_list_overlay(book, overlay, container):
|
|||||||
for x in page_list:
|
for x in page_list:
|
||||||
items.push(create_item(x.pagenum, action=goto.bind(None, x),
|
items.push(create_item(x.pagenum, action=goto.bind(None, x),
|
||||||
))
|
))
|
||||||
build_list(container, items)
|
build_list(list_container, items)
|
||||||
|
|
||||||
|
|
||||||
def create_location_overlay(current_position_data, book, overlay, container):
|
def create_location_overlay(current_position_data, book, overlay, container):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user