Skip to content

bitmap property for bitmap_label #156

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 21, 2021
Merged

Conversation

FoamyGuy
Copy link
Contributor

Formerly it was possible to access the Bitmap object that is drawn into by BitmapLabel. The Dial widget makes use of this in order to apply rotation to labels using bitmaptools.rotozoom()

This PR adds a bitmap property for BitmapLabel that restores access to it.

Copy link
Contributor

@lesamouraipourpre lesamouraipourpre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Tested on PyPortal.

Could you make the following changes to documentation:

diff --git a/adafruit_display_text/bitmap_label.py b/adafruit_display_text/bitmap_label.py
index 2ef4a72..0944b31 100755
--- a/adafruit_display_text/bitmap_label.py
+++ b/adafruit_display_text/bitmap_label.py
@@ -39,8 +39,9 @@ from adafruit_display_text import LabelBase
 
 class Label(LabelBase):
     """A label displaying a string of text that is stored in a bitmap.
-    Note: This ``bitmap_label.py`` library utilizes a bitmap to display the text.
-    This method is memory-conserving relative to ``label.py``.
+
+    Note: The `bitmap_label.Label` class utilizes a :py:class:`~displayio.Bitmap` to
+    display the text. This is memory-conserving relative to `label.Label`.
 
     For further reduction in memory usage, set ``save_text=False`` (text string will not
     be stored and ``line_spacing`` and ``font`` are immutable with ``save_text``
@@ -537,5 +538,9 @@ class Label(LabelBase):
 
     @property
     def bitmap(self):
-        """The Bitmap object that the text and background are drawn into."""
+        """
+        The Bitmap object that the text and background are drawn into.
+
+        :rtype: displayio.Bitmap
+        """
         return self._bitmap

@FoamyGuy
Copy link
Contributor Author

@lesamouraipourpre thanks for taking a look and trying this out.

Latest commit adds those type links in the docstrings.

Copy link
Contributor

@lesamouraipourpre lesamouraipourpre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@FoamyGuy FoamyGuy merged commit 99a296f into adafruit:main Aug 21, 2021
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Aug 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants