mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
viewer: error out if print book is used when no book is open
This is slightly nicer than erroring out, but with a traceback due to trying to access a nonexistent pathtoebook attribute.
This commit is contained in:
parent
14aa61d246
commit
c2f76f2932
@ -428,6 +428,10 @@ class EbookViewer(MainWindow):
|
|||||||
error_dialog(self, title, msg, det_msg=details or None, show=True)
|
error_dialog(self, title, msg, det_msg=details or None, show=True)
|
||||||
|
|
||||||
def print_book(self):
|
def print_book(self):
|
||||||
|
if not hasattr(set_book_path, 'pathtoebook'):
|
||||||
|
error_dialog(self, _('No ebook selected'), _(
|
||||||
|
"Cannot print a book if no book is open yet."), show=True)
|
||||||
|
return
|
||||||
from .printing import print_book
|
from .printing import print_book
|
||||||
print_book(set_book_path.pathtoebook, book_title=self.current_book_data['metadata']['title'], parent=self)
|
print_book(set_book_path.pathtoebook, book_title=self.current_book_data['metadata']['title'], parent=self)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user