Show home page if opening book fails

This commit is contained in:
Kovid Goyal 2019-08-29 12:50:56 +05:30
parent 09b93eb8be
commit 5e6623bcda
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 10 additions and 0 deletions

View File

@ -261,6 +261,7 @@ class EbookViewer(MainWindow):
error_dialog(self, _('Loading book failed'), _(
'Failed to open the book at {0}. Click "Show details" for more info.').format(data['pathtoebook']),
det_msg=data['tb'], show=True)
self.web_view.show_home_page()
return
set_book_path(data['base'], data['pathtoebook'])
self.current_book_data = data

View File

@ -211,6 +211,7 @@ class ViewerBridge(Bridge):
goto_cfi = to_js()
full_screen_state_changed = to_js()
get_current_cfi = to_js()
show_home_page = to_js()
def apply_font_settings(page_or_view):
@ -470,3 +471,6 @@ class WebView(RestartingWebEngineView):
def get_current_cfi(self, callback):
self.do_callback('get_current_cfi', callback)
def show_home_page(self):
self.execute_when_ready('show_home_page')

View File

@ -198,6 +198,11 @@ def create_view(prefs, all_font_families, field_metadata):
view.overlay.open_book(False)
@from_python
def show_home_page():
view.overlay.open_book(False)
@from_python
def show_preparing_message(msg):
view.show_loading_message(msg)