diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py index a83ae48d94..88ea9b7f69 100644 --- a/src/calibre/gui2/viewer/main.py +++ b/src/calibre/gui2/viewer/main.py @@ -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])) diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 356649bae0..2a181b09d8 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -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()