added bluetooth and wpa restart menus

This commit is contained in:
Rudis Muiznieks 2022-12-28 08:35:28 -06:00
parent f3ba755b51
commit 888f777705
Signed by: rudism
GPG key ID: CABF2F86EF7884F9
4 changed files with 20 additions and 15 deletions

View file

@ -10,21 +10,9 @@ from graphics import Graphics
menu_config = [
MenuItem("Music",
MenuType.SUB_MENU,
{"sub_menu": [
MenuItem("Artists",
MenuType.PLUGIN,
{"plugin": "music",
"arg": "artists"}),
MenuItem("Genres",
MenuType.PLUGIN,
{"plugin": "music",
"arg": "genres"}),
MenuItem("Playlists",
MenuType.PLUGIN,
{"plugin": "music",
"arg": "playlists"}),
]}),
MenuType.PLUGIN,
{"plugin": "music",
"arg": "music"}),
MenuItem("Podcasts",
MenuType.PLUGIN,
{"plugin": "music",
@ -40,6 +28,16 @@ menu_config = [
MenuType.PLUGIN,
{"plugin": "info",
"arg": None}),
MenuItem("Wireless",
MenuType.SUB_MENU,
{"sub_menu": [
MenuItem("Reset Wifi",
MenuType.CMD,
{"command": "sudo sv restart wpa_supplicant"}),
MenuItem("Reset Bluetooth",
MenuType.CMD,
{"command": "sudo sv restart bluetoothd"}),
]}),
MenuItem("Reboot",
MenuType.EXIT_CMD,
{"command": "sudo reboot"}),
@ -79,6 +77,11 @@ try:
graphics.text("Plugin error!", 0, 0, 1)
graphics.show()
time.sleep(3)
elif item.menu_type == MenuType.CMD:
graphics.clear()
graphics.text("Executing...", 0, 0, 1)
graphics.show()
os.system(item.data["command"])
elif item.menu_type == MenuType.EXIT_CMD:
os.system(item.data["command"])
program_exit()

View file

@ -5,6 +5,7 @@ from graphics import Graphics
class MenuType(Enum):
SUB_MENU = auto()
CMD = auto()
EXIT_CMD = auto()
PLUGIN = auto()

0
plugin/music/__init__.py Normal file
View file

View file

@ -13,6 +13,7 @@ icecream==2.1.3
pyftdi==0.54.0
Pygments==2.13.0
pyserial==3.5
python-mpv==1.0.1
pyusb==1.2.1
RPi.GPIO==0.7.1
six==1.16.0