You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORPA-pyOpenRPA/Resources/WPy64-3720/python-3.7.2.amd64/Lib/site-packages/prompt_toolkit/layout/mouse_handlers.py

30 lines
776 B

from __future__ import unicode_literals
from itertools import product
from collections import defaultdict
__all__ = [
'MouseHandlers',
]
class MouseHandlers(object):
"""
Two dimensional raster of callbacks for mouse events.
"""
def __init__(self):
def dummy_callback(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