mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Implement remaining two misc prefs
This commit is contained in:
parent
d9c1eb14d7
commit
7cfe60f705
@ -224,7 +224,7 @@ class EbookViewer(MainWindow):
|
|||||||
# CFI management {{{
|
# CFI management {{{
|
||||||
def initial_cfi_for_current_book(self):
|
def initial_cfi_for_current_book(self):
|
||||||
lrp = self.current_book_data['annotations_map']['last-read']
|
lrp = self.current_book_data['annotations_map']['last-read']
|
||||||
if lrp:
|
if lrp and get_session_pref('remember_last_read', default=True):
|
||||||
lrp = lrp[0]
|
lrp = lrp[0]
|
||||||
if lrp['pos_type'] == 'epubcfi':
|
if lrp['pos_type'] == 'epubcfi':
|
||||||
return lrp['pos']
|
return lrp['pos']
|
||||||
@ -244,7 +244,8 @@ class EbookViewer(MainWindow):
|
|||||||
annots = as_bytes(serialize_annotations(amap))
|
annots = as_bytes(serialize_annotations(amap))
|
||||||
with open(os.path.join(annotations_dir, self.current_book_data['annotations_path_key']), 'wb') as f:
|
with open(os.path.join(annotations_dir, self.current_book_data['annotations_path_key']), 'wb') as f:
|
||||||
f.write(annots)
|
f.write(annots)
|
||||||
if self.current_book_data.get('pathtoebook', '').lower().endswith('.epub'):
|
if self.current_book_data.get('pathtoebook', '').lower().endswith(
|
||||||
|
'.epub') and get_session_pref('save_annotations_in_ebook', default=True):
|
||||||
path = self.current_book_data['pathtoebook']
|
path = self.current_book_data['pathtoebook']
|
||||||
if os.access(path, os.W_OK):
|
if os.access(path, os.W_OK):
|
||||||
before_stat = os.stat(path)
|
before_stat = os.stat(path)
|
||||||
@ -259,7 +260,7 @@ class EbookViewer(MainWindow):
|
|||||||
def restore_state(self):
|
def restore_state(self):
|
||||||
state = vprefs['main_window_state']
|
state = vprefs['main_window_state']
|
||||||
geom = vprefs['main_window_geometry']
|
geom = vprefs['main_window_geometry']
|
||||||
if geom and get_session_pref('remember_window_geometry'):
|
if geom and get_session_pref('remember_window_geometry', default=False):
|
||||||
self.restoreGeometry(geom)
|
self.restoreGeometry(geom)
|
||||||
if state:
|
if state:
|
||||||
self.restoreState(state, self.MAIN_WINDOW_STATE_VERSION)
|
self.restoreState(state, self.MAIN_WINDOW_STATE_VERSION)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user