mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 10:14:46 -04:00
Sync to trunk.
This commit is contained in:
commit
9d352de76c
@ -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
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
@ -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'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user