Skip to content

Commit 52d3f97

Browse files
committed
Ran pre-commit, added licenses
1 parent 8b8964a commit 52d3f97

29 files changed

+519
-122
lines changed

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
*.mpy
26
.idea
37
__pycache__

.pylintrc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
[MASTER]
26

37
# A comma-separated list of package or module names from where C extensions may

.readthedocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: Unlicense
4+
15
python:
26
version: 3
37
requirements_file: requirements.txt

CODE_OF_CONDUCT.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2014 Coraline Ada Ehmke
3+
SPDX-FileCopyrightText: 2019 Kattni Rembor for Adafruit Industries
4+
SPDX-License-Identifier: CC-BY-4.0
5+
-->
6+
17
# Adafruit Community Code of Conduct
28

39
## Our Pledge
@@ -43,7 +49,7 @@ Examples of unacceptable behavior by participants include:
4349

4450
The goal of the standards and moderation guidelines outlined here is to build
4551
and maintain a respectful community. We ask that you don’t just aim to be
46-
"technically unimpeachable", but rather try to be your best self.
52+
"technically unimpeachable", but rather try to be your best self.
4753

4854
We value many things beyond technical expertise, including collaboration and
4955
supporting others within our community. Providing a positive experience for
@@ -74,9 +80,9 @@ You may report in the following ways:
7480
In any situation, you may send an email to <[email protected]>.
7581

7682
On the Adafruit Discord, you may send an open message from any channel
77-
to all Community Moderators by tagging @community moderators. You may
78-
also send an open message from any channel, or a direct message to
79-
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
83+
to all Community Moderators by tagging @community moderators. You may
84+
also send an open message from any channel, or a direct message to
85+
@kattni#1507, @tannewt#4653, @Dan Halbert#1614, @cater#2442,
8086
@sommersoft#0222, @Mr. Certainly#0472 or @Andon#8175.
8187

8288
Email and direct message reports will be kept confidential.

LICENSES/CC-BY-4.0.txt

Lines changed: 324 additions & 0 deletions
Large diffs are not rendered by default.

LICENSES/MIT.txt

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
MIT License Copyright (c) <year> <copyright holders>
2+
3+
Permission is hereby granted, free of charge, to any person obtaining a copy
4+
of this software and associated documentation files (the "Software"), to deal
5+
in the Software without restriction, including without limitation the rights
6+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7+
copies of the Software, and to permit persons to whom the Software is furnished
8+
to do so, subject to the following conditions:
9+
10+
The above copyright notice and this permission notice (including the next
11+
paragraph) shall be included in all copies or substantial portions of the
12+
Software.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
18+
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF
19+
OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

LICENSES/Unlicense.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
This is free and unencumbered software released into the public domain.
2+
3+
Anyone is free to copy, modify, publish, use, compile, sell, or distribute
4+
this software, either in source code form or as a compiled binary, for any
5+
purpose, commercial or non-commercial, and by any means.
6+
7+
In jurisdictions that recognize copyright laws, the author or authors of this
8+
software dedicate any and all copyright interest in the software to the public
9+
domain. We make this dedication for the benefit of the public at large and
10+
to the detriment of our heirs and successors. We intend this dedication to
11+
be an overt act of relinquishment in perpetuity of all present and future
12+
rights to this software under copyright law.
13+
14+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
16+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS
17+
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
18+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
19+
THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. For more information,
20+
please refer to <https://unlicense.org/>

README.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2017 Scott Shawcroft, written for Adafruit Industries
2+
3+
SPDX-License-Identifier: MIT

adafruit_display_text/__init__.py

Lines changed: 4 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,12 @@
1+
# SPDX-FileCopyrightText: 2020 Tim C for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT
4+
15
"""
26
Display Text module helper functions
37
"""
48

59

6-
# The MIT License (MIT)
7-
#
8-
# Copyright (c) 2020 Tim C for Adafruit Industries LLC
9-
#
10-
# Permission is hereby granted, free of charge, to any person obtaining a copy
11-
# of this software and associated documentation files (the "Software"), to deal
12-
# in the Software without restriction, including without limitation the rights
13-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14-
# copies of the Software, and to permit persons to whom the Software is
15-
# furnished to do so, subject to the following conditions:
16-
#
17-
# The above copyright notice and this permission notice shall be included in
18-
# all copies or substantial portions of the Software.
19-
#
20-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
26-
# THE SOFTWARE.
27-
28-
2910
def wrap_text_to_lines(string, max_chars):
3011
"""wrap_text_to_lines function
3112
A helper that will return a list of lines with word-break wrapping

adafruit_display_text/bitmap_label.py

Lines changed: 51 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2020 Kevin Matocha
22
#
3-
# Copyright (c) 2020 Kevin Matocha
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
13-
# all copies or substantial portions of the Software.
14-
#
15-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
# THE SOFTWARE.
3+
# SPDX-License-Identifier: MIT
4+
225
"""
236
`bitmap_label`
247
================================================================================
@@ -48,43 +31,43 @@
4831

