Sync to trunk.

This commit is contained in:
John Schember 2009-06-07 16:07:46 -04:00
commit 9d352de76c
3 changed files with 14 additions and 11 deletions

View File

@ -190,7 +190,6 @@ class FetchMetadata(QDialog, Ui_FetchMetadata):
if hasattr(self, '_hangcheck') and self._hangcheck.isActive(): if hasattr(self, '_hangcheck') and self._hangcheck.isActive():
self._hangcheck.stop() self._hangcheck.stop()
def __enter__(self, *args): def __enter__(self, *args):
return self return self

View File

@ -351,6 +351,7 @@ class DocumentView(QWebView):
html = open(path, 'rb').read().decode(path.encoding, 'replace') html = open(path, 'rb').read().decode(path.encoding, 'replace')
html = EntityDeclarationProcessor(html).processed_html html = EntityDeclarationProcessor(html).processed_html
self.setHtml(html, QUrl.fromLocalFile(path)) self.setHtml(html, QUrl.fromLocalFile(path))
self.turn_off_internal_scrollbars()
def load_started(self): def load_started(self):
if self.manager is not None: if self.manager is not None:
@ -387,6 +388,10 @@ class DocumentView(QWebView):
self.document.set_reference_prefix('%d.'%(spine_index+1)) self.document.set_reference_prefix('%d.'%(spine_index+1))
if scrolled: if scrolled:
self.manager.scrolled(self.document.scroll_fraction) self.manager.scrolled(self.document.scroll_fraction)
self.turn_off_internal_scrollbars()
def turn_off_internal_scrollbars(self):
self.document.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff) self.document.mainFrame().setScrollBarPolicy(Qt.Vertical, Qt.ScrollBarAlwaysOff)
self.document.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff) self.document.mainFrame().setScrollBarPolicy(Qt.Horizontal, Qt.ScrollBarAlwaysOff)
@ -432,20 +437,17 @@ class DocumentView(QWebView):
Qt.NoButton, Qt.NoModifier)) Qt.NoButton, Qt.NoModifier))
def next_page(self): def next_page(self):
delta_y = self.document.window_height - 25
if self.document.at_bottom: if self.document.at_bottom:
if self.manager is not None: if self.manager is not None:
self.manager.next_document() self.manager.next_document()
else: else:
opos = self.document.ypos opos = self.document.ypos
while True: lower_limit = opos + delta_y
delta = abs(opos-self.document.ypos) max_y = self.document.height - self.document.window_height
if delta > self.size().height(): lower_limit = min(max_y, lower_limit)
self.wheel_event(down=False) if lower_limit > opos:
break self.document.scroll_to(self.document.xpos, lower_limit)
pre = self.document.ypos
self.wheel_event(down=True)
if pre == self.document.ypos:
break
self.find_next_blank_line( self.height() - (self.document.ypos-opos) ) self.find_next_blank_line( self.height() - (self.document.ypos-opos) )
if self.manager is not None: if self.manager is not None:
self.manager.scrolled(self.scroll_fraction) self.manager.scrolled(self.scroll_fraction)

View File

@ -541,7 +541,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
QApplication.processEvents() QApplication.processEvents()
if worker.exception is not None: if worker.exception is not None:
if isinstance(worker.exception, DRMError): if isinstance(worker.exception, DRMError):
error_dialog(self, _('DRM Error'), _('<p>This book is protected by <a href="%s">DRM</a>')%'http://wiki.mobileread.com/wiki/DRM').exec_() error_dialog(self, _('DRM Error'),
_('<p>This book is protected by <a href="%s">DRM</a>')
%'http://wiki.mobileread.com/wiki/DRM').exec_()
else: else:
r = getattr(worker.exception, 'reason', worker.exception) r = getattr(worker.exception, 'reason', worker.exception)
error_dialog(self, _('Could not open ebook'), error_dialog(self, _('Could not open ebook'),