mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Rename goto_bookpos -> goto_cfi
This commit is contained in:
parent
eeab136034
commit
73c69949df
@ -78,7 +78,7 @@ ui_operations = {
|
|||||||
'forward_gesture': None,
|
'forward_gesture': None,
|
||||||
'update_color_scheme': None,
|
'update_color_scheme': None,
|
||||||
'update_font_size': None,
|
'update_font_size': None,
|
||||||
'goto_bookpos': None,
|
'goto_cfi': None,
|
||||||
'delete_book': None,
|
'delete_book': None,
|
||||||
'focus_iframe': None,
|
'focus_iframe': None,
|
||||||
'toggle_toc': None,
|
'toggle_toc': None,
|
||||||
|
@ -87,7 +87,7 @@ def create_location_overlay(current_position_data, overlay, container):
|
|||||||
def goto_loc():
|
def goto_loc():
|
||||||
src = document.querySelector(f'#{container_id} [name=newloc]')
|
src = document.querySelector(f'#{container_id} [name=newloc]')
|
||||||
if src.value:
|
if src.value:
|
||||||
if ui_operations.goto_bookpos(src.value):
|
if ui_operations.goto_cfi(src.value):
|
||||||
overlay.hide()
|
overlay.hide()
|
||||||
else:
|
else:
|
||||||
error_dialog(_('No such location'), _(
|
error_dialog(_('No such location'), _(
|
||||||
|
@ -167,7 +167,7 @@ class SyncBook: # {{{
|
|||||||
if ans is not None:
|
if ans is not None:
|
||||||
cfi = ans.cfi
|
cfi = ans.cfi
|
||||||
if cfi:
|
if cfi:
|
||||||
self.overlay.view.goto_bookpos(cfi)
|
self.overlay.view.goto_cfi(cfi)
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -65,7 +65,7 @@ class ReadUI:
|
|||||||
ui_operations.forward_gesture = self.forward_gesture.bind(self)
|
ui_operations.forward_gesture = self.forward_gesture.bind(self)
|
||||||
ui_operations.update_color_scheme = self.update_color_scheme.bind(self)
|
ui_operations.update_color_scheme = self.update_color_scheme.bind(self)
|
||||||
ui_operations.update_font_size = self.update_font_size.bind(self)
|
ui_operations.update_font_size = self.update_font_size.bind(self)
|
||||||
ui_operations.goto_bookpos = self.goto_bookpos.bind(self)
|
ui_operations.goto_cfi = self.goto_cfi.bind(self)
|
||||||
ui_operations.goto_frac = self.goto_frac.bind(self)
|
ui_operations.goto_frac = self.goto_frac.bind(self)
|
||||||
ui_operations.delete_book = self.delete_book.bind(self)
|
ui_operations.delete_book = self.delete_book.bind(self)
|
||||||
ui_operations.focus_iframe = self.focus_iframe.bind(self)
|
ui_operations.focus_iframe = self.focus_iframe.bind(self)
|
||||||
@ -160,8 +160,8 @@ class ReadUI:
|
|||||||
def update_font_size(self):
|
def update_font_size(self):
|
||||||
self.view.update_font_size()
|
self.view.update_font_size()
|
||||||
|
|
||||||
def goto_bookpos(self, bookpos):
|
def goto_cfi(self, bookpos):
|
||||||
return self.view.goto_bookpos(bookpos)
|
return self.view.goto_cfi(bookpos)
|
||||||
|
|
||||||
def goto_frac(self, frac):
|
def goto_frac(self, frac):
|
||||||
return self.view.goto_frac(frac)
|
return self.view.goto_frac(frac)
|
||||||
@ -494,7 +494,7 @@ class ReadUI:
|
|||||||
window.scrollTo(0, 0) # Ensure we are at the top of the window
|
window.scrollTo(0, 0) # Ensure we are at the top of the window
|
||||||
if same:
|
if same:
|
||||||
if current_state.bookpos is not current_query.bookpos and current_query.bookpos:
|
if current_state.bookpos is not current_query.bookpos and current_query.bookpos:
|
||||||
self.view.goto_bookpos(current_query.bookpos)
|
self.view.goto_cfi(current_query.bookpos)
|
||||||
else:
|
else:
|
||||||
self.load_book(current_query.library_id, int(current_query.book_id), current_query.fmt, library_data.metadata[current_query.book_id])
|
self.load_book(current_query.library_id, int(current_query.book_id), current_query.fmt, library_data.metadata[current_query.book_id])
|
||||||
|
|
||||||
|
@ -697,11 +697,11 @@ class View:
|
|||||||
def on_scroll_to_anchor(self, data):
|
def on_scroll_to_anchor(self, data):
|
||||||
self.show_name(data.name, initial_position={'type':'anchor', 'anchor':data.frag, 'replace_history':False})
|
self.show_name(data.name, initial_position={'type':'anchor', 'anchor':data.frag, 'replace_history':False})
|
||||||
|
|
||||||
def goto_bookpos(self, bookpos):
|
def goto_cfi(self, bookpos):
|
||||||
cfiname, internal_cfi = self.parse_cfi(bookpos, self.book)
|
cfiname, internal_cfi = self.parse_cfi(bookpos, self.book)
|
||||||
if cfiname and internal_cfi:
|
if cfiname and internal_cfi:
|
||||||
# replace_history has to be true here otherwise forward does not
|
# replace_history has to be true here otherwise forward does not
|
||||||
# work after back, as back uses goto_bookpos
|
# work after back, as back uses goto_cfi
|
||||||
pos = {'replace_history': True}
|
pos = {'replace_history': True}
|
||||||
name = cfiname
|
name = cfiname
|
||||||
pos.type, pos.cfi = 'cfi', internal_cfi
|
pos.type, pos.cfi = 'cfi', internal_cfi
|
||||||
|
@ -129,7 +129,7 @@ def on_pop_state():
|
|||||||
if view and view.currently_showing:
|
if view and view.currently_showing:
|
||||||
data = parse_url_params()
|
data = parse_url_params()
|
||||||
if data.bookpos and data.bookpos.startswith('epubcfi(/'):
|
if data.bookpos and data.bookpos.startswith('epubcfi(/'):
|
||||||
view.goto_bookpos(data.bookpos)
|
view.goto_cfi(data.bookpos)
|
||||||
|
|
||||||
|
|
||||||
def show_error(title, msg, details):
|
def show_error(title, msg, details):
|
||||||
@ -243,7 +243,7 @@ def goto_toc_node(node_id):
|
|||||||
|
|
||||||
@from_python
|
@from_python
|
||||||
def goto_cfi(cfi):
|
def goto_cfi(cfi):
|
||||||
view.goto_bookpos(cfi)
|
view.goto_cfi(cfi)
|
||||||
|
|
||||||
|
|
||||||
@from_python
|
@from_python
|
||||||
@ -304,8 +304,8 @@ if window is window.top:
|
|||||||
view.update_font_size()
|
view.update_font_size()
|
||||||
ui_operations.focus_iframe = def():
|
ui_operations.focus_iframe = def():
|
||||||
view.focus_iframe()
|
view.focus_iframe()
|
||||||
ui_operations.goto_bookpos = def(cfi):
|
ui_operations.goto_cfi = def(cfi):
|
||||||
return view.goto_bookpos(cfi)
|
return view.goto_cfi(cfi)
|
||||||
ui_operations.goto_frac = def(frac):
|
ui_operations.goto_frac = def(frac):
|
||||||
return view.goto_frac(frac)
|
return view.goto_frac(frac)
|
||||||
ui_operations.toggle_toc = def():
|
ui_operations.toggle_toc = def():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user