mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-30 21:41:57 -04:00
Viewer: Add command line option to force reloading of all books
This commit is contained in:
parent
b206f89336
commit
243144f3b9
@ -159,6 +159,8 @@ View an e-book.
|
||||
a('--full-screen', '--fullscreen', '-f', default=False, action='store_true',
|
||||
help=_('If specified, viewer window will try to open '
|
||||
'full screen when started.'))
|
||||
a('--force-reload', default=False, action='store_true',
|
||||
help=_('Force reload of all opened books'))
|
||||
a('--open-at', default=None, help=_(
|
||||
'The position at which to open the specified book. The position is '
|
||||
'a location you can get by using the Goto action in the viewer controls. '
|
||||
@ -203,7 +205,7 @@ def main(args=sys.argv):
|
||||
app.load_builtin_fonts()
|
||||
app.setWindowIcon(QIcon(I('viewer.png')))
|
||||
migrate_previous_viewer_prefs()
|
||||
main = EbookViewer(open_at=opts.open_at, continue_reading=opts.continue_reading)
|
||||
main = EbookViewer(open_at=opts.open_at, continue_reading=opts.continue_reading, force_reload=opts.force_reload)
|
||||
main.set_exception_handler()
|
||||
if len(args) > 1:
|
||||
acc.events.append(os.path.abspath(args[-1]))
|
||||
|
@ -77,8 +77,9 @@ class EbookViewer(MainWindow):
|
||||
book_prepared = pyqtSignal(object, object)
|
||||
MAIN_WINDOW_STATE_VERSION = 1
|
||||
|
||||
def __init__(self, open_at=None, continue_reading=None):
|
||||
def __init__(self, open_at=None, continue_reading=None, force_reload=False):
|
||||
MainWindow.__init__(self, None)
|
||||
self.force_reload = force_reload
|
||||
connect_lambda(self.book_preparation_started, self, lambda self: self.loading_overlay(_(
|
||||
'Preparing book for first read, please wait')), type=Qt.QueuedConnection)
|
||||
self.maximized_at_last_fullscreen = False
|
||||
@ -302,7 +303,7 @@ class EbookViewer(MainWindow):
|
||||
self.loading_overlay(_('Loading book, please wait'))
|
||||
self.save_annotations()
|
||||
self.current_book_data = {}
|
||||
t = Thread(name='LoadBook', target=self._load_ebook_worker, args=(pathtoebook, open_at, reload_book))
|
||||
t = Thread(name='LoadBook', target=self._load_ebook_worker, args=(pathtoebook, open_at, reload_book or self.force_reload))
|
||||
t.daemon = True
|
||||
t.start()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user