1
0
mirror of https://github.com/Foltik/dotfiles synced 2025-01-09 01:06:30 -05:00

Add proper main menu

This commit is contained in:
Jack Foltz 2018-12-06 01:31:03 -05:00
parent 158c3f76b6
commit 55479080e5
Signed by: foltik
GPG Key ID: D1F0331758D1F29A

View File

@ -1,31 +1,41 @@
#!/bin/python #!/bin/python
import curses import curses
from lib.parse import Category, Package, parse import os
from lib.menu import Menu from lib.parse import parse
from lib.package import Category, Package
from lib.menu import Menu, ChecklistMenu
from lib.configure import configure from lib.configure import configure
categories = parse('packages.yml') categories = parse('packages.yml')
def noop(): run_installer = False
pass def run():
for category in [c for c in categories if c.enabled]:
for package in category.packages:
configure(package)
class App: class App:
def __init__(self, stdscreen): def __init__(self, stdscreen):
self.screen = stdscreen self.screen = stdscreen
curses.curs_set(0) curses.curs_set(0)
submenu_items = [ def exit_and_run():
('do stuff', noop) global run_installer
] run_installer = True
submenu = Menu(self.screen, submenu_items) main_menu.exit()
package_options_menu = Category.config_menu(self.screen, categories)
main_menu = Menu(self.screen, 'Main Menu', [
('Package Options', package_options_menu.display),
('Run Installer', exit_and_run)
])
main_menu_items = [
('install', noop),
('submenu', submenu.display)
]
main_menu = Menu(self.screen, main_menu_items)
main_menu.display() main_menu.display()
if __name__ == '__main__': if __name__ == '__main__':
os.environ.setdefault('ESCDELAY', '0')
curses.wrapper(App) curses.wrapper(App)
if run_installer:
run()