changed exec cmd to exit cmd
This commit is contained in:
parent
db2583ad84
commit
47303cdec8
14
main.py
14
main.py
|
@ -1,5 +1,6 @@
|
|||
import os
|
||||
import signal
|
||||
from icecream import ic
|
||||
from time import sleep
|
||||
from menu import Menu, MenuItem, MenuType
|
||||
from cinput import ControlInput
|
||||
|
@ -7,20 +8,20 @@ from graphics import Graphics
|
|||
|
||||
menu_config = [
|
||||
MenuItem("Information",
|
||||
MenuType.EXEC_PLUGIN,
|
||||
MenuType.PLUGIN,
|
||||
{"plugin": "info"}),
|
||||
MenuItem("Apps",
|
||||
MenuType.SUB_MENU,
|
||||
{"sub_menu": [
|
||||
MenuItem("Chess",
|
||||
MenuType.EXEC_PLUGIN,
|
||||
MenuType.PLUGIN,
|
||||
{"plugin": "chess"}),
|
||||
]}),
|
||||
MenuItem("Reboot",
|
||||
MenuType.EXEC_CMD,
|
||||
MenuType.EXIT_CMD,
|
||||
{"command": "sudo reboot"}),
|
||||
MenuItem("Shutdown",
|
||||
MenuType.EXEC_CMD,
|
||||
MenuType.EXIT_CMD,
|
||||
{"command": "sudo shutdown now"})]
|
||||
|
||||
cinput = ControlInput()
|
||||
|
@ -38,10 +39,9 @@ signal.signal(signal.SIGTERM, program_exit)
|
|||
try:
|
||||
while True:
|
||||
item = menu.get_selection()
|
||||
if item.menu_type == MenuType.EXEC_CMD:
|
||||
graphics.clear()
|
||||
graphics.show()
|
||||
if item.menu_type == MenuType.EXIT_CMD:
|
||||
os.system(item.data["command"])
|
||||
program_exit()
|
||||
except Exception as e:
|
||||
ic(e)
|
||||
program_exit()
|
||||
|
|
Reference in New Issue