Index: mkvm ================================================================== --- mkvm +++ mkvm @@ -1,8 +1,8 @@ #!/usr/bin/python import os,sys -from snack import SnackScreen,GridForm,Listbox,Entry,Label,Checkbox,Button +from snack import SnackScreen,GridForm,Listbox,Entry,Label,Checkbox,Button,RadioBar bridge="lxc0" secno=3 macaddr="52:54:00:7d:7f:%02x"%secno options={'qemubinary':'qemu-system-x86_64', "accel":"-enable-kvm", @@ -67,18 +67,16 @@ import existing drive, use cdrom, connect some image on first run """ grid = GridForm(screen,"Setting up a disk drives",1,5) -def mkradiogroup(choices, current) +def mkradiogroup(choices, current): """ choises is an array of value,text tuples current is value, which have to be selected """ - rg = RadioGroup() - for choice in choices: - rg.add(choices[1],choices[0],current=choices[0]) + rg = RadioBar(screen,map(lambda x: (x[1],x[0],1 if x[0]==current else 0),choices) ) return rg def net_brige_conf(): """ Choose net bridge based on /etc/qemu/bridge.conf" @@ -98,11 +96,11 @@ ('vde','VDE virtual switch')], netmode) cardlbl = Label("Emulated hardware") cardbox= Listbox(height=6,width=20,scroll=1) grid.add(typlbl,0,0,padding=(3,1,3,0)) - grid.add(rg,0,1,padding(3,0,3,0) + grid.add(rg,0,1,padding=(3,0,3,0)) grid.add(cardlbl,1,0,padding=(3,1,3,0)) grid.add(cardbox,1,1,padding=(3,0,3,0)) prevbtn=Button("<>") grid.add(prevbtn,0,2,anchorLeft=1) @@ -115,25 +113,25 @@ """ global name,vmtype grid = GridForm(screen,"Choosing name of virtual machine",1,5) namelbl=Label("Enter a virtual machine name") nameline=Entry(40,text=name) - shlbl = Lable("Select virtual machine accessability") + shlbl = Label("Select virtual machine accessability") rg = mkradiogroup([('private','Private VM'),('shared','Shared VM'), ('auto','AutoStart VM')],vmtype) grid.add(namelbl,0,0,padding=(3,1,3,0),anchorLeft=1) grid.add(nameline,0,1,padding=(3,0,3,0),anchorLeft=1) - grid.add(shlbl,0,2,padding=(3,1,3,0),anchorleft=1) - grid.add(rg,0,3,padding=(3,0,3,0),anchorleft=1) - prevbtn=Button("<>") - grid.add(prevbtn,0,4,anchorLeft=1) - grid.add(nextbtn,1,4,anchorRight=1) - while not name.value(): + #grid.add(prevbtn,0,4,anchorLeft=1) + grid.add(nextbtn,0,4,anchorRight=1) + while not nameline.value(): answer=grid.runOnce() - if answer == prevbtn or answer == u'ESC': + if answer == u'ESC': return False name = nameline.value() vmtype = rg.getSelection() return True @@ -149,11 +147,11 @@ nxt=True if callable(nxt): wizard[i+1] = nxt if nxt: i+=1 - else + else : i-=1 if (i<0): sys.exit(1) finally: