|
41 | 41 | __repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_USB_Host_Mouse.git" |
42 | 42 |
|
43 | 43 | BUTTONS = ["left", "right", "middle"] |
| 44 | +DEFAULT_CURSOR = "/".join(__file__.split("/")[:-1]) + "/mouse_cursor.bmp" |
44 | 45 |
|
45 | 46 |
|
46 | | -def find_and_init_boot_mouse(cursor_image=None): # noqa: PLR0912 |
| 47 | +def find_and_init_boot_mouse(cursor_image=DEFAULT_CURSOR): # noqa: PLR0912 |
47 | 48 | """ |
48 | 49 | Scan for an attached boot mouse connected via USB host. |
49 | | - If one is found initialize an instance of BootMouse class |
| 50 | + If one is found initialize an instance of :class:`BootMouse` class |
50 | 51 | and return it. |
51 | 52 |
|
52 | | - :param cursor_image: Provide the absolute path to the desired cursor bitmap image. If not |
53 | | - provided or set to `None`, the bitmap image included with this library will be used. If set as |
54 | | - `False`, the BootMouse instance will not control a :class:`displayio.TileGrid`. |
55 | | - :return: The BootMouse instance or None if no mouse was found. |
| 53 | + :param cursor_image: Provide the absolute path to the desired cursor bitmap image. If set as |
| 54 | + `None`, the :class:`BootMouse` instance will not control a :class:`displayio.TileGrid` object. |
| 55 | + :return: The :class:`BootMouse` instance or None if no mouse was found. |
56 | 56 | """ |
57 | 57 | mouse_interface_index, mouse_endpoint_address = None, None |
58 | 58 | mouse_device = None |
@@ -104,10 +104,6 @@ def find_and_init_boot_mouse(cursor_image=None): # noqa: PLR0912 |
104 | 104 | # set configuration on the mouse so we can use it |
105 | 105 | mouse_device.set_configuration() |
106 | 106 |
|
107 | | - # get path of included cursor bitmap |
108 | | - if cursor_image is None: |
109 | | - cursor_image = "/".join(__file__.split("/")[:-1]) + "/mouse_cursor.bmp" |
110 | | - |
111 | 107 | # load the mouse cursor bitmap |
112 | 108 | if isinstance(cursor_image, str): |
113 | 109 | mouse_bmp = OnDiskBitmap(cursor_image) |
|
0 commit comments