4932
class Label(displayio.Group):
5033
"""A label displaying a string of text that is stored in a bitmap.
51-
Note: This ``bitmap_label.py`` library utilizes a bitmap to display the text.
52-
This method is memory-conserving relative to ``label.py``.
53-
The ``max_glyphs`` parameter is ignored and is present
54-
only for direct compatability with label.py.
55-
56-
For further reduction in memory usage, set ``save_text=False`` (text string will not
57-
be stored and ``line_spacing`` and ``font`` are immutable with ``save_text``
58-
set to ``False``).
59-
60-
The origin point set by ``x`` and ``y``
61-
properties will be the left edge of the bounding box, and in the center of a M
62-
glyph (if its one line), or the (number of lines * linespacing + M)/2. That is,
63-
it will try to have it be center-left as close as possible.
64-
65-
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``.
66-
Must include a capital M for measuring character size.
67-
:param str text: Text to display
68-
:param int max_glyphs: Unnecessary parameter (provided only for direct compability
69-
with label.py)
70-
:param int color: Color of all text in RGB hex
71-
:param int background_color: Color of the background, use `None` for transparent
72-
:param double line_spacing: Line spacing of text to display
73-
:param boolean background_tight: Set `True` only if you want background box to tightly
74-
surround text
75-
:param int padding_top: Additional pixels added to background bounding box at top
76-
:param int padding_bottom: Additional pixels added to background bounding box at bottom
77-
:param int padding_left: Additional pixels added to background bounding box at left
78-
:param int padding_right: Additional pixels added to background bounding box at right
79-
:param (double,double) anchor_point: Point that anchored_position moves relative to.
80-
Tuple with decimal percentage of width and height.
81-
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
82-
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
83-
containing x,y pixel coordinates.
84-
:param int scale: Integer value of the pixel scaling
85-
:param bool save_text: Set True to save the text string as a constant in the
86-
label structure. Set False to reduce memory use.
87-
"""
34+
Note: This ``bitmap_label.py`` library utilizes a bitmap to display the text.
35+
This method is memory-conserving relative to ``label.py``.
36+
The ``max_glyphs`` parameter is ignored and is present
37+
only for direct compatability with label.py.
38+
39+
For further reduction in memory usage, set ``save_text=False`` (text string will not
40+
be stored and ``line_spacing`` and ``font`` are immutable with ``save_text``
41+
set to ``False``).
42+
43+
The origin point set by ``x`` and ``y``
44+
properties will be the left edge of the bounding box, and in the center of a M
45+
glyph (if its one line), or the (number of lines * linespacing + M)/2. That is,
46+
it will try to have it be center-left as close as possible.
47+
48+
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``.
49+
Must include a capital M for measuring character size.
50+
:param str text: Text to display
51+
:param int max_glyphs: Unnecessary parameter (provided only for direct compability
52+
with label.py)
53+
:param int color: Color of all text in RGB hex
54+
:param int background_color: Color of the background, use `None` for transparent
55+
:param double line_spacing: Line spacing of text to display
56+
:param boolean background_tight: Set `True` only if you want background box to tightly
57+
surround text
58+
:param int padding_top: Additional pixels added to background bounding box at top
59+
:param int padding_bottom: Additional pixels added to background bounding box at bottom
60+
:param int padding_left: Additional pixels added to background bounding box at left
61+
:param int padding_right: Additional pixels added to background bounding box at right
62+
:param (double,double) anchor_point: Point that anchored_position moves relative to.
63+
Tuple with decimal percentage of width and height.
64+
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)
65+
:param (int,int) anchored_position: Position relative to the anchor_point. Tuple
66+
containing x,y pixel coordinates.
67+
:param int scale: Integer value of the pixel scaling
68+
:param bool save_text: Set True to save the text string as a constant in the
69+
label structure. Set False to reduce memory use.
70+
"""
8871

8972
# pylint: disable=unused-argument, too-many-instance-attributes, too-many-locals, too-many-arguments
9073
# pylint: disable=too-many-branches, no-self-use, too-many-statements
@@ -118,7 +101,11 @@ def __init__(
118101
# self Group will contain a single local_group which contains a Group (self.local_group)
119102
# which contains a TileGrid (self.tilegrid) which contains the text bitmap (self.bitmap)
120103
super().__init__(
121-
max_size=1, x=x, y=y, scale=1, **kwargs,
104+
max_size=1,
105+
x=x,
106+
y=y,
107+
scale=1,
108+
**kwargs,
122109
)
123110
# the self group scale should always remain at 1, the self.local_group will
124111
# be used to set the scale
@@ -248,7 +235,9 @@ def _reset_text(
248235
loose_box_y,
249236
loose_y_offset,
250237
) = self._text_bounding_box(
251-
text, self._font, self._line_spacing,
238+
text,
239+
self._font,
240+
self._line_spacing,
252241
) # calculate the box size for a tight and loose backgrounds
253242

254243
if self._background_tight:
@@ -645,8 +634,8 @@ def font(self, new_font):
645634
@property
646635
def anchor_point(self):
647636
"""Point that anchored_position moves relative to.
648-
Tuple with decimal percentage of width and height.
649-
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)"""
637+
Tuple with decimal percentage of width and height.
638+
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)"""
650639
return self._anchor_point
651640

