Merge from trunk

This commit is contained in:
Charles Haley 2012-06-20 10:00:58 +02:00
commit de763febd8
3 changed files with 19 additions and 8 deletions

View File

@ -82,6 +82,17 @@ class PagedDisplay
this.cols_per_screen = cols_per_screen this.cols_per_screen = cols_per_screen
layout: () -> layout: () ->
# Remove the top margin from the first child of body as that gets added
# to the top margin of body. This is done here just in case
# getComputedStyle() causes a relayout. The re-layout will be much
# faster before we implement the multi-column layout.
for node in document.body.childNodes
if node.nodeType == 1 # Element node
style = window.getComputedStyle(node)
if style.display in ['block', 'table']
node.style.setProperty('margin-top', '0px')
break
ww = window.innerWidth ww = window.innerWidth
wh = window.innerHeight wh = window.innerHeight
body_height = wh - this.margin_bottom = this.margin_top body_height = wh - this.margin_bottom = this.margin_top
@ -135,11 +146,6 @@ class PagedDisplay
priority = rule.style.getPropertyPriority(prop) priority = rule.style.getPropertyPriority(prop)
rule.style.setProperty(cprop, val, priority) rule.style.setProperty(cprop, val, priority)
# Ensure that the top margin is correct, otherwise for some documents,
# webkit lays out the body with a lot of space on top
brect = document.body.getBoundingClientRect()
if brect.top > this.margin_top
bs.setProperty('margin-top', (this.margin_top - brect.top)+'px')
this.in_paged_mode = true this.in_paged_mode = true
this.current_margin_side = sm this.current_margin_side = sm
return sm return sm

View File

@ -100,9 +100,7 @@ def restore_database(db, parent=None):
'the database from the individual book ' 'the database from the individual book '
'metadata. This is useful if the ' 'metadata. This is useful if the '
'database has been corrupted and you get a ' 'database has been corrupted and you get a '
'blank list of books. Note that restoring only ' 'blank list of books.'
'restores books, not any settings stored in the '
'database, or any custom recipes.'
'<p>Do you want to restore the database?')): '<p>Do you want to restore the database?')):
return False return False
db.conn.close() db.conn.close()

View File

@ -928,6 +928,13 @@ class DocumentView(QWebView): # {{{
self.document.scroll_to(x=loc, y=0) self.document.scroll_to(x=loc, y=0)
if self.manager is not None: if self.manager is not None:
self.manager.scrolled(self.scroll_fraction) self.manager.scrolled(self.scroll_fraction)
event.accept()
elif self.manager is not None:
if direction == 'next':
self.manager.next_document()
else:
self.manager.previous_document()
event.accept()
return return
if event.delta() < -14: if event.delta() < -14: