menu debug

This commit is contained in:
Sundog Jones 2020-08-02 13:05:16 -07:00
parent 839412871d
commit 4f2015374f

View File

@ -88,7 +88,7 @@ class SoundslabDisplay:
# a translucent red background rectangle for the menu area itself
menu_overlay.rectangle([(21,21), (self.screen_size[0] - 21,self.screen_size[1] - 21)], (200, 0, 0, 127))
menu_overlay.rectangle([(21,21), (self.screen_size[0] - 21,self.screen_size[1] - 21)], (200, 0, 0, 200))
offset_from_top = 21 # start at the 21st row of pixels to draw inside the outer overlay
font = ImageFont.truetype(font='/usr/share/fonts/truetype/hack/Hack-Regular.ttf', size=14)
@ -97,7 +97,8 @@ class SoundslabDisplay:
menu_overlay.rectangle([(21, offset_from_top),(self.screen_size[0] - 21, offset_from_top + 40)], self.bg_color) # highlight background for selected menu item
output_size = menu_overlay.textsize(row["output"]) # get the size of the text to draw so we can center it in our rectangle for this row
menu_overlay.text((21 + floor(output_size[0] / 2), offset_from_top + (40 - floor(output_size[1] / 2))), row["output"], font=font, fill=self.fg_color if row["selected"] else self.bg_color) # draw output text in appropriate color
print("showing '" + row["output"] + "' at (" + str(21 + floor(output_size[0] / 2)) + ", " + str(offset_from_top + 40 - floor(output_size[1])) + ")")
menu_overlay.text((21 + floor(output_size[0] / 2), offset_from_top + (40 - floor(output_size[1]))), row["output"], font=font, fill=self.fg_color if row["selected"] else self.bg_color) # draw output text in appropriate color
offset_from_top += 40
# finally, set the current_menu image