"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/pyj/read_book/iframe.pyj" between
calibre-4.2.0.tar.xz and calibre-4.3.0.tar.xz

About: calibre is an e-book library management application (syncing, converting, viewing,\PKG_DESCR_TTnbsp;...).

iframe.pyj  (calibre-4.2.0.tar.xz):iframe.pyj  (calibre-4.3.0.tar.xz)
skipping to change at line 27 skipping to change at line 27
from read_book.footnotes import is_footnote_link from read_book.footnotes import is_footnote_link
from read_book.globals import ( from read_book.globals import (
current_book, current_layout_mode, current_spine_item, runtime, set_boss, current_book, current_layout_mode, current_spine_item, runtime, set_boss,
set_current_spine_item, set_layout_mode set_current_spine_item, set_layout_mode
) )
from read_book.mathjax import apply_mathjax from read_book.mathjax import apply_mathjax
from read_book.paged_mode import ( from read_book.paged_mode import (
anchor_funcs as paged_anchor_funcs, calc_columns_per_screen, current_cfi, anchor_funcs as paged_anchor_funcs, calc_columns_per_screen, current_cfi,
handle_gesture as paged_handle_gesture, handle_shortcut as paged_handle_shor tcut, handle_gesture as paged_handle_gesture, handle_shortcut as paged_handle_shor tcut,
jump_to_cfi as paged_jump_to_cfi, layout as paged_layout, jump_to_cfi as paged_jump_to_cfi, layout as paged_layout,
onwheel as paged_onwheel, progress_frac, reset_paged_mode_globals, onwheel as paged_onwheel, prepare_for_resize as paged_prepare_for_resize,
progress_frac, reset_paged_mode_globals, resize_done as paged_resize_done,
scroll_by_page as paged_scroll_by_page, scroll_to_elem, scroll_by_page as paged_scroll_by_page, scroll_to_elem,
scroll_to_fraction as paged_scroll_to_fraction, snap_to_selection scroll_to_fraction as paged_scroll_to_fraction, snap_to_selection
) )
from read_book.resources import finalize_resources, unserialize_html from read_book.resources import finalize_resources, unserialize_html
from read_book.settings import ( from read_book.settings import (
apply_colors, apply_font_size, apply_settings, apply_stylesheet, opts, apply_colors, apply_font_size, apply_settings, apply_stylesheet, opts,
update_settings update_settings
) )
from read_book.shortcuts import ( from read_book.shortcuts import (
create_shortcut_map, keyevent_as_shortcut, shortcut_for_key_event create_shortcut_map, keyevent_as_shortcut, shortcut_for_key_event
skipping to change at line 94 skipping to change at line 95
set_boss(self) set_boss(self)
handlers = { handlers = {
'initialize':self.initialize, 'initialize':self.initialize,
'display': self.display, 'display': self.display,
'scroll_to_anchor': self.on_scroll_to_anchor, 'scroll_to_anchor': self.on_scroll_to_anchor,
'scroll_to_frac': self.on_scroll_to_frac, 'scroll_to_frac': self.on_scroll_to_frac,
'next_screen': self.on_next_screen, 'next_screen': self.on_next_screen,
'change_font_size': self.change_font_size, 'change_font_size': self.change_font_size,
'change_color_scheme': self.change_color_scheme, 'change_color_scheme': self.change_color_scheme,
'gesture_from_margin': self.gesture_from_margin, 'gesture_from_margin': self.gesture_from_margin,
'wheel_from_margin': self.wheel_from_margin,
'find': self.find, 'find': self.find,
'window_size': self.received_window_size, 'window_size': self.received_window_size,
'get_current_cfi': self.get_current_cfi, 'get_current_cfi': self.get_current_cfi,
'set_forward_keypresses': self.set_forward_keypresses, 'set_forward_keypresses': self.set_forward_keypresses,
} }
self.comm = IframeClient(handlers) self.comm = IframeClient(handlers)
self.last_window_ypos = 0 self.last_window_ypos = 0
self.length_before = None self.length_before = None
def set_forward_keypresses(self, data): def set_forward_keypresses(self, data):
skipping to change at line 198 skipping to change at line 200
if gesture.type is 'show-chrome': if gesture.type is 'show-chrome':
self.send_message('show_chrome') self.send_message('show_chrome')
elif gesture.type is 'pinch': elif gesture.type is 'pinch':
self.send_message('bump_font_size', increase=gesture.direction is 'o ut') self.send_message('bump_font_size', increase=gesture.direction is 'o ut')
else: else:
self._handle_gesture(gesture) self._handle_gesture(gesture)
def gesture_from_margin(self, data): def gesture_from_margin(self, data):
self.handle_gesture(data.gesture) self.handle_gesture(data.gesture)
def wheel_from_margin(self, data):
self.onwheel(data.evt)
def report_human_scroll(self, scrolled_by_frac): def report_human_scroll(self, scrolled_by_frac):
self.send_message('human_scroll', scrolled_by_frac=scrolled_by_frac or N one) self.send_message('human_scroll', scrolled_by_frac=scrolled_by_frac or N one)
def on_scroll_to_anchor(self, data): def on_scroll_to_anchor(self, data):
frag = data.frag frag = data.frag
if frag: if frag:
self.scroll_to_anchor(frag) self.scroll_to_anchor(frag)
else: else:
self.to_scroll_fraction(0.0) self.to_scroll_fraction(0.0)
skipping to change at line 357 skipping to change at line 362
self.onresize_stage2() self.onresize_stage2()
def onselectionchange(self): def onselectionchange(self):
if self.content_ready: if self.content_ready:
self.send_message('selectionchange', text=document.getSelection().to String()) self.send_message('selectionchange', text=document.getSelection().to String())
def onresize_stage2(self): def onresize_stage2(self):
if scroll_viewport.width() is self.last_window_width and scroll_viewport .height() is self.last_window_height: if scroll_viewport.width() is self.last_window_width and scroll_viewport .height() is self.last_window_height:
# Safari at least, generates lots of spurious resize events # Safari at least, generates lots of spurious resize events
return return
self.last_window_width, self.last_window_height = scroll_viewport.width( ), scroll_viewport.height()
if current_layout_mode() is not 'flow': if current_layout_mode() is not 'flow':
self.do_layout() paged_prepare_for_resize(self.last_window_width, self.last_window_he
ight)
self.do_layout(self.is_titlepage)
self.last_window_width, self.last_window_height = scroll_viewport.width(
), scroll_viewport.height()
if self.last_cfi: if self.last_cfi:
cfi = self.last_cfi[len('epubcfi(/'):-1].partition('/')[2] cfi = self.last_cfi[len('epubcfi(/'):-1].partition('/')[2]
if cfi: if cfi:
paged_jump_to_cfi('/' + cfi) paged_jump_to_cfi('/' + cfi)
if current_layout_mode() is not 'flow':
paged_resize_done()
self.update_cfi() self.update_cfi()
self.update_toc_position() self.update_toc_position()
def received_window_size(self, data): def received_window_size(self, data):
scroll_viewport.update_window_size(data.width, data.height) scroll_viewport.update_window_size(data.width, data.height)
if self.content_ready: if self.content_ready:
self.onresize_stage2() self.onresize_stage2()
def onwheel(self, evt): def onwheel(self, evt):
if self.content_ready: if self.content_ready:
evt.preventDefault() if evt.preventDefault:
evt.preventDefault()
if evt.deltaY and evt.ctrlKey and not evt.shiftKey and not evt.altKe y and not evt.metaKey: if evt.deltaY and evt.ctrlKey and not evt.shiftKey and not evt.altKe y and not evt.metaKey:
self.send_message('handle_shortcut', name='increase_font_size' i f evt.deltaY < 0 else 'decrease_font_size') self.send_message('handle_shortcut', name='increase_font_size' i f evt.deltaY < 0 else 'decrease_font_size')
else: else:
self.handle_wheel(evt) self.handle_wheel(evt)
def onkeydown(self, evt): def onkeydown(self, evt):
if current_layout_mode() is not 'flow' and evt.key is 'Tab': if current_layout_mode() is not 'flow' and evt.key is 'Tab':
# Prevent the TAB key from shifting focus as it causes partial scrol ling # Prevent the TAB key from shifting focus as it causes partial scrol ling
evt.preventDefault() evt.preventDefault()
if self.forward_keypresses: if self.forward_keypresses:
 End of changes. 7 change blocks. 
4 lines changed or deleted 15 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)