debug menu toggle

This commit is contained in:
Sundog Jones 2020-08-02 12:34:16 -07:00
parent f5cd4b4625
commit b302b3c6d0
2 changed files with 8 additions and 9 deletions

View File

@ -34,6 +34,8 @@ class SoundslabDisplay:
self.previous_voltage = 0.0
# track currently playing song's art path to eliminate unnecessary reloads of the same image file
self.current_art_path = None
# start with menus hidden
self.show_menu = False
def _displayOff(self):
self.st7789.set_backlight(0) # turn off the backlight
@ -72,7 +74,7 @@ class SoundslabDisplay:
# always start with a transparent menu overlay image
im_menu_overlay = Image.new("RGBA", self.screen_size, (0, 0, 0, 0))
menu_overlay = ImageDraw.Draw(im_menu_overlay)
if self.showMenu and menu_data is not None:
if self.show_menu and menu_data is not None:
# we have a menu to display
#
# menu_data is structured as a list of dicts describing the rows to be displayed:

View File

@ -27,9 +27,6 @@ GPIO.setmode(GPIO.BCM)
# with a "PULL UP", which weakly pulls the input signal to 3.3V.
GPIO.setup(BUTTONS, GPIO.IN, pull_up_down=GPIO.PUD_UP)
# a temporary place to store menu state
show_menu = False
# some button handlers
def NE():
# play/pause toggle
@ -60,12 +57,12 @@ def SW():
def NW():
# open menu
global show_menu
global display
print("toggling menu")
if show_menu is True:
show_menu = False
if display.show_menu is True:
display.show_menu = False
else:
show_menu = True
display.show_menu = True
def SE():
# next track
@ -135,7 +132,7 @@ for pin in BUTTONS:
GPIO.add_event_detect(pin, GPIO.FALLING, handle_button, bouncetime=100)
while True:
if show_menu is True:
if display.show_menu is True:
# test menu
display.updateMenu(
[