added bluetooth and wpa restart menus
This commit is contained in:
parent
f3ba755b51
commit
888f777705
29
__main__.py
29
__main__.py
|
@ -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"}),
|
||||
]}),
|
||||
"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()
|
||||
|
|
1
menu.py
1
menu.py
|
@ -5,6 +5,7 @@ from graphics import Graphics
|
|||
|
||||
class MenuType(Enum):
|
||||
SUB_MENU = auto()
|
||||
CMD = auto()
|
||||
EXIT_CMD = auto()
|
||||
PLUGIN = auto()
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in New Issue