diff --git a/python/mine/ri_cmd.py b/python/mine/ri_cmd.py index 59eab62..bd24bae 100644 --- a/python/mine/ri_cmd.py +++ b/python/mine/ri_cmd.py @@ -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) diff --git a/python/mine/ri_data.py b/python/mine/ri_data.py index 49db81c..3ec276f 100644 --- a/python/mine/ri_data.py +++ b/python/mine/ri_data.py @@ -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 ''' diff --git a/python/mine/test.py b/python/mine/test.py index 845e98f..ad55cf1 100644 --- a/python/mine/test.py +++ b/python/mine/test.py @@ -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) diff --git a/xml/install.xml b/xml/install.xml index 36ad59f..f4eb12c 100644 --- a/xml/install.xml +++ b/xml/install.xml @@ -13,21 +13,21 @@ - + sda1 sdb1 - - + + - + - + diff --git a/xml/interface_t.xml b/xml/interface_t.xml index 413fe45..8b1ebd2 100644 --- a/xml/interface_t.xml +++ b/xml/interface_t.xml @@ -22,7 +22,7 @@ row 4 | quit previous next | - + @@ -255,7 +255,7 @@ row 4 | | - + @@ -433,17 +433,18 @@ row 4 | | column 0 column 1 ________________________________________________ row 0 | Device /dev/xxx | + row 1 | Size xxx | | _____________ | - row 1 | Directory |_____________| | + row 2 | Directory |_____________| | | _ _ | - row 2 | |_| Format |_| Not-Format | + row 3 | |_| Format |_| Not-Format | | ___________________ | - row 3 | | | | + row 4 | | | | | filesystem | | | | | | | | |___________________| | | | - row 4 | OK Cancel | + row 5 | OK Cancel | |________________________________________________| --> @@ -456,6 +457,7 @@ row 4 | | + @@ -465,39 +467,53 @@ row 4 | | + + + + + + + + + + + - + - + + - + - + + - + - + + - + - +