@@ -296,41 +296,25 @@ def show_business_card(self, *, image_name=None, name_string=None, name_scale=1,
296296 self .display .refresh (target_frames_per_second = 60 )
297297 except AttributeError :
298298 self .display .wait_for_frame ()
299+
299300 if name_string :
300- if isinstance (name_font , str ):
301- name_font = load_font (name_font , name_string )
302- name_group = displayio .Group (scale = name_scale )
303- name_label = Label (name_font , text = name_string , line_spacing = 0.75 )
304- (_ , _ , width , _ ) = name_label .bounding_box
305- name_label .x = ((self .display .width // (2 * name_scale )) - width // 2 )
306- name_label .y = int (self .display .height * (0.73 / name_scale ))
307- name_label .color = 0xFFFFFF
308- name_group .append (name_label )
301+ name_group = self ._create_label_group (text = name_string ,
302+ font = name_font ,
303+ scale = name_scale ,
304+ height_adjustment = 0.73 )
309305 business_card_splash .append (name_group )
310306 if email_string_one :
311- if isinstance (email_font_one , str ):
312- email_font_one = load_font (email_font_one , email_string_one )
313- email_group_one = displayio .Group (scale = email_scale_one )
314- email_label_one = Label (email_font_one , text = email_string_one , line_spacing = 0.75 )
315- (_ , _ , width , _ ) = email_label_one .bounding_box
316- email_label_one .width = self .display .width
317- email_label_one .x = ((self .display .width // (2 * email_scale_one )) - width // 2 )
318- email_label_one .y = int (self .display .height * (0.84 / email_scale_one ))
319- email_label_one .color = 0xFFFFFF
320- email_group_one .append (email_label_one )
321- business_card_splash .append (email_group_one )
307+ email_one_group = self ._create_label_group (text = email_string_one ,
308+ font = email_font_one ,
309+ scale = email_scale_one ,
310+ height_adjustment = 0.84 )
311+ business_card_splash .append (email_one_group )
322312 if email_string_two :
323- if isinstance (email_font_two , str ):
324- email_font_two = load_font (email_font_two , email_string_two )
325- email_group_two = displayio .Group (scale = email_scale_two )
326- email_label_two = Label (email_font_two , text = email_string_two , line_spacing = 0.75 )
327- (_ , _ , width , _ ) = email_label_two .bounding_box
328- email_label_two .width = self .display .width
329- email_label_two .x = ((self .display .width // (2 * email_scale_two )) - width // 2 )
330- email_label_two .y = int (self .display .height * (0.91 / email_scale_two ))
331- email_label_two .color = 0xFFFFFF
332- email_group_two .append (email_label_two )
333- business_card_splash .append (email_group_two )
313+ email_two_group = self ._create_label_group (text = email_string_two ,
314+ font = email_font_two ,
315+ scale = email_scale_two ,
316+ height_adjustment = 0.91 )
317+ business_card_splash .append (email_two_group )
334318
335319 # pylint: disable=too-many-locals
336320 def show_badge (self , * , background_color = 0xFF0000 , foreground_color = 0xFFFFFF ,
0 commit comments