/usr/lib/python3/dist-packages/prompt_toolkit/layout/mouse_handlers.py is in python3-prompt-toolkit 1.0.9-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | from __future__ import unicode_literals
from itertools import product
from collections import defaultdict
__all__ = (
'MouseHandlers',
)
class MouseHandlers(object):
"""
Two dimentional raster of callbacks for mouse events.
"""
def __init__(self):
def dummy_callback(cli, mouse_event):
"""
:param mouse_event: `MouseEvent` instance.
"""
# Map (x,y) tuples to handlers.
self.mouse_handlers = defaultdict(lambda: dummy_callback)
def set_mouse_handler_for_range(self, x_min, x_max, y_min, y_max, handler=None):
"""
Set mouse handler for a region.
"""
for x, y in product(range(x_min, x_max), range(y_min, y_max)):
self.mouse_handlers[x,y] = handler
|