modified: di_dialog.py

This commit is contained in:
fling
2011-09-03 12:44:34 +08:00
parent 68a035b47f
commit 2c83d24c3e

View File

@@ -53,6 +53,18 @@ class SerialNumber(Dialog):
ri_data.SerialNumber.value=value
return s
class Raid(Dialog):
def __init__(self,height=10,width=30,text='making Raid devices'):
Dialog.__init__(self,name='Raid')
self.height=height
self.width=width
self.text=text
def set_data(self):
pass
class MountPoint(Dialog):
fs=''
dict={}
@@ -116,8 +128,8 @@ class MountPoint(Dialog):
self.set_format(string)
if not ri_data.MountPoint.check_data(string, # device
ri_data.MountPoint.dict[string].directory.rstrip('/'), # mountpoint
ri_data.MountPoint.dict[string].filesystem): # filesystem
ri_data.MountPoint.dict[string].directory.rstrip('/'), # mountpoint
ri_data.MountPoint.dict[string].filesystem): # filesystem
ri_data.MountPoint.dict[string].directory = ''
Dialog.message("The mount point couldn't be mounted on because it has been used or it's particular.")
@@ -135,52 +147,21 @@ class Network(Dialog):
self.height=height
self.width=width
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',clear=1)
if code == 0 :
ri_data.Network.hostname=hostname
return code
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',clear=1)
def set_network(self,string):
code,s=Dialog.dialog.inputbox(text='Plase input %s'%string,height=self.height,width=self.width,init=getattr(ri_data.Network,string),title=string,clear=1)
if code == 0:
ri_data.Network.domain=domain
setattr(ri_data.Network,string,s)
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',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',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',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',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,menu_height=3,choices=[('static','static ip address'),('dynamic','Dynamic IP address')],clear=1)
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]
list=["hostname","domain","ip","mask","gateway","primary_dns"]
while True:
s = list[count]()
s = self.set_network(list[count])
if s == 0:
count = count + 1
else :
@@ -189,7 +170,7 @@ class Network(Dialog):
if count < 0 or count > len(list) - 1:
break
else:
self.set_hostname()
self.set_network('hostname')
return s
class Group(Dialog):
@@ -293,7 +274,7 @@ class Prepar_installation(Dialog):
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',clear=1)
if s == 0 :
return s
else:
s = 1
return s
else:
return s