group is ok

modified:   di_dialog.py
This commit is contained in:
fling
2011-08-30 16:41:30 +08:00
parent e3ef33f077
commit 03cf3a0e61

View File

@@ -113,7 +113,7 @@ class MountPoint(Dialog):
return s
class Network(Dialog):
hostname=''
hostname='localhost'
domain=''
ip=''
netmask=''
@@ -163,45 +163,86 @@ class Group(Dialog):
self.width=width
self.text=text
def choise_optional(self,g):
list=[('check all','',ri_data.Group.dict[g].selection == 'all' and 'on' or 'off')]
for l in ri_data.Group.dict[g].optional:
# l is ['pkg','no']
list.append((l[0],'',l[1] == 'yes' and 'on' or 'off'))
s,check_list=Dialog.dialog.checklist(text='choice optional',height=self.height,width=self.width,list_height=self.height/5*4,choices=list,title='choices %s optional'%g)
if s == 0 and check_list :
if check_list[0] == 'check all':
ri_data.Group.dict[g].selection='all'
else:
for p in check_list:
for op in ri_data.Group.dict[g].optional:
if op[0] == p:
ri_data.Group.dict[g].optional[ri_data.Group.dict[g].optional.index(op)][1] = 'yes'
return s
def choise_groups(self):
list=[('check all','','off')]
for g in ri_data.Group.dict.keys():
if g == "base":
list.append((g,'','on'))
list.append((g,'',ri_data.Group.dict[g].install == 'mandatory' and 'on' or 'off'))
s,check_list=Dialog.dialog.checklist(text='choice group',height=self.height,width=self.width,list_height=self.height/5*4,default_item='check all',choices=list,title='choices gourp')
if s == 0 and check_list:
if check_list[0] == 'check all':
for g in ri_data.Group.dict.keys():
ri_data.Group.dict[g].install='mandatory'
else:
list.append((g,'','off'))
for g in check_list:
ri_data.Group.dict[g].install='mandatory'
return s,check_list
s,r=Dialog.dialog.checklist(text='choice group',height=self.height,width=self.width,list_height=self.height/5*4,default_item='base',choices=list,title='choices gourp')
r.append('vm')
for x in r:
print 'nmae:',ri_data.Group.dict[x].name
print 'install:',ri_data.Group.dict[x].install
print 'mandatory',ri_data.Group.dict[x].mandatory
print 'selection:',ri_data.Group.dict[x].selection
print 'optional:',ri_data.Group.dict[x].optional
def set_pkg(self):
s,check_list=self.choise_groups()
if s == 0 and check_list:
if check_list[0] == 'check all':
check_list = ri_data.Group.dict.keys()
count=0
while True:
if self.choise_optional(check_list[count]) == 0 :
count = count + 1
else:
count = count - 1
if count < 0 or count > len(check_list) - 1:
print count
break
return s
# check_list.append('vm')
# for g in check_list:
# print 'nmae:',ri_data.Group.dict[g].name
# print 'install:',ri_data.Group.dict[g].install
# print 'mandatory',ri_data.Group.dict[g].mandatory
# print 'selection:',ri_data.Group.dict[g].selection
# print 'optional:',ri_data.Group.dict[g].optional
ri_data.Partition.init_from_os()
ri_data.MountPoint.init_from_internal()
xmldoc_cfg = minidom.parse(config_xml)
root_cfg = xmldoc_cfg.firstChild
ri_data.Group.init_from_config_xml(root_cfg)
Group(20,50)
Dialog.dict['group'].choise_groups()
#Welcome(15,50)
#Dialog.dict['welcome'].get_welcome()
##print Dialog.status
##
#ri_data.Partition.init_from_os()
#print ri_data.Partition.dict.keys()
#ri_data.MountPoint.init_from_internal()
#print ri_data.MountPoint.dict.keys()
#
#MountPoint(20,75)
#Dialog.dict['mountpoint'].set_data()
##
#
#SerialNumber(10,50)
#Dialog.dict['serialnumber'].set_number()
##
#
#Network(10,50)
#Dialog.dict['network'].set_data()
#
Group(20,50)
Dialog.dict['group'].set_pkg()