added bluetooth and wpa restart menus
This commit is contained in:
parent
f3ba755b51
commit
888f777705
33
__main__.py
33
__main__.py
|
@ -10,21 +10,9 @@ from graphics import Graphics
|
||||||
|
|
||||||
menu_config = [
|
menu_config = [
|
||||||
MenuItem("Music",
|
MenuItem("Music",
|
||||||
MenuType.SUB_MENU,
|
MenuType.PLUGIN,
|
||||||
{"sub_menu": [
|
{"plugin": "music",
|
||||||
MenuItem("Artists",
|
"arg": "music"}),
|
||||||
MenuType.PLUGIN,
|
|
||||||
{"plugin": "music",
|
|
||||||
"arg": "artists"}),
|
|
||||||
MenuItem("Genres",
|
|
||||||
MenuType.PLUGIN,
|
|
||||||
{"plugin": "music",
|
|
||||||
"arg": "genres"}),
|
|
||||||
MenuItem("Playlists",
|
|
||||||
MenuType.PLUGIN,
|
|
||||||
{"plugin": "music",
|
|
||||||
"arg": "playlists"}),
|
|
||||||
]}),
|
|
||||||
MenuItem("Podcasts",
|
MenuItem("Podcasts",
|
||||||
MenuType.PLUGIN,
|
MenuType.PLUGIN,
|
||||||
{"plugin": "music",
|
{"plugin": "music",
|
||||||
|
@ -40,6 +28,16 @@ menu_config = [
|
||||||
MenuType.PLUGIN,
|
MenuType.PLUGIN,
|
||||||
{"plugin": "info",
|
{"plugin": "info",
|
||||||
"arg": None}),
|
"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",
|
MenuItem("Reboot",
|
||||||
MenuType.EXIT_CMD,
|
MenuType.EXIT_CMD,
|
||||||
{"command": "sudo reboot"}),
|
{"command": "sudo reboot"}),
|
||||||
|
@ -79,6 +77,11 @@ try:
|
||||||
graphics.text("Plugin error!", 0, 0, 1)
|
graphics.text("Plugin error!", 0, 0, 1)
|
||||||
graphics.show()
|
graphics.show()
|
||||||
time.sleep(3)
|
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:
|
elif item.menu_type == MenuType.EXIT_CMD:
|
||||||
os.system(item.data["command"])
|
os.system(item.data["command"])
|
||||||
program_exit()
|
program_exit()
|
||||||
|
|
1
menu.py
1
menu.py
|
@ -5,6 +5,7 @@ from graphics import Graphics
|
||||||
|
|
||||||
class MenuType(Enum):
|
class MenuType(Enum):
|
||||||
SUB_MENU = auto()
|
SUB_MENU = auto()
|
||||||
|
CMD = auto()
|
||||||
EXIT_CMD = auto()
|
EXIT_CMD = auto()
|
||||||
PLUGIN = auto()
|
PLUGIN = auto()
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ icecream==2.1.3
|
||||||
pyftdi==0.54.0
|
pyftdi==0.54.0
|
||||||
Pygments==2.13.0
|
Pygments==2.13.0
|
||||||
pyserial==3.5
|
pyserial==3.5
|
||||||
|
python-mpv==1.0.1
|
||||||
pyusb==1.2.1
|
pyusb==1.2.1
|
||||||
RPi.GPIO==0.7.1
|
RPi.GPIO==0.7.1
|
||||||
six==1.16.0
|
six==1.16.0
|
||||||
|
|
Reference in New Issue