diff --git a/dialog/di_dialog.py b/dialog/di_dialog.py index 030793d..c44a6f2 100644 --- a/dialog/di_dialog.py +++ b/dialog/di_dialog.py @@ -20,11 +20,11 @@ class Dialog: @staticmethod def message(string): - Dialog.dialog.msgbox(text=string,height=10,width=30) + Dialog.dialog.msgbox(text=string,height=10,width=30,clear=1) @staticmethod def yesno(string): - return Dialog.dialog.yesno(text=string,height=10,width=30) + return Dialog.dialog.yesno(text=string,height=10,width=30,clear=1) #Installation configure finish. Press "ok" to start the installation. Press "Cancel" to cancel the installation. class Welcome(Dialog): @@ -35,7 +35,7 @@ class Welcome(Dialog): self.width=width def set_data(self): - s=Dialog.dialog.yesno(self.text,self.height,self.width,title='welcome') + s=Dialog.dialog.yesno(self.text,self.height,self.width,title='welcome',clear=1) if s == 0 : ri_data.init() return s @@ -48,7 +48,7 @@ class SerialNumber(Dialog): self.width=width def set_data(self): - s,value=Dialog.dialog.inputbox(self.text,self.height,self.width,title='serial number') + s,value=Dialog.dialog.inputbox(self.text,self.height,self.width,title='serial number',clear=1) if s == 0: ri_data.SerialNumber.value=value return s @@ -72,14 +72,14 @@ class MountPoint(Dialog): ('swap','SWAP is a swap')] # menu return "(status,choice)" - exit_info,string= Dialog.dialog.menu(self.text,self.height,self.width,choices=list,title='Mount Point',default_item='ext3') + exit_info,string= Dialog.dialog.menu(self.text,self.height,self.width,choices=list,title='Mount Point',default_item='ext3',clear=1) if exit_info == 0: ri_data.MountPoint.dict[device].filesystem=string return exit_info def set_mountpoint(self,device): - code,string=Dialog.dialog.inputbox(text='Plase input mount point',height=10,width=30,init=ri_data.MountPoint.dict[device].directory,title='Mount point') + code,string=Dialog.dialog.inputbox(text='Plase input mount point',height=10,width=30,init=ri_data.MountPoint.dict[device].directory,title='Mount point',clear=1) if code == 0: ri_data.MountPoint.dict[device].directory=string else: @@ -88,7 +88,7 @@ class MountPoint(Dialog): return code def set_format(self,device): - n = Dialog.dialog.yesno(text='Format the devices',title='Format') + n = Dialog.dialog.yesno(text='Format the devices',title='Format',clear=1) if n == 0 : ri_data.MountPoint.dict[device].format='yes' @@ -109,8 +109,8 @@ 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='edit',help_button=1,help_label='next') + height=self.height,width=self.width,menu_height=(len(list) > self.height and self.helght - 2 or len(list) ), + choices=list,title='Mount',ok_label='edit',help_button=1,help_label='Next',clear=1) if exit_info == 0 : self.set_mountpoint(string) self.set_format(string) @@ -137,7 +137,7 @@ class Network(Dialog): def set_hostname(self): code,hostname=Dialog.dialog.inputbox(text='Plase input the hostname',height=self.height,width=self.width, - init=ri_data.Network.hostname and ri_data.Network.hostname or 'localhost' ,title='Hostname') + init=ri_data.Network.hostname and ri_data.Network.hostname or 'localhost' ,title='Hostname',clear=1) if code == 0 : ri_data.Network.hostname=hostname @@ -145,37 +145,37 @@ class Network(Dialog): def set_domain(self): code,domain=Dialog.dialog.inputbox(text='Plase input domain name',height=self.height,width=self.width, - init=ri_data.Network.domain and ri_data.Network.domain or 'in.linx' ,title='doname name') + init=ri_data.Network.domain and ri_data.Network.domain or 'in.linx' ,title='doname name',clear=1) if code == 0: ri_data.Network.domain=domain return code def set_ip(self): - code,ip=Dialog.dialog.inputbox(text='Plase input ip address',height=self.height,width=self.width,init=ri_data.Network.ip,title='Ip') + code,ip=Dialog.dialog.inputbox(text='Plase input ip address',height=self.height,width=self.width,init=ri_data.Network.ip,title='Ip',clear=1) if code == 0: ri_data.Network.ip = ip return code def set_netmask(self): - code,mask=Dialog.dialog.inputbox(text='Plase input net mask',height=self.height,width=self.width,init=ri_data.Network.mask,title='Netmask') + code,mask=Dialog.dialog.inputbox(text='Plase input net mask',height=self.height,width=self.width,init=ri_data.Network.mask,title='Netmask',clear=1) if code == 0: ri_data.Network.mask = mask return code def set_gateway(self): - code,gateway=Dialog.dialog.inputbox(text='Plase input gateway',height=self.height,width=self.width,init=ri_data.Network.gateway,title='Gateway') + code,gateway=Dialog.dialog.inputbox(text='Plase input gateway',height=self.height,width=self.width,init=ri_data.Network.gateway,title='Gateway',clear=1) if code == 0: ri_data.Network.gateway = gateway return code def set_primary_dns(self): - code,primary_dns=Dialog.dialog.inputbox(text='Plase input DNS',height=self.height,width=self.width,init=ri_data.Network.primary_dns,title='DNS') + code,primary_dns=Dialog.dialog.inputbox(text='Plase input DNS',height=self.height,width=self.width,init=ri_data.Network.primary_dns,title='DNS',clear=1) if code == 0: ri_data.Network.primary_dns = primary_dns return code def set_data(self): - s,ri_data.Network.configuration=Dialog.dialog.menu(text='choice a network',height=self.height,width=self.width,choices=[('static','static ip address'),('dynamic','Dynamic IP address')]) + s,ri_data.Network.configuration=Dialog.dialog.menu(text='choice a network',height=self.height,width=self.width,menu_height=3,choices=[('static','static ip address'),('dynamic','Dynamic IP address')],clear=1) if s == 0 and ri_data.Network.configuration == 'static': count=0 list=[self.set_hostname,self.set_domain,self.set_ip,self.set_netmask,self.set_gateway,self.set_primary_dns] @@ -207,7 +207,7 @@ class Group(Dialog): list.append((l[0],'',l[1] == 'yes' and 'on' or 'off')) s,check_list=Dialog.dialog.checklist(text='Plase select the installation package',height=self.height, - width=self.width,list_height=len(list),choices=list,title='choices %s optional'%g) + width=self.width,choices=list,title='choices %s optional'%g,clear=1) if s == 0 and check_list : if check_list[0] == 'check all': @@ -222,13 +222,10 @@ class Group(Dialog): list=[(u'check all','','off')] for g in ri_data.Group.dict.keys(): - if g == 'base': - list.append((g,'','on')) - else: - list.append((g,'',ri_data.Group.dict[g].install == 'yes' and 'on' or 'off')) + list.append((g,'',((ri_data.Group.dict[g].install == 'yes' or ri_data.Group.dict[g].install == 'mandatory') and 'on' or 'off'))) s,check_list=Dialog.dialog.checklist(text='Plase select the installation Group',height=self.height,width=self.width, - list_height=len(list),choices=list,default_item='check all',title='Package group') + list_height=(len(list) > self.height) and self.height - 2 or len(list),choices=list,default_item='check all',title='Package group',clear=1) if s == 0 and check_list: if check_list[0] == 'check all': for g in ri_data.Group.dict.keys(): @@ -270,7 +267,7 @@ class Service(Dialog): list.append((s.name,'',s.start == 'yes' and 'on' or 'off')) 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') + list_height=len(list),default_item='check all',choices=list,title='Start service',clear=1) if code == 0 and check_list: if check_list[0] == 'check all': for s in ri_data.Service.list: @@ -294,29 +291,9 @@ class Prepar_installation(Dialog): self.text=text def set_data(self): - s = Dialog.dialog.textbox(filename='/var/install/install.xml',height=self.height,width=self.width,title='Installation information',help_button=1,help_label='back') + s = Dialog.dialog.textbox(filename='/var/install/install.xml',height=self.height,width=self.width,title='Installation information',help_button=1,help_label='Back',clear=1) if s == 0 : return s else: s = 1 return s - -#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_data() -### -#Network(10,50) -#Dialog.dict['network'].set_data() -### -#Group(20,50) -#Dialog.dict['group'].set_data() -#Service(15,50) -#Dialog.dict['service'].set_data() -#ri_data.to_xml() -#Prepar_installation(40,150) -#Dialog.dict['information'].set_data() diff --git a/dialog/di_main.py b/dialog/di_main.py index 300d419..e1afe44 100644 --- a/dialog/di_main.py +++ b/dialog/di_main.py @@ -12,12 +12,11 @@ di_dialog.SerialNumber(10,50) di_dialog.Network(10,50) di_dialog.Group(20,50) di_dialog.Service(15,50) -di_dialog.Prepar_installation(40,150) +di_dialog.Prepar_installation(40,100) count=0 while True : s = di_dialog.Dialog.dict[list[count]].set_data() - print s if s == 0: count = count + 1 else: @@ -26,6 +25,7 @@ while True : if count < 0 or count > len(list) - 1: break -os.system("python ../interface/ri_install.py") +if s == 0: + os.system("python ../interface/ri_install.py")