Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update the pixel_shader usage of OnDiskBitmap #46

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
Jul 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified adafruit_pybadger/__init__.py
100755 → 100644
Empty file.
Empty file modified adafruit_pybadger/clue.py
100755 → 100644
Empty file.
Empty file modified adafruit_pybadger/mag_tag.py
100755 → 100644
Empty file.
2 changes: 1 addition & 1 deletion adafruit_pybadger/pewpewm4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# SPDX-License-Identifier: MIT

"""
`adafruit_pybadger.clue`
`adafruit_pybadger.pewpewm4`
================================================================================

Badge-focused CircuitPython helper library for Pew Pew M4.
Expand Down
Empty file modified adafruit_pybadger/pybadge.py
100755 → 100644
Empty file.
47 changes: 24 additions & 23 deletions adafruit_pybadger/pybadger_base.py
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -153,26 +153,26 @@ def _create_badge_background(self):
with open(self._background_image_filename, "rb") as file_handle:
on_disk_bitmap = displayio.OnDiskBitmap(file_handle)
background_image = displayio.TileGrid(
on_disk_bitmap, pixel_shader=displayio.ColorConverter()
on_disk_bitmap,
pixel_shader=getattr(
on_disk_bitmap, "pixel_shader", displayio.ColorConverter()
),
# TODO: Once CP6 is no longer supported, replace the above line with below
# pixel_shader=on_disk_background.pixel_shader,
)
self._background_group.append(background_image)
for image_label in self._lines:
self._background_group.append(image_label)

try:
# Refresh display in CircuitPython 5
self.display.refresh()
except AttributeError:
# Refresh display in CircuitPython 4
self.display.wait_for_frame()
self.display.refresh()
else:
for background_label in self._lines:
self._background_group.append(background_label)

def badge_background(
self,
background_color=(255, 0, 0),
rectangle_color=(255, 255, 255),
background_color=RED,
rectangle_color=WHITE,
rectangle_drop=0.4,
rectangle_height=0.5,
):
Expand Down Expand Up @@ -206,8 +206,8 @@ def badge_background(

def _badge_background(
self,
background_color=(255, 0, 0),
rectangle_color=(255, 255, 255),
background_color=RED,
rectangle_color=WHITE,
rectangle_drop=0.4,
rectangle_height=0.5,
):
Expand Down Expand Up @@ -254,7 +254,7 @@ def image_background(self, image_name=None):
def badge_line(
self,
text=" ",
color=(0, 0, 0),
color=BLACK,
scale=1,
font=terminalio.FONT,
left_justify=False,
Expand Down Expand Up @@ -517,26 +517,27 @@ def show_business_card(
with open(image_name, "rb") as file_name:
on_disk_bitmap = displayio.OnDiskBitmap(file_name)
face_image = displayio.TileGrid(
on_disk_bitmap, pixel_shader=displayio.ColorConverter()
on_disk_bitmap,
pixel_shader=getattr(
on_disk_bitmap, "pixel_shader", displayio.ColorConverter()
),
# TODO: Once CP6 is no longer supported, replace the above line with below
# pixel_shader=on_disk_bitmap.pixel_shader,
)
business_card_splash.append(face_image)
for group in business_card_label_groups:
business_card_splash.append(group)
try:
# Refresh display in CircuitPython 5
self.display.refresh()
except AttributeError:
# Refresh display in CircuitPython 4
self.display.wait_for_frame()

self.display.refresh()

# pylint: disable=too-many-locals
def show_badge(
self,
*,
background_color=(255, 0, 0),
foreground_color=(255, 255, 255),
background_text_color=(255, 255, 255),
foreground_text_color=(0, 0, 0),
background_color=RED,
foreground_color=WHITE,
background_text_color=WHITE,
foreground_text_color=BLACK,
hello_font=terminalio.FONT,
hello_scale=1,
hello_string="HELLO",
Expand Down
Empty file modified adafruit_pybadger/pygamer.py
100755 → 100644
Empty file.
9 changes: 9 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,17 @@
.. automodule:: adafruit_pybadger.clue
:members:

.. automodule:: adafruit_pybadger.mag_tag
:members:

.. automodule:: adafruit_pybadger.pewpewm4
:members:

.. automodule:: adafruit_pybadger.pybadge
:members:

.. automodule:: adafruit_pybadger.pygamer
:members:

.. automodule:: adafruit_pybadger.pyportal
:members:
4 changes: 0 additions & 4 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,8 @@
"gamepadshift",
"neopixel",
"analogio",
"adafruit_display_shapes",
"adafruit_display_text",
"terminalio",
"adafruit_miniqr",
"adafruit_lis3dh",
"adafruit_bitmap_font",
"adafruit_lsm6ds",
"gamepad",
"audiocore",
Expand Down
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@
# SPDX-License-Identifier: Unlicense

Adafruit-Blinka
adafruit-circuitpython-bitmap-font
adafruit-circuitpython-display-shapes
adafruit-circuitpython-display-text
adafruit-circuitpython-gizmo
adafruit-circuitpython-lis3dh
adafruit-circuitpython-lsm6ds
adafruit-circuitpython-miniqr
adafruit-circuitpython-neopixel