diff --git a/dialog/di_dialog.py b/dialog/di_dialog.py index 1675817..d7e13c7 100644 --- a/dialog/di_dialog.py +++ b/dialog/di_dialog.py @@ -9,6 +9,8 @@ from xml.dom.ext import PrettyPrint #import ../interface/ri_data #d=dialog.Dialog() #d.setBackgroundTitle("Rocky 4.2 install") +config_xml="../xml/config.xml" + class Dialog: dialog status='' @@ -36,13 +38,15 @@ class SerialNumber(Dialog): self.height=height self.width=width - def get_number(self): - s,SerialNumber.number=Dialog.dialog.inputbox(self.text,self.height,self.width,title='serial number',extra_button='edit') + def set_number(self): + + s,SerialNumber.number=Dialog.dialog.inputbox(self.text,self.height,self.width,title='serial number') + print s if s == 0 or s == 1 : return else: - SerialNumber.get_number(self) + SerialNumber.set_number(self) def show(self): print SerialNumber.tuple @@ -97,7 +101,7 @@ class MountPoint(Dialog): for d in keys: list.append((ri_data.MountPoint.dict[d].device,ri_data.MountPoint.dict[d].directory.ljust(10)+ri_data.MountPoint.dict[d].filesystem.ljust(5)+ri_data.MountPoint.dict[d].format.ljust(5)+ri_data.Partition.dict[d].size+ri_data.Partition.unit)) - s,d=Dialog.dialog.menu(text='device map',height=self.height,width=self.width,menu_height=self.height/5*4,choices=list,title='MountPoint') + s,d=Dialog.dialog.menu(text='device map',height=self.height,width=self.width,menu_height=self.height/5*4,choices=list,title='MountPoint',ok_label='choice') if s == 0 : self.set_mountpoint(d) @@ -106,21 +110,98 @@ class MountPoint(Dialog): break else: print "error" + return s + +class Network(Dialog): + hostname='' + domain='' + ip='' + netmask='' + gateway='' + primary_dns='' + secondary_dns='' + configuration='' + def __init__(self,height=10,width=30,text='Configure network'): + Dialog.__init__(self,name='network') + self.text=text + self.height=height + self.width=width + + def set_hostname(self): + s,Network.hostname=Dialog.dialog.inputbox(text='input host name',height=self.height,width=self.width,init=Network.hostname,title='hostname') + return s + + def set_domain(self): + s,Network.domain=Dialog.dialog.inputbox(text='input domain name',height=self.height,width=self.width,init=Network.domain,title='doname name') + return s + + def set_ip(self): + s,Network.ip=Dialog.dialog.inputbox(text='input ip',height=self.height,width=self.width,init=Network.ip,title='ip') + return s + + def set_data(self): + s,Network.configuration=Dialog.dialog.menu(text='choice a network',height=self.height,width=self.width,choices=[('static','static network'),('dchp','d c cp ')],) + if s == 0 and Network.configuration == 'static': + count=0 + list=[self.set_hostname,self.set_domain,self.set_ip] + while True: + s = list[count]() + if s == 0: + count = count + 1 + else : + count = count - 1 + + if count < 0 or count > len(list) - 1: + break + else: + self.set_hostname() + +class Group(Dialog): + def __init__(self,height=10,width=50,text='install pkg'): + Dialog.__init__(self,name='group') + self.height=height + self.width=width + self.text=text + + def choise_groups(self): + list=[('check all','','off')] + for g in ri_data.Group.dict.keys(): + if g == "base": + list.append((g,'','on')) + else: + list.append((g,'','off')) + + 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 + + + +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() -#Dialog.dict['mountpoint'].set_format() -#Dialog.dict['mountpoint'].set_fstype() -#Dialog.dict['mountpoint'].check_list() - +##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'].get_number() +#Dialog.dict['serialnumber'].set_number() +## +#Network(10,50) +#Dialog.dict['network'].set_data()