E-book viewer: Do not popup an error message if the user tries to use the mouse wheel to scroll before a document is loaded. Fixes #903449 (exception raised in ebook-viewer)

This commit is contained in:
Kovid Goyal 2011-12-13 09:00:34 +05:30
parent f567ee214c
commit f40f41a889

View File

@ -758,11 +758,12 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
self.set_page_number(frac)
def next_document(self):
if self.current_index < len(self.iterator.spine) - 1:
if (hasattr(self, 'current_index') and self.current_index <
len(self.iterator.spine) - 1):
self.load_path(self.iterator.spine[self.current_index+1])
def previous_document(self):
if self.current_index > 0:
if hasattr(self, 'current_index') and self.current_index > 0:
self.load_path(self.iterator.spine[self.current_index-1], pos=1.0)
def keyPressEvent(self, event):