1
1
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
2
- #
2
+
3
3
# SPDX-License-Identifier: MIT
4
4
5
5
"""
11
11
"""
12
12
13
13
import displayio
14
-
15
14
from adafruit_display_text import label
16
-
17
15
import terminalio
18
16
17
+ # For older versions, typing may need to be imported
18
+ try :
19
+ from typing import List , Tuple
20
+ except ImportError :
21
+ pass
22
+
19
23
__version__ = "0.0.0+auto.0"
20
24
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_Display_Notification.git"
21
25
27
31
class NotificationFree (displayio .Group ):
28
32
"""Widget to show when no notifications are active."""
29
33
30
- def __init__ (self , width , height , * , dark_mode = True ):
34
+ def __init__ (self , width : int , height : int , * , dark_mode = True ):
31
35
# pylint: disable=unused-argument
32
36
super ().__init__ ()
33
37
@@ -46,7 +50,7 @@ def __init__(self, width, height, *, dark_mode=True):
46
50
class PlainNotification (displayio .Group ):
47
51
"""Plain text widget with a title and message."""
48
52
49
- def __init__ (self , title , message , width , height , * , dark_mode = True ):
53
+ def __init__ (self , title : str , message : str , width : int , height : int , * , dark_mode : bool = True ):
50
54
super ().__init__ ()
51
55
52
56
# Set text, font, and color
@@ -71,7 +75,7 @@ def __init__(self, title, message, width, height, *, dark_mode=True):
71
75
72
76
# cribbed from pyportal
73
77
@staticmethod
74
- def _wrap_nicely (string , max_chars ) :
78
+ def _wrap_nicely (string : str , max_chars : int ) -> List [ str ] :
75
79
"""A helper that will return a list of lines with word-break wrapping.
76
80
:param str string: The text to be wrapped.
77
81
:param int max_chars: The maximum number of characters on a line before wrapping.
0 commit comments