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 os
|
||||||
import signal
|
import signal
|
||||||
|
from icecream import ic
|
||||||
from time import sleep
|
from time import sleep
|
||||||
from menu import Menu, MenuItem, MenuType
|
from menu import Menu, MenuItem, MenuType
|
||||||
from cinput import ControlInput
|
from cinput import ControlInput
|
||||||
|
@ -7,20 +8,20 @@ from graphics import Graphics
|
||||||
|
|
||||||
menu_config = [
|
menu_config = [
|
||||||
MenuItem("Information",
|
MenuItem("Information",
|
||||||
MenuType.EXEC_PLUGIN,
|
MenuType.PLUGIN,
|
||||||
{"plugin": "info"}),
|
{"plugin": "info"}),
|
||||||
MenuItem("Apps",
|
MenuItem("Apps",
|
||||||
MenuType.SUB_MENU,
|
MenuType.SUB_MENU,
|
||||||
{"sub_menu": [
|
{"sub_menu": [
|
||||||
MenuItem("Chess",
|
MenuItem("Chess",
|
||||||
MenuType.EXEC_PLUGIN,
|
MenuType.PLUGIN,
|
||||||
{"plugin": "chess"}),
|
{"plugin": "chess"}),
|
||||||
]}),
|
]}),
|
||||||
MenuItem("Reboot",
|
MenuItem("Reboot",
|
||||||
MenuType.EXEC_CMD,
|
MenuType.EXIT_CMD,
|
||||||
{"command": "sudo reboot"}),
|
{"command": "sudo reboot"}),
|
||||||
MenuItem("Shutdown",
|
MenuItem("Shutdown",
|
||||||
MenuType.EXEC_CMD,
|
MenuType.EXIT_CMD,
|
||||||
{"command": "sudo shutdown now"})]
|
{"command": "sudo shutdown now"})]
|
||||||
|
|
||||||
cinput = ControlInput()
|
cinput = ControlInput()
|
||||||
|
@ -38,10 +39,9 @@ signal.signal(signal.SIGTERM, program_exit)
|
||||||
try:
|
try:
|
||||||
while True:
|
while True:
|
||||||
item = menu.get_selection()
|
item = menu.get_selection()
|
||||||
if item.menu_type == MenuType.EXEC_CMD:
|
if item.menu_type == MenuType.EXIT_CMD:
|
||||||
graphics.clear()
|
|
||||||
graphics.show()
|
|
||||||
os.system(item.data["command"])
|
os.system(item.data["command"])
|
||||||
|
program_exit()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
ic(e)
|
ic(e)
|
||||||
program_exit()
|
program_exit()
|
||||||
|
|
Reference in New Issue