menu display work

This commit is contained in:
Sundog Jones 2020-08-02 14:45:18 -07:00
parent e99a03d8e2
commit 564b083692

View File

@ -93,15 +93,17 @@ class SoundslabDisplay:
# set up prev indicator row
menu_overlay.rectangle([(21,21), (self.screen_size[0] - 21, 61)], bg_color)
if menu_data["has_previous"]:
menu_overlay.polygon([(floor(self.screen_size[0] / 2) - 20, 59), (floor(self.screen_size[0] / 2), 23), (floor(self.screen_size[0] / 2) + 20, 59)], fill=fg_color)
# draw triangle pointing up
menu_overlay.polygon([(floor(self.screen_size[0] / 2) - 20, 56), (floor(self.screen_size[0] / 2), 23), (floor(self.screen_size[0] / 2) + 20, 56)], fill=fg_color)
# set up next indicator row
menu_overlay.rectangle([(21, self.screen_size[1] - 21), (self.screen_size[0] - 21, self.screen_size[1] - 61)], bg_color)
if menu_data["has_next"]:
menu_overlay.polygon([(floor(self.screen_size[0] / 2) - 20, self.screen_size[1] - 59), (floor(self.screen_size[0] / 2), self.screen_size[1] - 23), (floor(self.screen_size[0] / 2) + 20, self.screen_size[1] - 59)], bg_color)
# draw triangle pointing down
menu_overlay.polygon([(floor(self.screen_size[0] / 2) - 20, self.screen_size[1] - 56), (floor(self.screen_size[0] / 2), self.screen_size[1] - 23), (floor(self.screen_size[0] / 2) + 20, self.screen_size[1] - 56)], bg_color)
# draw three menu rows
offset_from_top = 61 # start at the 21st row of pixels to draw inside the outer overlay, add 40 to account for the "prev" indicator row
font = ImageFont.truetype(font='/usr/share/fonts/truetype/hack/Hack-Bold.ttf', size=14)
font = ImageFont.truetype(font='/usr/share/fonts/truetype/hack/Hack-Bold.ttf', size=16)
for idx, row in enumerate(menu_data["rows"], start=0):
if menu_data["selected"] == idx: