mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-05 08:40:13 -04:00
Handle missing title a bit better
This commit is contained in:
parent
8db03fd0c8
commit
08674935c1
@ -444,7 +444,10 @@ class EbookViewer(MainWindow):
|
|||||||
merge_annotations(parse_annotations(raw), amap)
|
merge_annotations(parse_annotations(raw), amap)
|
||||||
|
|
||||||
def update_window_title(self):
|
def update_window_title(self):
|
||||||
title = self.current_book_data['metadata']['title']
|
try:
|
||||||
|
title = self.current_book_data['metadata']['title']
|
||||||
|
except Exception:
|
||||||
|
title = _('Unknown')
|
||||||
book_format = self.current_book_data['manifest']['book_format']
|
book_format = self.current_book_data['manifest']['book_format']
|
||||||
title = '{} [{}] — {}'.format(title, book_format, self.base_window_title)
|
title = '{} [{}] — {}'.format(title, book_format, self.base_window_title)
|
||||||
self.setWindowTitle(title)
|
self.setWindowTitle(title)
|
||||||
|
@ -32,7 +32,7 @@ def create_open_book(container, book):
|
|||||||
fname = entry.pathtoebook.replace(/\\/g, '/')
|
fname = entry.pathtoebook.replace(/\\/g, '/')
|
||||||
if '/' in fname:
|
if '/' in fname:
|
||||||
fname = fname.rpartition('/')[-1]
|
fname = fname.rpartition('/')[-1]
|
||||||
items.push(create_item(entry.title, ui_operations.ask_for_open.bind(None, entry.pathtoebook), fname))
|
items.push(create_item(entry.title or _('Unknown'), ui_operations.ask_for_open.bind(None, entry.pathtoebook), fname))
|
||||||
create_item_list(c.lastChild, items)
|
create_item_list(c.lastChild, items)
|
||||||
|
|
||||||
c.appendChild(E.div(style='margin: 1rem'))
|
c.appendChild(E.div(style='margin: 1rem'))
|
||||||
|
@ -575,7 +575,7 @@ class View:
|
|||||||
self.overlay.show_loading_message(msg)
|
self.overlay.show_loading_message(msg)
|
||||||
|
|
||||||
def show_loading(self):
|
def show_loading(self):
|
||||||
msg = _('Loading next section from <i>{title}</i>, please wait…').format(title=self.book.metadata.title)
|
msg = _('Loading next section from <i>{title}</i>, please wait…').format(title=self.book.metadata.title or _('Unknown'))
|
||||||
if self.show_loading_callback_timer is not None:
|
if self.show_loading_callback_timer is not None:
|
||||||
clearTimeout(self.show_loading_callback_timer)
|
clearTimeout(self.show_loading_callback_timer)
|
||||||
self.show_loading_callback_timer = setTimeout(self.show_loading_message.bind(None, msg), 200)
|
self.show_loading_callback_timer = setTimeout(self.show_loading_message.bind(None, msg), 200)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user