Rename goto_bookpos -> goto_cfi

This commit is contained in:
Kovid Goyal 2019-10-26 16:56:30 +05:30
parent eeab136034
commit 73c69949df
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
6 changed files with 13 additions and 13 deletions

View File

@ -78,7 +78,7 @@ ui_operations = {
'forward_gesture': None,
'update_color_scheme': None,
'update_font_size': None,
'goto_bookpos': None,
'goto_cfi': None,
'delete_book': None,
'focus_iframe': None,
'toggle_toc': None,

View File

@ -87,7 +87,7 @@ def create_location_overlay(current_position_data, overlay, container):
def goto_loc():
src = document.querySelector(f'#{container_id} [name=newloc]')
if src.value:
if ui_operations.goto_bookpos(src.value):
if ui_operations.goto_cfi(src.value):
overlay.hide()
else:
error_dialog(_('No such location'), _(

View File

@ -167,7 +167,7 @@ class SyncBook: # {{{
if ans is not None:
cfi = ans.cfi
if cfi:
self.overlay.view.goto_bookpos(cfi)
self.overlay.view.goto_cfi(cfi)
# }}}

View File

@ -65,7 +65,7 @@ class ReadUI:
ui_operations.forward_gesture = self.forward_gesture.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.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.delete_book = self.delete_book.bind(self)
ui_operations.focus_iframe = self.focus_iframe.bind(self)
@ -160,8 +160,8 @@ class ReadUI:
def update_font_size(self):
self.view.update_font_size()
def goto_bookpos(self, bookpos):
return self.view.goto_bookpos(bookpos)
def goto_cfi(self, bookpos):
return self.view.goto_cfi(bookpos)
def goto_frac(self, 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
if same:
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:
self.load_book(current_query.library_id, int(current_query.book_id), current_query.fmt, library_data.metadata[current_query.book_id])

View File

@ -697,11 +697,11 @@ class View:
def on_scroll_to_anchor(self, data):
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)
if cfiname and internal_cfi:
# 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}
name = cfiname
pos.type, pos.cfi = 'cfi', internal_cfi

View File

@ -129,7 +129,7 @@ def on_pop_state():
if view and view.currently_showing:
data = parse_url_params()
if data.bookpos and data.bookpos.startswith('epubcfi(/'):
view.goto_bookpos(data.bookpos)
view.goto_cfi(data.bookpos)
def show_error(title, msg, details):
@ -243,7 +243,7 @@ def goto_toc_node(node_id):
@from_python
def goto_cfi(cfi):
view.goto_bookpos(cfi)
view.goto_cfi(cfi)
@from_python
@ -304,8 +304,8 @@ if window is window.top:
view.update_font_size()
ui_operations.focus_iframe = def():
view.focus_iframe()
ui_operations.goto_bookpos = def(cfi):
return view.goto_bookpos(cfi)
ui_operations.goto_cfi = def(cfi):
return view.goto_cfi(cfi)
ui_operations.goto_frac = def(frac):
return view.goto_frac(frac)
ui_operations.toggle_toc = def():