modified: di_dialog.py

modified:   di_main.py
	modified:   ../main/setup
This commit is contained in:
fling
2011-09-01 15:47:26 +08:00
parent 311ad1dbca
commit 01c69d29b2
3 changed files with 41 additions and 29 deletions

View File

@@ -137,14 +137,15 @@ 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')
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,title='doname name')
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')
if code == 0:
ri_data.Network.domain=domain
return code
@@ -199,38 +200,42 @@ class Group(Dialog):
self.text=text
def choise_optional(self,g):
list=[('check all','',ri_data.Group.dict[g].selection == 'all' and 'on' or 'off')]
list=[(u'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='Plase select the installation package',height=self.height,
width=self.width,choices=list,title='choices %s optional'%g)
width=self.width,list_height=len(list),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'
for op in ri_data.Group.dict[g].optional:
if op[0] in check_list:
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')]
list=[(u'check all','','off')]
for g in ri_data.Group.dict.keys():
list.append((g,'',ri_data.Group.dict[g].install == 'mandatory' and 'on' or 'off'))
if g == 'base':
list.append((g,'','on'))
else:
list.append((g,'',ri_data.Group.dict[g].install == 'yes' 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),default_item='check all',choices=list,title='Package group')
list_height=len(list),choices=list,default_item='check all',title='Package group')
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'
ri_data.Group.dict[g].install='yes'
else:
for g in check_list:
ri_data.Group.dict[g].install='mandatory'
ri_data.Group.dict[g].install='yes'
return s,check_list
def set_data(self):

View File

@@ -26,6 +26,6 @@ while True :
if count < 0 or count > len(list) - 1:
break
os.system("python ../information/ri_install.py")
os.system("python ../interface/ri_install.py")

View File

@@ -38,21 +38,29 @@ usage(){
}
config_execfile(){
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "twm &" >> ${work_write_dir}/${exec_file}
echo "cd ${workdir}" >> ${work_write_dir}/${exec_file}
if [ -f ${work_write_dir}/install.xml ]; then
echo "python check_oldconf.py -l $1 " >> ${work_write_dir}/${exec_file}
if test "$1" == "dialog"
then
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "cd ${workdir}" >> ${work_write_dir}/${exec_file}
echo "python di_main.py" >> ${work_write_dir}/${exec_file}
else
echo "#!/bin/bash" > ${work_write_dir}/${exec_file}
echo "twm &" >> ${work_write_dir}/${exec_file}
echo "cd ${workdir}" >> ${work_write_dir}/${exec_file}
if [ -f ${work_write_dir}/install.xml ]; then
echo "python check_oldconf.py -l $1 " >> ${work_write_dir}/${exec_file}
fi
echo "python ri_main.py -l $2 -c $configfile" >> ${work_write_dir}/${exec_file}
fi
echo "python ri_main.py -l $1 -c $configfile" >> ${work_write_dir}/${exec_file}
}
main(){
local style='graph'
local language='chinese'
local xstart='yes'
local dialog=''
tmp=$(getopt -o c:s:l:nh --long style:,configfile:,language:,noXserver,help -- "$@")
tmp=$(getopt -o c:dsl:nh --long style:,configfile:,language:,noXserver,help -- "$@")
eval set -- "$tmp"
mkdir -p $work_write_dir
@@ -60,7 +68,7 @@ main(){
while true;do
case "$1" in
'-c'|'--configfile') configfile="$2" ; shift 2;;
'-s'|'--style') type="$2" ;shift 2;;
'-s'|'--style') xstart='no';style="dialog" ;workdir="$(pwd)/../dialog";shift ;;
'-l'|'--language') language="$2" ;shift 2;;
'-n'|'--noXserver') xstart='no' ;shift ;;
'-h'|'--help') usage ; exit 0 ;;
@@ -70,17 +78,16 @@ main(){
done
if [ $style = 'graph' ]; then
config_execfile "$language"
config_execfile "$style" "$language"
else
:
# text install
config_execfile "$style"
fi
if [ $xstart = 'yes' ]; then
X -configure
startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new
X -configure
startx ${work_write_dir}/${exec_file} -- -config ~/xorg.conf.new
else
bash ${work_write_dir}/${exec_file}
bash ${work_write_dir}/${exec_file}
fi
}