#!/usr/bin/env python

from snack import *

import os

screen = SnackScreen()

screen.drawRootText(0, 0, 'Welcome to Rocky Security OS')

helpline='<Arrows> between elments  |  <Space> selects  |  <F12> Confirm'

screen.pushHelpLine(helpline)

inst_mod_items = {'Manual install text mode':'Text', 'Auto install':'Auto', 'State Grid automated install':'StateGrid'}

inst_mod_num = len(inst_mod_items)

inst_mod_listbox = Listbox(inst_mod_num+2, width = 40, returnExit = 0)

#for i in range(inst_mod_num):
for i in inst_mod_items.keys():
    inst_mod_listbox.append(i,inst_mod_items[i])

tex = TextboxReflowed(40, "Please choose one install mode from the list blow \nand press 'F12' to confirm.")

g = GridForm(screen, "Install Mode Select", 1, 3)

g.add(tex, 0, 0)
g.add(Label(""), 0, 1)
g.add(inst_mod_listbox, 0, 2)

g.runOnce()

screen.popWindow()

screen.finish()

instmode =  str(inst_mod_listbox.current())

os.system('echo %s >/tmp/xrasmxioecnz' %(instmode)) 
