mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Wire up the home, back and forward buttons
This commit is contained in:
parent
58bf3a875e
commit
330b2ccf17
@ -111,6 +111,13 @@ class Boss:
|
|||||||
self.apply_mode()
|
self.apply_mode()
|
||||||
self.read_ui.load_book(book_id, fmt, metadata)
|
self.read_ui.load_book(book_id, fmt, metadata)
|
||||||
|
|
||||||
|
def return_to_book_list(self, book_id):
|
||||||
|
# Note that book_id could refer to a deleted book, that is, a book no
|
||||||
|
# longer in local storage
|
||||||
|
self.current_mode = 'book_list'
|
||||||
|
self.apply_mode()
|
||||||
|
self.push_state()
|
||||||
|
|
||||||
def change_books(self, data):
|
def change_books(self, data):
|
||||||
data.search_result.sort = data.search_result.sort.split(',')[:2].join(',')
|
data.search_result.sort = data.search_result.sort.split(',')[:2].join(',')
|
||||||
data.search_result.sort_order = data.search_result.sort_order.split(',')[:2].join(',')
|
data.search_result.sort_order = data.search_result.sort_order.split(',')[:2].join(',')
|
||||||
|
@ -5,6 +5,7 @@ from __python__ import hash_literals, bound_methods
|
|||||||
from dom import clear, set_css, element, svgicon, build_rule
|
from dom import clear, set_css, element, svgicon, build_rule
|
||||||
from elementmaker import E
|
from elementmaker import E
|
||||||
from book_list.theme import get_color
|
from book_list.theme import get_color
|
||||||
|
from book_list.globals import get_boss
|
||||||
from widgets import create_spinner
|
from widgets import create_spinner
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
|
||||||
@ -76,9 +77,9 @@ class MainOverlay: # {{{
|
|||||||
cursor='pointer', padding='0.5ex 0', margin='0 0.5rem',
|
cursor='pointer', padding='0.5ex 0', margin='0 0.5rem',
|
||||||
))
|
))
|
||||||
|
|
||||||
add_button('home', _('Return to list of books'))
|
add_button('home', _('Return to list of books'), self.return_to_book_list)
|
||||||
add_button('arrow-left', _('Back'))
|
add_button('arrow-left', _('Back'), self.back)
|
||||||
add_button('arrow-right', _('Forward'))
|
add_button('arrow-right', _('Forward'), self.forward)
|
||||||
add_button()
|
add_button()
|
||||||
add_button('refresh', _('Reload this book from the server'))
|
add_button('refresh', _('Reload this book from the server'))
|
||||||
add_button('cloud-download', _('Get last read position and annotations from the server'))
|
add_button('cloud-download', _('Get last read position and annotations from the server'))
|
||||||
@ -105,6 +106,18 @@ class MainOverlay: # {{{
|
|||||||
|
|
||||||
def on_hide(self):
|
def on_hide(self):
|
||||||
clearInterval(self.timer)
|
clearInterval(self.timer)
|
||||||
|
|
||||||
|
def return_to_book_list(self):
|
||||||
|
view = self.overlay.view
|
||||||
|
book_id = view.book.key[1]
|
||||||
|
get_boss().return_to_book_list(book_id)
|
||||||
|
|
||||||
|
def back(self):
|
||||||
|
window.history.back()
|
||||||
|
|
||||||
|
def forward(self):
|
||||||
|
window.history.forward()
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
class Overlay:
|
class Overlay:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user