From a57958f04ddd4d27070bc52d746efa31e8845e11 Mon Sep 17 00:00:00 2001 From: fling Date: Thu, 1 Sep 2011 10:48:31 +0800 Subject: [PATCH] to_xml is ok modified: di_dialog.py modified: di_main.py --- dialog/di_dialog.py | 69 ++++++++++++++++++++++----------------------- dialog/di_main.py | 4 ++- 2 files changed, 37 insertions(+), 36 deletions(-) diff --git a/dialog/di_dialog.py b/dialog/di_dialog.py index 16c9515..e83969c 100644 --- a/dialog/di_dialog.py +++ b/dialog/di_dialog.py @@ -29,7 +29,7 @@ class Welcome(Dialog): self.height=height self.width=width - def get_welcome(self): + def set_data(self): s=Dialog.dialog.yesno(self.text,self.height,self.width,title='welcome') return s @@ -40,7 +40,7 @@ class SerialNumber(Dialog): self.height=height self.width=width - def set_number(self): + def set_data(self): s,value=Dialog.dialog.inputbox(self.text,self.height,self.width,title='serial number') if s == 0: ri_data.SerialNumber.value=value @@ -103,8 +103,7 @@ class MountPoint(Dialog): exit_info,string=Dialog.dialog.menu(text="There are five columns in the mount point display frame.\n \ Device Directory Filesystem Format Size", height=self.height,width=self.width,menu_height=len(list), - choices=list,title='Mount',ok_label='choice') - + choices=list,title='Mount',ok_label='edit',help_button=1,help_label='next') if exit_info == 0 : self.set_mountpoint(string) self.set_format(string) @@ -118,7 +117,8 @@ class MountPoint(Dialog): elif exit_info == 1 : break else: - print "error" + exit_info = 0 + break return exit_info class Network(Dialog): @@ -226,7 +226,7 @@ class Group(Dialog): ri_data.Group.dict[g].install='mandatory' return s,check_list - def set_pkg(self): + def set_data(self): s,check_list=self.choise_groups() if s == 0 and check_list: if check_list[0] == 'check all': @@ -249,44 +249,43 @@ class Service(Dialog): self.width=width self.text=text - def set_service(self): + def set_data(self): + + ri_data.Service.change_state() + list=[('check all','','off')] for s in ri_data.Service.list: - list.append((s.name,'','off')) + if s.start != 'disable': + list.append((s.name,'',s.start == 'yes' and 'on' or 'off')) - s,check_list=Dialog.dialog.checklist(text='running service',height=self.height,width=self.width,list_height=len(list),default_item='check all',choices=list,title='choices gourp') - if s == 0 and check_list: + code,check_list=Dialog.dialog.checklist(text='Plase select start service',height=self.height,width=self.width, + list_height=len(list),default_item='check all',choices=list,title='Start service') + if code == 0 and check_list: if check_list[0] == 'check all': for s in ri_data.Service.list: - s.start='yes' + if s.start != 'disable': + s.start='yes' else: for s in ri_data.Service.list: - for n in check_list: - if s.name == n : - s.start='yes' + if s.name in check_list : + s.start='yes' - for s in ri_data.Service.list: - print 'name',s.name - print 'number',s.number - print 'script',s.script - print 'start',s.start - print 'package',s.package - return s + return code - -Welcome(15,50) -#Dialog.dict['welcome'].get_welcome() -MountPoint(20,45) +#ri_data.init() +#Welcome(15,50) +#print Dialog.dict['welcome'].set_data() +#MountPoint(20,45) #Dialog.dict['mountpoint'].set_data() ### -SerialNumber(10,50) -#Dialog.dict['serialnumber'].set_number() -## -Network(10,50) +#SerialNumber(10,50) +#Dialog.dict['serialnumber'].set_data() +### +#Network(10,50) #Dialog.dict['network'].set_data() -## -Group(20,50) -#Dialog.dict['group'].set_pkg() -Service(15,50) -#Dialog.dict['service'].set_service() - +### +#Group(20,50) +#Dialog.dict['group'].set_data() +#Service(15,50) +#Dialog.dict['service'].set_data() +#ri_data.to_xml() diff --git a/dialog/di_main.py b/dialog/di_main.py index a001d48..fac8d8a 100644 --- a/dialog/di_main.py +++ b/dialog/di_main.py @@ -22,5 +22,7 @@ while True : count = count + 1 else: count = count - 1 - if count < 0 or count > len(list): + if count < 0 or count > len(list) - 1: break + +ri_data.to_xml()