further menu refinement

This commit is contained in:
Sundog Jones 2020-08-02 15:00:08 -07:00
parent 91d28312e3
commit 7e42594e13
2 changed files with 2 additions and 4 deletions

View File

@ -112,9 +112,7 @@ class SoundslabDisplay:
menu_overlay.rectangle([(21, offset_from_top),(self.screen_size[0] - 21, offset_from_top + 40)], fg_color) # highlight background for selected menu item
output_size = menu_overlay.textsize(row) # get the size of the text to draw so we can center it in our rectangle for this row
print("output_size for " + row + " is " + str(output_size[0]) + " x " + str(output_size[1]) + " px")
print("showing '" + row + "' at (" + str((self.screen_size[0] / 2) - floor(output_size[0] / 2)) + ", " + str(offset_from_top + 20 - floor(output_size[1])) + ")")
menu_overlay.text(((self.screen_size[0] / 2) - floor(output_size[0] / 2) - 11, offset_from_top + (20 - floor(output_size[1]))), row, font=font, fill=bg_color if menu_data["selected"] == idx else fg_color) # draw output text in appropriate color
menu_overlay.text(((self.screen_size[0] / 2) - floor(output_size[0] / 2) - 14, offset_from_top + (20 - floor(output_size[1]) + 1)), row, font=font, fill=bg_color if menu_data["selected"] == idx else fg_color) # draw output text in appropriate color
offset_from_top += 40
# finally, set the current_menu image

View File

@ -135,7 +135,7 @@ while True:
if display.show_menu is True:
# test menu
display.updateMenu({
"has_previous": True,
"has_previous": False,
"has_next": True,
"selected": 0,
"rows": ["Turn repeat on", "Turn shuffle on", "View queue >"]