Merge pull request #71 from Neradoc/add-remove-qrcode

Allow to remove QR code
This commit is contained in:
Scott Shawcroft 2022-06-30 11:37:03 -07:00 committed by GitHub
commit 217af2bc7d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -106,12 +106,19 @@ class GraphicsBase:
): # pylint: disable=invalid-name ): # pylint: disable=invalid-name
"""Display a QR code """Display a QR code
:param qr_data: The data for the QR code. :param qr_data: The data for the QR code, None to remove.
:param int qr_size: The scale of the QR code. :param int qr_size: The scale of the QR code.
:param x: The x position of upper left corner of the QR code on the display. :param x: The x position of upper left corner of the QR code on the display.
:param y: The y position of upper left corner of the QR code on the display. :param y: The y position of upper left corner of the QR code on the display.
""" """
if qr_data is None:
if self._qr_group and self._qr_group in self.splash:
self.splash.remove(self._qr_group)
self._qr_group = None
gc.collect()
return
import adafruit_miniqr # pylint: disable=import-outside-toplevel import adafruit_miniqr # pylint: disable=import-outside-toplevel
# generate the QR code # generate the QR code