mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Set window title to title of book being read
This commit is contained in:
parent
449511cd8e
commit
6b9debcea7
@ -53,13 +53,17 @@ class Boss:
|
|||||||
divid = 'read-book-container' if mode is 'read_book' else 'book-list-container'
|
divid = 'read-book-container' if mode is 'read_book' else 'book-list-container'
|
||||||
for x in ['book-list-container', 'read-book-container']:
|
for x in ['book-list-container', 'read-book-container']:
|
||||||
document.getElementById(x).style.display = 'block' if x is divid else 'none'
|
document.getElementById(x).style.display = 'block' if x is divid else 'none'
|
||||||
|
self.update_window_title()
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def has_history(self):
|
def has_history(self):
|
||||||
return self.history_count > 0
|
return self.history_count > 0
|
||||||
|
|
||||||
def update_window_title(self):
|
def update_window_title(self):
|
||||||
document.title = 'calibre :: ' + self.current_library_name
|
if self.current_mode is 'book_list':
|
||||||
|
document.title = 'calibre :: ' + self.current_library_name
|
||||||
|
elif self.current_mode is 'read_book':
|
||||||
|
document.title = self.read_ui.current_metadata.title
|
||||||
|
|
||||||
def onerror(self, msg, script_url, line_number, column_number, error_object):
|
def onerror(self, msg, script_url, line_number, column_number, error_object):
|
||||||
try:
|
try:
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
from ajax import ajax, encode_query
|
from ajax import ajax, encode_query
|
||||||
from elementmaker import E
|
from elementmaker import E
|
||||||
from gettext import gettext as _
|
from gettext import gettext as _
|
||||||
|
from book_list.globals import get_boss
|
||||||
from modals import error_dialog
|
from modals import error_dialog
|
||||||
from utils import human_readable
|
from utils import human_readable
|
||||||
from read_book.db import create_db
|
from read_book.db import create_db
|
||||||
@ -97,6 +98,7 @@ class ReadUI:
|
|||||||
self.current_book_id = book_id
|
self.current_book_id = book_id
|
||||||
metadata = metadata or self.interface_data.metadata[book_id]
|
metadata = metadata or self.interface_data.metadata[book_id]
|
||||||
self.current_metadata = metadata or {'title':_('Book id #') + book_id}
|
self.current_metadata = metadata or {'title':_('Book id #') + book_id}
|
||||||
|
get_boss().update_window_title()
|
||||||
self.init_ui()
|
self.init_ui()
|
||||||
if type(self.db) is 'string':
|
if type(self.db) is 'string':
|
||||||
self.show_error(_('Cannot read book'), self.db)
|
self.show_error(_('Cannot read book'), self.db)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user