From 2b2925f920fdd87de2521d215be009c6b2bd8dd6 Mon Sep 17 00:00:00 2001 From: fling Date: Thu, 21 Oct 2010 16:30:42 +0800 Subject: [PATCH] modified: ri_tk_cmd.py updata: add check a directory mount point in the MountPoint or not --- interface/ri_tk_cmd.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/interface/ri_tk_cmd.py b/interface/ri_tk_cmd.py index 700b12d..98b781c 100644 --- a/interface/ri_tk_cmd.py +++ b/interface/ri_tk_cmd.py @@ -61,18 +61,10 @@ def mp_top_init(): if fs == fs_values[i]: ri_widget.Widget.dict['mp_top_fs'].tk_widget.selection_set(i) -def mp_top_check(dev,dir): - '''check mount point''' - if dir: - for d in ri_data.MountPoint.dict.values(): - if d.device == dev :continue - if d.directory == dir : return True - return False - def mp_top_ok(): ''' mount dir top window OK ''' l = [] - the_same = False + isdir_in_mp = False for itm in eval(display.var_dict['mount.list'].get()): dev = itm.split()[0] dev2 = display.var_dict['mp_top_dev'].get() @@ -90,9 +82,11 @@ def mp_top_ok(): fs = ri_data.Partition.dict[dev].filesystem else: fs = ' ' - if mp_top_check(dev,dr): - the_same = True + + if dr and dr in [ m.directory for m in ri_data.MountPoint.dict.values() if m.device != dev ]: + isdir_in_mp = True dr = ri_data.MountPoint.dict[dev].directory + s2 = dev.ljust(10) + dr.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6) + ri_data.Partition.unit l.append(s2) # make change in internal data structure @@ -102,7 +96,7 @@ def mp_top_ok(): display.var_dict['mount.list'].set(value=tuple(l)) ri_widget.TopWindow.dict['mount_list_modify'].hide() - if the_same: + if isdir_in_mp: ri_widget.MessageBox.dict['check_mount_point'].show() def mp_top_cancel():