Use bound methods

This commit is contained in:
Kovid Goyal 2020-08-18 19:40:33 +05:30
parent 5ceb657088
commit 10d123dedf
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -21,7 +21,7 @@
# The result of all this is that paged mode's math can safely pretend that # The result of all this is that paged mode's math can safely pretend that
# things scroll in the positive inline direction. # things scroll in the positive inline direction.
from __python__ import hash_literals from __python__ import hash_literals, bound_methods
import traceback import traceback
from elementmaker import E from elementmaker import E
@ -612,7 +612,7 @@ class HandleWheel:
wheel_handler = HandleWheel() wheel_handler = HandleWheel()
onwheel = wheel_handler.onwheel.bind(wheel_handler) onwheel = wheel_handler.onwheel
def scroll_by_page(backward, by_screen, flip_if_rtl_page_progression): def scroll_by_page(backward, by_screen, flip_if_rtl_page_progression):
@ -791,13 +791,13 @@ class DragScroller:
if not self.is_running() or backward is not self.backward: if not self.is_running() or backward is not self.backward:
self.stop() self.stop()
self.backward = backward self.backward = backward
self.timer_id = window.setTimeout(self.do_one_page_turn.bind(self), self.INTERVAL) self.timer_id = window.setTimeout(self.do_one_page_turn, self.INTERVAL)
def do_one_page_turn(self): def do_one_page_turn(self):
pos = previous_col_location() if self.backward else next_col_location() pos = previous_col_location() if self.backward else next_col_location()
if pos >= 0: if pos >= 0:
scroll_to_pos(pos) scroll_to_pos(pos)
self.timer_id = window.setTimeout(self.do_one_page_turn.bind(self), self.INTERVAL * 2) self.timer_id = window.setTimeout(self.do_one_page_turn, self.INTERVAL * 2)
else: else:
self.stop() self.stop()