From 9d798a320074a2647be87d24b0e71550111b31b6 Mon Sep 17 00:00:00 2001 From: mush42 Date: Wed, 19 Jan 2022 20:51:46 +0200 Subject: [PATCH] Fixed a minor bug where the title of a dialog is not consistant with the rest of the applicatin. --- bookworm/bookshelf/viewer_integration.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/bookworm/bookshelf/viewer_integration.py b/bookworm/bookshelf/viewer_integration.py index 35f1bfa0..e1af16a2 100644 --- a/bookworm/bookshelf/viewer_integration.py +++ b/bookworm/bookshelf/viewer_integration.py @@ -78,9 +78,18 @@ def onOpenBookshelf(self, event): run_subcommand_in_a_new_process(["bookshelf",]) def onAddDocumentToLocalBookshelf(self, event): + try: + self.view.reader.document.get_file_system_path() + except DocumentIOError: + wx.MessageBox( + _("You can not add this document to Bookshelf.\nThe document should exist locally in your computer."), + _("Can not add document"), + style=wx.ICON_WARNING + ) + return dialog = EditDocumentClassificationDialog( self.view, - _("Document Category and Tags") + _("Reading list and collections") ) with dialog: retval = dialog.ShowModal() @@ -96,16 +105,8 @@ def onAddDocumentToLocalBookshelf(self, event): @call_threaded def _on_reader_loaded(self, sender): - try: - sender.document.get_file_system_path() - has_file_system_path = True - except DocumentIOError: - has_file_system_path = False wx.CallAfter( self.Enable, StatefulBookshelfMenuIds.add_current_book_to_shelf, - all([ - not Document.select().where(Document.uri == sender.document.uri).count(), - has_file_system_path - ]), + not Document.select().where(Document.uri == sender.document.uri).count() )