652641
@anchor_point.setter
@@ -659,7 +648,7 @@ def anchor_point(self, new_anchor_point):
659648
@property
660649
def anchored_position(self):
661650
"""Position relative to the anchor_point. Tuple containing x,y
662-
pixel coordinates."""
651+
pixel coordinates."""
663652
return self._anchored_position
664653

665654
@anchored_position.setter

adafruit_display_text/label.py

Lines changed: 15 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,7 @@
1-
# The MIT License (MIT)
1+
# SPDX-FileCopyrightText: 2019 Scott Shawcroft for Adafruit Industries
22
#
3-
# Copyright (c) 2019 Scott Shawcroft for Adafruit Industries LLC
4-
#
5-
# Permission is hereby granted, free of charge, to any person obtaining a copy
6-
# of this software and associated documentation files (the "Software"), to deal
7-
# in the Software without restriction, including without limitation the rights
8-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9-
# copies of the Software, and to permit persons to whom the Software is
10-
# furnished to do so, subject to the following conditions:
11-
#
12-
# The above copyright notice and this permission notice shall be included in
13-
# all copies or substantial portions of the Software.
14-
#
15-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21-
# THE SOFTWARE.
3+
# SPDX-License-Identifier: MIT
4+
225
"""
236
`adafruit_display_text.label`
247
====================================================
@@ -47,16 +30,16 @@
4730

4831
class Label(displayio.Group):
4932
"""A label displaying a string of text. The origin point set by ``x`` and ``y``
50-
properties will be the left edge of the bounding box, and in the center of a M
51-
glyph (if its one line), or the (number of lines * linespacing + M)/2. That is,
52-
it will try to have it be center-left as close as possible.
33+
properties will be the left edge of the bounding box, and in the center of a M
34+
glyph (if its one line), or the (number of lines * linespacing + M)/2. That is,
35+
it will try to have it be center-left as close as possible.
5336
54-
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``.
55-
Must include a capital M for measuring character size.
56-
:param str text: Text to display
57-
:param int max_glyphs: The largest quantity of glyphs we will display
58-
:param int color: Color of all text in RGB hex
59-
:param double line_spacing: Line spacing of text to display"""
37+
:param Font font: A font class that has ``get_bounding_box`` and ``get_glyph``.
38+
Must include a capital M for measuring character size.
39+
:param str text: Text to display
40+
:param int max_glyphs: The largest quantity of glyphs we will display
41+
:param int color: Color of all text in RGB hex
42+
:param double line_spacing: Line spacing of text to display"""
6043

6144
# pylint: disable=too-many-instance-attributes, too-many-locals
6245
# This has a lot of getters/setters, maybe it needs cleanup.
@@ -410,8 +393,8 @@ def font(self, new_font):
410393
@property
411394
def anchor_point(self):
412395
"""Point that anchored_position moves relative to.
413-
Tuple with decimal percentage of width and height.
414-
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)"""
396+
Tuple with decimal percentage of width and height.
397+
(E.g. (0,0) is top left, (1.0, 0.5): is middle right.)"""
415398
return self._anchor_point
416399

417400
@anchor_point.setter
@@ -426,7 +409,7 @@ def anchor_point(self, new_anchor_point):
426409
@property
427410
def anchored_position(self):
428411
"""Position relative to the anchor_point. Tuple containing x,y
429-
pixel coordinates."""
412+
pixel coordinates."""
430413
if self._anchor_point is None:
431414
return None
432415
return (

docs/_static/favicon.ico.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
SPDX-FileCopyrightText: 2018 Phillip Torrone for Adafruit Industries
2+
3+
SPDX-License-Identifier: CC-BY-4.0

docs/api.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

docs/conf.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# -*- coding: utf-8 -*-
22

3+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
4+
#
5+
# SPDX-License-Identifier: MIT
6+
37
import os
48
import sys
59

docs/examples.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

docs/index.rst.license

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# SPDX-FileCopyrightText: 2020 ladyada for Adafruit Industries
2+
#
3+
# SPDX-License-Identifier: MIT

examples/display_text_anchored_position.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries
2+
# SPDX-License-Identifier: MIT
3+
14
"""
25
This examples shows the use of anchor_point and anchored_position.
36
"""

0 commit comments

Comments
 (0)