remove mount_list quit function

modify network_init, add a default process in network configuration method
This commit is contained in:
Zhi Li
2010-07-31 10:52:03 +08:00
parent 53ba1ae4c1
commit 1318d9b4ac
5 changed files with 63 additions and 40 deletions

View File

@@ -60,17 +60,6 @@ def mount_list_init():
l.append(s)
display.var_dict['mount.list'].set(value=tuple([str(i) for i in l]))
def mount_list_quit():
''' mount list quit function, write mount information into xml file '''
s = display.var_dict['mount.list'].get()
if not s: return
tpl = eval(s)
for i in range(len(tpl)):
dev, dir, fs, fm, sz= tpl[i].split()
ri_data.MountPoint.list[i].directory = dir
ri_data.MountPoint.list[i].filesystem = fs
ri_data.MountPoint.list[i].format = fm
def mount_list_modify(*args):
''' modify an item in mount list '''
tw = ri_widget.TopWindow.dict['mount_list_modify']
@@ -82,11 +71,14 @@ def mp_top_init():
idxs = ml_win.curselection()
if len(idxs) == 1:
idx = int(idxs[0])
s = display.var_dict['mount.list'].get()
if not s: return
tpl = eval(s)
dev, dir, fs, fm, sz = tpl[idx].split()
mp = ri_data.MountPoint.list[idx]
dev = mp.device
dir = mp.directory
fs = mp.filesystem
fm = mp.format
sz = mp.size
display.var_dict['mp_top_dev'].set(value=dev)
display.var_dict['mp_top_size'].set(value=sz)
display.var_dict['mp_top_dir'].set(value=dir)
if fm == 'yes':
ri_widget.Widget.dict['mp_top_format'].tk_widget.select()
@@ -102,17 +94,23 @@ def mp_top_ok():
''' mount dir top window OK '''
l = []
for itm in eval(display.var_dict['mount.list'].get()):
dev, dir, fs, fm, sz = itm.split()
dev = itm.split()[0]
dev2 = display.var_dict['mp_top_dev'].get()
if dev == dev2:
sz = display.var_dict['mp_top_size'].get()
dir = display.var_dict['mp_top_dir'].get()
fm = display.var_dict['mp_top_format'].get()
idxs2 = ri_widget.Widget.dict['mp_top_fs'].tk_widget.curselection()
idx2 = int(idxs2[0])
fs = eval(display.var_dict['mp_top_fs'].get())[idx2]
if len(idxs2):
idx2 = int(idxs2[0])
fs = eval(display.var_dict['mp_top_fs'].get())[idx2]
else:
fs = ''
s2 = dev.ljust(10) + dir.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6)
l.append(s2)
# make change in internal data structure
ri_data.MountPoint.change(dev2, dir, fs, fm)
else:
l.append(itm)
@@ -127,7 +125,7 @@ def mp_top_cancel():
def network_init():
''' network initialize '''
display.var_dict['network_host_name']. set(value=ri_data.Network.hostname)
ri_widget.Widget.dict['network_config_%s' %(ri_data.Network.configuration,)].tk_widget.invoke()
ri_widget.Widget.dict['network_config_%s' %(ri_data.Network.configuration and ri_data.Network.configuration or 'static')].tk_widget.invoke()
display.var_dict['network_domain_name']. set(value=ri_data.Network.domain)
display.var_dict['network_ip']. set(value=ri_data.Network.ip)
display.var_dict['network_subnet_mask']. set(value=ri_data.Network.mask)

View File

@@ -211,8 +211,17 @@ class MountPoint:
self.directory = dir
self.filesystem = fs
self.format = fm
self.size = Partition.get_size(dev)
MountPoint.list.append(self)
@staticmethod
def change(dev, dir, fs, fm):
for i in range(len(MountPoint.list)):
if MountPoint.list[i].device == dev:
MountPoint.list[i].directory = dir
MountPoint.list[i].filesystem = fs
MountPoint.list[i].format = fm
@staticmethod
def init_from_internal():
''' init MountPoint from internal class Partition and class Raid '''

View File

@@ -35,8 +35,8 @@ else:
xmldoc = minidom.parse(itf_xml)
ri_data.install_xml = ins_xml
#ri_data.init_from_xml()
ri_data.init()
ri_data.init_from_xml()
#ri_data.init()
ri_widget.construct(xmldoc.firstChild)
ri_seq.construct(xmldoc.firstChild)