@@ -214,17 +214,30 @@ def brightness(self, value):
214
214
self .display .brightness = value
215
215
216
216
# pylint: disable=too-many-locals
217
- def show_business_card (self , * , image_name = None , email_string = None ,
218
- email_scale = 1 , email_font = terminalio .FONT , dwell = 20 ):
217
+ def show_business_card (self , * , image_name = None , name_string = None , name_scale = 1 ,
218
+ name_font = terminalio .FONT , email_string_one = None ,
219
+ email_scale_one = 1 , email_font_one = terminalio .FONT ,
220
+ email_string_two = None , email_scale_two = 1 ,
221
+ email_font_two = terminalio .FONT ):
219
222
"""Display a bitmap image and a text string, such as a personal image and email address.
220
223
221
224
:param str image_name: REQUIRED. The name of the bitmap image including .bmp, e.g.
222
225
``"Blinka.bmp"``.
223
- :param str email_string: A string to display along the bottom of the display, e.g.
226
+ :param str name_string: A name string to display along the bottom of the display, e.g.
227
+ ``"Blinka"``.
228
+ :param int name_scale: The scale of ``name_string``. Defaults to 1.
229
+ :param name_font: The font for the name string. Defaults to ``terminalio.FONT``.
230
+ :param str email_string_one: A string to display along the bottom of the display, e.g.
224
231
``"blinka@adafruit.com"``.
225
- :param int email_scale: The scale of ``email_string``. Defaults to 1.
226
- :param email_font: The font for the email string. Defaults to ``terminalio.FONT``.
227
- :param int dwell: The amount of time in seconds to display the business card.
232
+ :param int email_scale_one: The scale of ``email_string_one``. Defaults to 1.
233
+ :param email_font_one: The font for the first email string. Defaults to ``terminalio.FONT``.
234
+ :param str email_string_two: A second string to display along the bottom of the display.
235
+ Use if your email address is longer than one line or to add
236
+ more space between the name and email address,
237
+ e.g. (blinka@) ``"adafruit.com"``.
238
+ :param int email_scale_two: The scale of ``email_string_two``. Defaults to 1.
239
+ :param email_font_two: The font for the second email string. Defaults to
240
+ ``terminalio.FONT``.
228
241
229
242
"""
230
243
business_card_splash = displayio .Group (max_size = 30 )
@@ -234,16 +247,35 @@ def show_business_card(self, *, image_name=None, email_string=None,
234
247
face_image = displayio .TileGrid (on_disk_bitmap , pixel_shader = displayio .ColorConverter ())
235
248
business_card_splash .append (face_image )
236
249
self .display .wait_for_frame ()
237
- if email_string is not None and email_string :
238
- email_group = displayio .Group (scale = email_scale )
239
- email_label = Label (email_font , text = email_string )
240
- (_ , _ , width , height ) = email_label .bounding_box
241
- email_label .x = ((self .display .width // (2 * email_scale )) - width // 2 )
242
- email_label .y = int (height // (0.13 * email_scale ))
243
- email_label .color = 0xFFFFFF
244
- email_group .append (email_label )
245
- business_card_splash .append (email_group )
246
- time .sleep (dwell )
250
+ if name_string :
251
+ name_group = displayio .Group (scale = name_scale )
252
+ name_label = Label (name_font , text = name_string )
253
+ (_ , _ , width , height ) = name_label .bounding_box
254
+ name_label .x = ((self .display .width // (2 * name_scale )) - width // 2 )
255
+ name_label .y = int (height // (0.15 * name_scale ))
256
+ name_label .color = 0xFFFFFF
257
+ name_group .append (name_label )
258
+ business_card_splash .append (name_group )
259
+ if email_string_one :
260
+ email_group_one = displayio .Group (scale = email_scale_one )
261
+ email_label_one = Label (email_font_one , text = email_string_one )
262
+ (_ , _ , width , height ) = email_label_one .bounding_box
263
+ email_label_one .width = self .display .width
264
+ email_label_one .x = ((self .display .width // (2 * email_scale_one )) - width // 2 )
265
+ email_label_one .y = int (height // (0.13 * email_scale_one ))
266
+ email_label_one .color = 0xFFFFFF
267
+ email_group_one .append (email_label_one )
268
+ business_card_splash .append (email_group_one )
269
+ if email_string_two :
270
+ email_group_two = displayio .Group (scale = email_scale_two )
271
+ email_label_two = Label (email_font_two , text = email_string_two )
272
+ (_ , _ , width , height ) = email_label_two .bounding_box
273
+ email_label_two .width = self .display .width
274
+ email_label_two .x = ((self .display .width // (2 * email_scale_two )) - width // 2 )
275
+ email_label_two .y = int (height // (0.12 * email_scale_two ))
276
+ email_label_two .color = 0xFFFFFF
277
+ email_group_two .append (email_label_two )
278
+ business_card_splash .append (email_group_two )
247
279
248
280
# pylint: disable=too-many-locals
249
281
def show_badge (self , * , background_color = 0xFF0000 , foreground_color = 0xFFFFFF ,
@@ -289,7 +321,6 @@ def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,
289
321
290
322
hello_scale = hello_scale
291
323
hello_group = displayio .Group (scale = hello_scale )
292
- # Setup and Center the Hello Label
293
324
hello_label = Label (font = hello_font , text = hello_string )
294
325
(_ , _ , width , height ) = hello_label .bounding_box
295
326
hello_label .x = ((self .display .width // (2 * hello_scale )) - width // 2 )
@@ -299,7 +330,6 @@ def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,
299
330
300
331
my_name_is_scale = my_name_is_scale
301
332
my_name_is_group = displayio .Group (scale = my_name_is_scale )
302
- # Setup and Center the "My Name Is" Label
303
333
my_name_is_label = Label (font = my_name_is_font , text = my_name_is_string )
304
334
(_ , _ , width , height ) = my_name_is_label .bounding_box
305
335
my_name_is_label .x = ((self .display .width // (2 * my_name_is_scale )) - width // 2 )
@@ -309,7 +339,6 @@ def show_badge(self, *, background_color=0xFF0000, foreground_color=0xFFFFFF,
309
339
310
340
name_scale = name_scale
311
341
name_group = displayio .Group (scale = name_scale )
312
- # Setup and Center the Name Label
313
342
name_label = Label (font = name_font , text = name_string )
314
343
(_ , _ , width , height ) = name_label .bounding_box
315
344
name_label .x = ((self .display .width // (2 * name_scale )) - width // 2 )
@@ -338,7 +367,7 @@ def bitmap_qr(matrix):
338
367
bitmap [x + border_pixels , y + border_pixels ] = 0
339
368
return bitmap
340
369
341
- def show_qr_code (self , * , data = "https://circuitpython.org" , dwell = 20 ):
370
+ def show_qr_code (self , * , data = "https://circuitpython.org" ):
342
371
"""Generate a QR code and display it for ``dwell`` seconds.
343
372
344
373
:param string data: A string of data for the QR code
@@ -361,7 +390,6 @@ def show_qr_code(self, *, data="https://circuitpython.org", dwell=20):
361
390
qr_code = displayio .Group (scale = qr_code_scale )
362
391
qr_code .append (qr_img )
363
392
self .display .show (qr_code )
364
- time .sleep (dwell )
365
393
366
394
@staticmethod
367
395
def _sine_sample (length ):
0 commit comments